svn commit: r324055 - stable/11/sys/sys

Ed Schouten ed at FreeBSD.org
Wed Sep 27 11:31:12 UTC 2017


Author: ed
Date: Wed Sep 27 11:31:11 2017
New Revision: 324055
URL: https://svnweb.freebsd.org/changeset/base/324055

Log:
  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.

Modified:
  stable/11/sys/sys/cdefs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/cdefs.h
==============================================================================
--- stable/11/sys/sys/cdefs.h	Wed Sep 27 09:39:16 2017	(r324054)
+++ stable/11/sys/sys/cdefs.h	Wed Sep 27 11:31:11 2017	(r324055)
@@ -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__)


More information about the svn-src-all mailing list