Bugzilla – Full Text Bug Listing
|Summary:||workaround for possible some "unused" function parameters|
|Product:||unbound||Reporter:||JINMEI Tatuya <jtatuya>|
|Component:||server||Assignee:||unbound team <unbound-team>|
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