bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang


From: Paul Eggert
Subject: Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang
Date: Wed, 15 May 2013 20:50:44 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 05/15/2013 04:57 AM, Eric Blake wrote:

> Does clang support push/pop of pragmas?

Yes.  Unfortunately they don't work here, even with _Pragma.

> Can it be silenced by adding a
> cast to void instead of globally turning off this normally-useful warning?

Unfortunately no.

>> +#   elif 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
>> +#    undef fwrite
>> +#    define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
> 
> Here, we were just inlining the gcc version if "ignore-value.h" (so that
> our replacement <stdio.h> doesn't have to drag in the actual
> ignore-value.h header); but the non-gcc counterpart is a cast to void,
> and clang doesn't seem to be issuing unused result warnings for other
> uses of ignore_value().

I think that's because in other places we simply do a (void) fwrite (...),
which pacifies 'clang'.  But here we can't do that, since the replacement
fwrite must return a value.  None of the obvious workarounds worked for me.

But I did think of a workaround that wasn't obvious (at least, not to me),
and installed it.  I'll follow up with a message
"[PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked"
about that.  Three other clang-related patches will follow.



reply via email to

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