Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2017 11:31:11 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r324055 - stable/11/sys/sys
Message-ID:  <201709271131.v8RBVBcw009100@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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__)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709271131.v8RBVBcw009100>