GNU bug report logs -
#11829
Build failure with --enable-gcc-warnings
Previous Next
Full log
Message #13 received at 11829 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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.
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
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.