mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
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.
This commit is contained in:
committed by
Florian Weimer
parent
645ac9aaf8
commit
d6c064e914
@@ -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
|
||||
|
Reference in New Issue
Block a user