Mercurial > gnulib
changeset 37241:0f5e6eb69134
ignore-value: revert previous code change
* lib/ignore-value.h (ignore_value): Use __extension__ and
__typeof__ only for GCC 3.4 and later. Reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00102.html>.
Change the comment to try to explain this better.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Thu, 28 Nov 2013 00:46:06 -0800 |
parents | 8c0f23afb519 |
children | de1adf90e59d |
files | ChangeLog lib/ignore-value.h |
diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Nov 27 21:53:19 2013 +0000 +++ b/ChangeLog Thu Nov 28 00:46:06 2013 -0800 @@ -1,3 +1,11 @@ +2013-11-28 Paul Eggert <eggert@cs.ucla.edu> + + ignore-value: revert previous code change + * lib/ignore-value.h (ignore_value): Use __extension__ and + __typeof__ only for GCC 3.4 and later. Reported by Eric Blake in + <http://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00102.html>. + Change the comment to try to explain this better. + 2013-11-27 Pádraig Brady <P@draigBrady.com> selinux-h: improve stub types and add more stub functions
--- a/lib/ignore-value.h Wed Nov 27 21:53:19 2013 +0000 +++ b/lib/ignore-value.h Thu Nov 28 00:46:06 2013 -0800 @@ -35,10 +35,12 @@ #ifndef _GL_IGNORE_VALUE_H #define _GL_IGNORE_VALUE_H -/* 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. */ -#if 2 <= __GNUC__ +/* Normally casting an expression to void discards its value, but GCC + versions 3.4 and newer have __attribute__ ((__warn_unused_result__)) + which may cause unwanted diagnostics in that case. Use __typeof__ + and __extension__ to work around the problem, if the workaround is + known to be needed. */ +#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__) # define ignore_value(x) \ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; })) #else