From: Jonathan Wakely Date: Wed, 16 Dec 2020 13:37:17 +0000 (+0000) Subject: libstdc++: Fix errors from Library Fundamentals TS headers in C++11 [PR 98319] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab9bd93271061f436c10e35e261ecb73e2108ccc;p=gcc.git libstdc++: Fix errors from Library Fundamentals TS headers in C++11 [PR 98319] Currently the , and headers can be included in C++98 and C++11 modes, but gives errors. With this change they can be included, but define nothing. libstdc++-v3/ChangeLog: PR libstdc++/98319 * include/experimental/random: Only define contents for C++14 and later. * include/experimental/source_location: Likewise. * include/experimental/utility: Likewise. * testsuite/experimental/feat-lib-fund.cc: Include all LFTS headers that are present. Allow test to run for all modes. --- diff --git a/libstdc++-v3/include/experimental/random b/libstdc++-v3/include/experimental/random index 2ec1a4b7e42..4165a8520c8 100644 --- a/libstdc++-v3/include/experimental/random +++ b/libstdc++-v3/include/experimental/random @@ -30,6 +30,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_RANDOM #define _GLIBCXX_EXPERIMENTAL_RANDOM 1 +#if __cplusplus >= 201402L #include #include @@ -78,4 +79,5 @@ inline namespace fundamentals_v2 { _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif +#endif // C++14 +#endif // _GLIBCXX_EXPERIMENTAL_RANDOM diff --git a/libstdc++-v3/include/experimental/source_location b/libstdc++-v3/include/experimental/source_location index 9d5b5eae5f3..b4f00f1c039 100644 --- a/libstdc++-v3/include/experimental/source_location +++ b/libstdc++-v3/include/experimental/source_location @@ -30,6 +30,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_SRCLOC #define _GLIBCXX_EXPERIMENTAL_SRCLOC 1 +#if __cplusplus >= 201402L #include namespace std { @@ -84,4 +85,5 @@ inline namespace fundamentals_v2 { _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif +#endif // C++14 +#endif // _GLIBCXX_EXPERIMENTAL_SRCLOC diff --git a/libstdc++-v3/include/experimental/utility b/libstdc++-v3/include/experimental/utility index f0c3b4fcd90..8abf55c0526 100644 --- a/libstdc++-v3/include/experimental/utility +++ b/libstdc++-v3/include/experimental/utility @@ -30,6 +30,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_UTILITY #define _GLIBCXX_EXPERIMENTAL_UTILITY 1 +#if __cplusplus >= 201402L #include #include #include @@ -47,4 +48,5 @@ inline namespace fundamentals_v2 { _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif +#endif // C++14 +#endif // _GLIBCXX_EXPERIMENTAL_UTILITY diff --git a/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc b/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc index b0e6e289009..342edc5352d 100644 --- a/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc +++ b/libstdc++-v3/testsuite/experimental/feat-lib-fund.cc @@ -1,57 +1,36 @@ -// { dg-do preprocess { target c++14 } } - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -#if !__has_include() -# error "" -#endif - -//#if !__has_include() -//# error "" -//#endif - -//#if !__has_include() -//# error "" -//#endif - -//#if !__has_include() -//# error "" -//#endif - -#if !__has_include() -# error "" -#endif - -//#if !__has_include() -//# error "" -//#endif +// { dg-do preprocess } + +// Include all the LFTS headers. This should work with any -std flag. + +#include +#include +#include +#include +#include +#include +#include +#if __has_include() // not supported as of GCC 11 +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include