diff mbox

Fix Wundef warning for __STDC_VERSION__

Message ID 20140702200408.GT20796@spoyarek.pnq.redhat.com
State Committed
Headers show

Commit Message

Siddhesh Poyarekar July 2, 2014, 8:04 p.m. UTC
On Wed, Jul 02, 2014 at 12:51:02PM -0700, Roland McGrath wrote:
> > -#if !defined _Noreturn && __STDC_VERSION__ < 201112 && !__GNUC_PREREQ (4,7)
> > +#if (!defined _Noreturn && defined __STDC_VERSION__ \
> > +     && __STDC_VERSION__ < 201112 && !__GNUC_PREREQ (4,7))
> 
> I think this wants to be:
> 
> #if (!defined _Noreturn \
>      && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
>      &&  !__GNUC_PREREQ (4,7))
> 

Ugh, of course.  This is what I've queued up to check in.

Siddhesh

commit 80b58571d2c5de23049e55d87c881ea6c9423dfd
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Thu Jul 3 01:32:17 2014 +0530

    Fix Wundef warning for __STDC_VERSION__
    
    c4c4124473c187b5c4642611390897666c3d3970 added the _Noreturn macro for
    pre-C11 compilers, but it now throws a new Wundef warning during `make
    check` for __STDC_VERSION__ which gcc does not define by default.  The
    following patch fixes this in line with other uses of __STDC_VERSION__
    in the file.

Comments

Roland McGrath July 2, 2014, 8:08 p.m. UTC | #1
OK
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index 7b33604..049de91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2014-07-02  Roland McGrath  <roland@hack.frob.com>
+
+	* misc/sys/cdefs.h: Check if __STDC_VERSION__ is defined
+	before checking its value.
+
 2014-07-02  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	* intl/loadmsgcat.c (_nl_load_domain): Use __builtin_expect.
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index a5c3224..04db956 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -382,7 +382,9 @@ 
 # define __glibc_likely(cond)	(cond)
 #endif
 
-#if !defined _Noreturn && __STDC_VERSION__ < 201112 && !__GNUC_PREREQ (4,7)
+#if (!defined _Noreturn \
+     && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+     &&  !__GNUC_PREREQ (4,7))
 # if __GNUC_PREREQ (2,8)
 #  define _Noreturn __attribute__ ((__noreturn__))
 # else