On 07/01/2012 12:38 AM, Eric Blake wrote: > On 06/30/2012 05:10 PM, Pádraig Brady wrote: > >> This should address it: >> >> commit 8f4dcad477da1a952a04478ae125d5453f29dcc9 >> Author: Pádraig Brady <[email protected]> >> Date: Sun Jul 1 00:04:37 2012 +0100 >> >> maint: avoid a -Wunsed-but-set warning on some systems >> >> * src/stty.c (main): Mark speed_was_set as unused when >> CIBAUD undefined (like on ppc64 GNU/Linux for example). >> Reported-by: Stefano Lattarini >> >> diff --git a/src/stty.c b/src/stty.c >> index 83b502c..b2dd849 100644 >> --- a/src/stty.c >> +++ b/src/stty.c >> @@ -737,7 +737,11 @@ main (int argc, char **argv) >> int argi = 0; >> int opti = 1; >> bool require_set_attr; >> +#ifdef CIBAUD >> bool speed_was_set; >> +#else >> + bool speed_was_set ATTRIBUTE_UNUSED; >> +#endif > > Three lines too many. ATTRIBUTE_UNUSED is defined by gcc to mean 'might > be unused, therefore don't warn if it was not used', and not 'must not > be used, and therefore warn if it is used'. Therefore, it is always > safe to use the one-liner: > > bool speed_was_set ATTRIBUTE_UNUSED; > > even if, when CIBAUD is defined, it was actually used. No need for > extra #ifdef. >
But then you would never get such warnings for this variable. I was trying to disable the warning only where it's incorrect, and thought the single ifdef worth it?
