Bugzilla – Bug 802
workaround for possible some "unused" function parameters
Last modified: 2016-07-22 09:07:05 CEST
Created attachment 343 [details]
A recent trunk version of unbound doesn't compile with a stricter
compiler warnings if they are promoted to an error due to some
"unused" function parameters that are only used in log_assert().
For example, it fails to compile if I try to build it as follows:
% uname -a
Linux jinmei-VirtualBox 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
% gcc --version
gcc (Ubuntu 5.3.1-14ubuntu2.1) 5.3.1 20160413
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% FLAGS='-Wall -Wextra -Werror' ./configure && make
The attached patch will fix this particular problem (there can be
several other ways to fix it; I'm not sure which one is the common
practice for unbound).
This is a minor point in a sense, but it would be nice if we can build
it with stricter warnings and -Werror since it would help detect some
sorts of stupid bugs at compile time.
Thank you for the patch to remove warnings. I have made a different patch, cast to void will remove the unused warning but also when the log_assert is active not claim the variable is unused.
Best regards, Wouter