[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] stdio: port --enable-gcc-warnings to clang
From: |
Paul Eggert |
Subject: |
[PATCH 8/8] stdio: port --enable-gcc-warnings to clang |
Date: |
Wed, 15 May 2013 00:39:18 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
* 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(-)
diff --git a/ChangeLog b/ChangeLog
index baa594e..dfb2e5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-05-15 Paul Eggert <address@hidden>
+ stdio: port --enable-gcc-warnings to clang
+ * lib/stdio.in.h (fwrite) [__clang__]: Ignore -Wunused-value entirely,
+ since the GCC workaround for fwrite does not pacify clang.
+
sig2str: port --enable-gcc-warnings to clang
* lib/sig2str.c (sig2str): Avoid warning about unused printf argument.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index c345499..115c976 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -579,13 +579,16 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
which sometimes causes an unwanted diagnostic for fwrite calls.
This affects only function declaration attributes under certain
- versions of gcc, and is not needed for C++. */
+ versions of gcc and clang, and is not needed for C++. */
# if (0 < __USE_FORTIFY_LEVEL \
&& __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
- && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
&& !defined __cplusplus)
-# 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"
+# elif 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+# undef fwrite
+# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
+# endif
# endif
# endif
_GL_CXXALIASWARN (fwrite);
--
1.7.11.7
- 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 <=
- Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Eric Blake, 2013/05/15
- Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked, Paul Eggert, 2013/05/15
- Re: [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked, Eric Blake, 2013/05/16
- [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