On 09/09/2014 12:09 AM, Dylan Cali wrote:
> On Mon, Sep 8, 2014 at 10:04 AM, Dylan Cali <calid1...@gmail.com> wrote:
>> On Sep 8, 2014 9:27 AM, "Eric Blake" <ebl...@redhat.com> wrote:
>>> Does this work for all supported versions of gcc? Or do you need to make
>>> it conditional on new enough gcc (it's okay if warnings have to be
>>> disabled to compile with older gcc, but not okay if the way to disable
>>> warnings for newer gcc causes compilation failure in older gcc).
>>
>> Yep you're right, looking at some other code of mine I have a conditional
>> checking for gcc > 3.7 before doing the push/pop, so it looks like that is
>> the min version for this pragma.  So wrap the pragma in a conditional, and
>> add a conditional in the Makefile turning off warnings altogether for gcc <=
>> 3.7?
> 
> Ok cool, it looks like this is mostly already implemented.  First, I
> was wrong about the version of gcc that supports these pragmas, it's
> 4.6 [1].  And gnulib already uses the diagnostic pragmas elsewhere, so
> I mimicked the conditional format used in other files.  Finally, the
> makefile conditional is already done in the coreutils configure.ac
> [2].
> 
> I've attached a patch with the updates, let me know if you see any
> further issues.
> 
> Thanks,
> Dylan
> 
> [1] https://gcc.gnu.org/ml/gcc-help/2011-01/msg00113.html
> [2] https://github.com/coreutils/coreutils/blob/master/configure.ac#L97

I don't think we need to worry about the pragma as it was a valid warning in 
this case.
To tell the compiler we want to discard the result in this context
we can use ignore_value() or the more appropriate (void) cast in this case.

Also it's best to leave the prototype in the tests.

I've adjusted and pushed your patch accordingly at:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=5549ef8

thanks!
Pádraig.

p.s. It's marked trivial for licensing reasons.

Reply via email to