From d78099052b6bdc164f8f6a582a9b7b574f700e28 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 23 Dec 2011 22:45:16 -0500 Subject: [PATCH] Support C11 __STDC_SOURCE__ and _ISOC11_SOURCE --- ChangeLog | 3 +++ include/features.h | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 737c4ba..ae443ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,9 @@ 2011-12-23 Ulrich Drepper + * include/features.h: Handle __STDC_VERSION__ >= 201112 and + _ISOC11_SOURCE. + * version.h (RELEASE): Bump for 2.15 release. * include/features.h (__GLIBC_MINOR__): Bump to 15. diff --git a/include/features.h b/include/features.h index c7b7972..b02ff75 100644 --- a/include/features.h +++ b/include/features.h @@ -25,6 +25,7 @@ __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. + _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993; @@ -57,6 +58,7 @@ These are defined by this file and are used by the header files to decide what to declare or define: + __USE_ISOC11 Define ISO C11 things. __USE_ISOC99 Define ISO C99 things. __USE_ISOC95 Define ISO C90 AMD1 (C95) things. __USE_POSIX Define IEEE Std 1003.1 things. @@ -95,6 +97,7 @@ /* Undefine everything, so we get a clean slate. */ +#undef __USE_ISOC11 #undef __USE_ISOC99 #undef __USE_ISOC95 #undef __USE_POSIX @@ -158,6 +161,8 @@ # define _ISOC95_SOURCE 1 # undef _ISOC99_SOURCE # define _ISOC99_SOURCE 1 +# undef _ISOC11_SOURCE +# define _ISOC11_SOURCE 1 # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE @@ -185,17 +190,18 @@ # define _SVID_SOURCE 1 #endif -/* This is to enable the ISO C99 extension. Also recognize the old macro - which was used prior to the standard acceptance. This macro will - eventually go away and the features enabled by default once the ISO C99 - standard is widely adopted. */ -#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ +/* This is to enable the ISO C11 extension. */ +#if (defined _ISOC11_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) + +/* This is to enable the ISO C99 extension. */ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) # define __USE_ISOC99 1 #endif /* This is to enable the ISO C90 Amendment 1:1995 extension. */ -#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) # define __USE_ISOC95 1 #endif -- 2.7.4