diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-10-09 14:58:34 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-10-09 16:18:11 +0200 |
commit | d6c064e914cba3277d852c9fa27db53f0059ff8c (patch) | |
tree | e8ce891a1960979738c5a262475b7487b5881883 /include/features.h | |
parent | 645ac9aaf89e3311949828546df6334322f48933 (diff) | |
download | glibc-d6c064e914cba3277d852c9fa27db53f0059ff8c.tar.gz glibc-d6c064e914cba3277d852c9fa27db53f0059ff8c.tar.xz glibc-d6c064e914cba3277d852c9fa27db53f0059ff8c.zip |
Ensure C99 and C11 interfaces are available for C++ [BZ #21326]
This patch ensures that the C99 and C11 features required by C++ are defined according to the value of the __cplusplus macro, and not just because G++ always defines _GNU_SOURCE. This will allow G++ to stop defining _GNU_SOURCE some day, without causing the C99 and C11 interfaces to disappear for C++ programs. [BZ #21326] * include/features.h [__cplusplus >= 201103] (__USE_ISOC99): Define. [__cplusplus >= 201703] (__USE_ISOCXX17, __USE_ISOC11): Define. * math/Makefile (test-math-cxx11): New test. * math/test-math-cxx11.cc: New file.
Diffstat (limited to 'include/features.h')
-rw-r--r-- | include/features.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/features.h b/include/features.h index c063b33b49..22735ec117 100644 --- a/include/features.h +++ b/include/features.h @@ -76,6 +76,7 @@ __USE_ISOC11 Define ISO C11 things. __USE_ISOC99 Define ISO C99 things. __USE_ISOC95 Define ISO C90 AMD1 (C95) things. + __USE_ISOCXX11 Define ISO C++11 things. __USE_POSIX Define IEEE Std 1003.1 things. __USE_POSIX2 Define IEEE Std 1003.2 things. __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. @@ -238,13 +239,17 @@ # define __USE_ISOC95 1 #endif +#ifdef __cplusplus +/* This is to enable compatibility for ISO C++17. */ +# if __cplusplus >= 201703L +# define __USE_ISOC11 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 + Check the temporary macro for now, too. */ +# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ +# define __USE_ISOCXX11 1 +# define __USE_ISOC99 1 +# endif #endif /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE |