[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang
From: |
Eric Blake |
Subject: |
Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang |
Date: |
Wed, 15 May 2013 05:57:44 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 05/15/2013 01:39 AM, Paul Eggert wrote:
> * lib/stdio.in.h (fwrite) [__clang__]: Ignore -Wunused-value entirely,
> since the GCC workaround for fwrite does not pacify clang.
> ---
> ChangeLog | 4 ++++
> lib/stdio.in.h | 11 +++++++----
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> -# undef fwrite
> -# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
> +# ifdef __clang__
> +# pragma clang diagnostic ignored "-Wunused-value"
Does clang support push/pop of pragmas? Can it be silenced by adding a
cast to void instead of globally turning off this normally-useful warning?
> +# 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().
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [libvirt] [PATCH 4/6] Correctly detect warning flags with clang, Eric Blake, 2013/05/13
- Re: [libvirt] [PATCH 4/6] Correctly detect warning flags with clang, Paul Eggert, 2013/05/15
- [PATCH 2/8] inttostr: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 3/8] malloca: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 4/8] mbsstr: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 5/8] memchr2: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 6/8] obstack: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 7/8] sig2str: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 2/4] thread: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 3/4] getaddrinfo-tests: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 4/4] spawn-tests, sys_socket-tests, sys_wait-tests: port to clang, Paul Eggert, 2013/05/15