Bug 802 - workaround for possible some "unused" function parameters
workaround for possible some "unused" function parameters
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
Other Linux
: P5 enhancement
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-22 03:29 CEST by JINMEI Tatuya
Modified: 2016-07-22 09:07 CEST (History)
2 users (show)

See Also:


Attachments
sample patch (1.29 KB, patch)
2016-07-22 03:29 CEST, JINMEI Tatuya
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description JINMEI Tatuya 2016-07-22 03:29:46 CEST
Created attachment 343 [details]
sample patch

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.
Comment 1 Wouter Wijngaards 2016-07-22 09:07:05 CEST
Hi Jinmei,

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