bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ignore-value: prefer GCC version back through 2.0


From: Eric Blake
Subject: Re: [PATCH] ignore-value: prefer GCC version back through 2.0
Date: Wed, 27 Nov 2013 21:51:26 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/27/2013 03:55 PM, Paul Eggert wrote:
> While reading ignore-value.h I found that the code didn't match
> the comments, so I took the liberty of changing both (!)
> as described below.  Please feel free to revert if I messed up.
> 

> +
> +    ignore-value: prefer GCC version back through 2.0
> +    The code didn't match the comments, so I did a bit of software
> +    archaeology.  GCC 2.0 seems to support __extension__ and
> +    __typeof__, so fix both code and comments to use 2.0.

The important point wasn't whether __extension__ and __typeof__ worked,
but...

> +/* The __attribute__((__warn_unused_result__)) feature is available in
> +   gcc versions 3.4 and newer, while __typeof__ and __extension__ have
> +   been available since 2.0 at least.  */

...whether the circumlocution is needed in the first place.  If gcc is
older than 3.4, then there are no functions that can be marked in such a
manner as to cause gcc to warn, and the simpler cast to (void) is just
fine for such a compiler.  Only when __warn_unused_result__ exists do we
NEED the extensions to silence the warning.

> +#if 2 <= __GNUC__

I'm not going to revert this unless someone complains of actual
breakage, but the old code was correct and slightly more conservative.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]