This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Last <sys/cdefs.h> change


Hello,

what is the reason for the change:

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 797a671..dc77b7e 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-22  Corinna Vinschen  <vinschen@redhat.com>
+
+       * libc/include/sys/cdefs.h (_Static_assert): Accommodate gcc >= 4.6.
+
 2013-05-16  Sebastian Huber <sebastian.huber@embedded-brains.de>

        * libc/reent/reent.c (_wrapup_reent): Remove.
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index beeea32..5f0922c 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -267,7 +267,9 @@
 #define        _Alignof(x)             __alignof(x)
 #define        _Noreturn               __dead2
 #define        _Thread_local           __thread
-#ifdef __COUNTER__
+#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus)
+/*  Do nothing: _Static_assert() works as per C11 */
+#elif defined(__COUNTER__)
 #define        _Static_assert(x, y)    __Static_assert(x, __COUNTER__)
 #define        __Static_assert(x, y)   ___Static_assert(x, y)
 #define        ___Static_assert(x, y)  typedef char __assert_ ## y[(x) ? 1 : -1]

There is already a test for C11 some lines above:

#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
/* Do nothing.  They are language keywords. */
#else
/* Not supported.  Implement them using our versions. */

If you want C11 in GCC, you have to specify -std=c11 or -std=gnu11.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]