public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Make _Static_assert() work with GCC in older C++ standards.
@ 2018-07-30 8:50 Sebastian Huber
0 siblings, 0 replies; only message in thread
From: Sebastian Huber @ 2018-07-30 8:50 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=84e294dc694257d8f3e9b00a4a0651afbf76132a
commit 84e294dc694257d8f3e9b00a4a0651afbf76132a
Author: ed@FreeBSD.org <ed@FreeBSD.org>
Date: Mon Aug 28 09:35:17 2017 +0000
Make _Static_assert() work with GCC in older C++ standards.
GCC only activates C11 keywords in C mode, not C++ mode. This means
that when targeting an older C++ standard, we cannot fall back to using
_Static_assert(). In this case, do define _Static_assert() as a macro
that uses a typedef'ed array.
Discussed in: r322875 commit thread
Reported by: Mark MIllard
MFC after: 1 month
Diff:
---
newlib/libc/include/sys/cdefs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index b3f8d19..49be9e0 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -314,7 +314,7 @@
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
#define _Static_assert(x, y) static_assert(x, y)
-#elif __GNUC_PREREQ__(4,6)
+#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#elif defined(__COUNTER__)
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-30 8:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 8:50 [newlib-cygwin] Make _Static_assert() work with GCC in older C++ standards Sebastian Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).