GNU bug report logs - #11829
Build failure with --enable-gcc-warnings

Previous Next

Package: coreutils;

Reported by: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Date: Sat, 30 Jun 2012 22:28:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 11829 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 11829 <at> debbugs.gnu.org
Subject: Re: bug#11829: Build failure with --enable-gcc-warnings
Date: Sun, 01 Jul 2012 00:47:02 +0100
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 <P <at> draigBrady.com>
>> 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?




This bug report was last modified 13 years and 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.