From owner-svn-src-all@FreeBSD.ORG Wed Sep 3 09:35:39 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EC18A884; Wed, 3 Sep 2014 09:35:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBF6D1A88; Wed, 3 Sep 2014 09:35:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s839ZcNV023060; Wed, 3 Sep 2014 09:35:38 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s839Zccf023058; Wed, 3 Sep 2014 09:35:38 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201409030935.s839Zccf023058@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 3 Sep 2014 09:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271012 - in head: include sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2014 09:35:39 -0000 Author: ed Date: Wed Sep 3 09:35:38 2014 New Revision: 271012 URL: http://svnweb.freebsd.org/changeset/base/271012 Log: Leave the C11 keywords alone when we have a recent version of GCC. As GCC also gained support for the C11 keywords over time, we can patch up to not define these anymore. This has the advantage that error messages for static assertions are printed natively and that _Alignas() will work with even a type outside of C11 mode. All C11 keywords are supported with GCC 4.7 and higher, with the exception of _Thread_local and _Generic. These are only supported as of GCC 4.9. Modified: head/include/tgmath.h head/sys/sys/cdefs.h Modified: head/include/tgmath.h ============================================================================== --- head/include/tgmath.h Wed Sep 3 09:05:37 2014 (r271011) +++ head/include/tgmath.h Wed Sep 3 09:35:38 2014 (r271012) @@ -61,7 +61,7 @@ */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - __has_extension(c_generic_selections) + __has_extension(c_generic_selections) || __GNUC_PREREQ__(4, 9) #define __tg_generic(x, cfnl, cfn, cfnf, fnl, fn, fnf) \ _Generic(x, \ long double _Complex: cfnl, \ Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Sep 3 09:05:37 2014 (r271011) +++ head/sys/sys/cdefs.h Wed Sep 3 09:35:38 2014 (r271012) @@ -254,7 +254,7 @@ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L -#if !__has_extension(c_alignas) +#if !__has_extension(c_alignas) && !__GNUC_PREREQ__(4, 7) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_alignas) #define _Alignas(x) alignas(x) @@ -264,11 +264,13 @@ #endif #endif +#if !__GNUC_PREREQ__(4, 7) #if defined(__cplusplus) && __cplusplus >= 201103L #define _Alignof(x) alignof(x) #else #define _Alignof(x) __alignof(x) #endif +#endif #if !__has_extension(c_atomic) && !__has_extension(cxx_atomic) /* @@ -278,13 +280,15 @@ #define _Atomic(T) struct { T volatile __val; } #endif +#if !__GNUC_PREREQ__(4, 7) #if defined(__cplusplus) && __cplusplus >= 201103L #define _Noreturn [[noreturn]] #else #define _Noreturn __dead2 #endif +#endif -#if !__has_extension(c_static_assert) +#if !__has_extension(c_static_assert) && !__GNUC_PREREQ__(4, 7) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) @@ -297,7 +301,7 @@ #endif #endif -#if !__has_extension(c_thread_local) +#if !__has_extension(c_thread_local) && !__GNUC_PREREQ__(4, 9) /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for @@ -322,7 +326,8 @@ * distinguish multiple cases. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + __has_extension(c_generic_selections) || __GNUC_PREREQ__(4, 9) #define __generic(expr, t, yes, no) \ _Generic(expr, t: yes, default: no) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)