From d78099052b6bdc164f8f6a582a9b7b574f700e28 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 23 Dec 2011 22:45:16 -0500 Subject: Support C11 __STDC_SOURCE__ and _ISOC11_SOURCE --- include/features.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/features.h b/include/features.h index c7b7972806..b02ff750d3 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 -- cgit v1.2.3 From 8fd8ff3bd8234593a694be045460e471d295a6af Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 23 Dec 2011 23:20:07 -0500 Subject: Add __USE_ISOCXX11 --- include/features.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/features.h b/include/features.h index b02ff750d3..173afc1c93 100644 --- a/include/features.h +++ b/include/features.h @@ -100,6 +100,7 @@ #undef __USE_ISOC11 #undef __USE_ISOC99 #undef __USE_ISOC95 +#undef __USE_ISOCXX11 #undef __USE_POSIX #undef __USE_POSIX2 #undef __USE_POSIX199309 @@ -206,6 +207,15 @@ # define __USE_ISOC95 1 #endif +/* This is to enable compatibility for ISO C++11. + + So far g++ does not provide a macro. Check the temporary macro for + now, too. */ +#if ((defined __cplusplus && __cplusplus >= 201103L) \ + || defined __GXX_EXPERIMENTAL_CXX0X__) +# define __USE_ISOCXX11 1 +#endif + /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \ -- cgit v1.2.3 From c0e87cc01807aee964014bb6518694e7f42b71a7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 23 Dec 2011 23:37:07 -0500 Subject: Missed half the support for __USE_ISOC11 --- include/features.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/features.h b/include/features.h index 173afc1c93..7bb27c5b08 100644 --- a/include/features.h +++ b/include/features.h @@ -194,6 +194,8 @@ /* This is to enable the ISO C11 extension. */ #if (defined _ISOC11_SOURCE \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) +# define __USE_ISOC11 1 +#endif /* This is to enable the ISO C99 extension. */ #if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ -- cgit v1.2.3