summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2017-09-27 11:31:11 +0000
committered <ed@FreeBSD.org>2017-09-27 11:31:11 +0000
commitb6ec5b6da17c48812919ccce1187fdbf3ecfc231 (patch)
treea0186e667d56e36ef2a9ad75cf43345c79fb22c3
parent95e0ec693530205c3ae4f03f3a134af5be6656d0 (diff)
downloadFreeBSD-src-b6ec5b6da17c48812919ccce1187fdbf3ecfc231.zip
FreeBSD-src-b6ec5b6da17c48812919ccce1187fdbf3ecfc231.tar.gz
MFC r322965:
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.
-rw-r--r--sys/sys/cdefs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 65ddf20..dabd1c2 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -294,7 +294,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__)
OpenPOWER on IntegriCloud