From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id A95C53AC587F; Fri, 23 Apr 2021 10:50:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A95C53AC587F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Fix errors from Library Fundamentals TS headers in C++11 [PR 98319] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/vendors/redhat/heads/gcc-8-branch X-Git-Oldrev: 434d57d0504d05232496306c4f2f7c34772832a5 X-Git-Newrev: 290e38909a6cda9c43f7201b834cad5d3d303270 Message-Id: <20210423105030.A95C53AC587F@sourceware.org> Date: Fri, 23 Apr 2021 10:50:30 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 10:50:30 -0000 https://gcc.gnu.org/g:290e38909a6cda9c43f7201b834cad5d3d303270 commit 290e38909a6cda9c43f7201b834cad5d3d303270 Author: Jonathan Wakely Date: Wed Dec 16 13:37:17 2020 +0000 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/memory_resource: Add system_header pragma and only define contents for C++14 and later. * 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. (cherry picked from commit ab9bd93271061f436c10e35e261ecb73e2108ccc) Diff: --- libstdc++-v3/include/experimental/memory_resource | 8 +- libstdc++-v3/include/experimental/random | 4 +- libstdc++-v3/include/experimental/source_location | 4 +- libstdc++-v3/include/experimental/utility | 4 +- .../testsuite/experimental/feat-lib-fund.cc | 93 +++++++++------------- 5 files changed, 51 insertions(+), 62 deletions(-) diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource index 23653ee2fe8..29e53930a39 100644 --- a/libstdc++-v3/include/experimental/memory_resource +++ b/libstdc++-v3/include/experimental/memory_resource @@ -29,6 +29,10 @@ #ifndef _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE #define _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE 1 +#pragma GCC system_header + +#if __cplusplus >= 201402L + #include #include #include @@ -403,5 +407,5 @@ namespace pmr { _GLIBCXX_END_NAMESPACE_VERSION } // namespace std - -#endif +#endif // C++14 +#endif // _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE diff --git a/libstdc++-v3/include/experimental/random b/libstdc++-v3/include/experimental/random index deb7bd6b75c..a26b5f6cdce 100644 --- a/libstdc++-v3/include/experimental/random +++ b/libstdc++-v3/include/experimental/random @@ -29,6 +29,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_RANDOM #define _GLIBCXX_EXPERIMENTAL_RANDOM 1 +#if __cplusplus >= 201402L #include #include @@ -77,4 +78,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 389eb816be1..988d23e12db 100644 --- a/libstdc++-v3/include/experimental/source_location +++ b/libstdc++-v3/include/experimental/source_location @@ -29,6 +29,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_SRCLOC #define _GLIBCXX_EXPERIMENTAL_SRCLOC 1 +#if __cplusplus >= 201402L #include namespace std { @@ -83,4 +84,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 7e367196744..de3fe84a41b 100644 --- a/libstdc++-v3/include/experimental/utility +++ b/libstdc++-v3/include/experimental/utility @@ -29,6 +29,7 @@ #ifndef _GLIBCXX_EXPERIMENTAL_UTILITY #define _GLIBCXX_EXPERIMENTAL_UTILITY 1 +#if __cplusplus >= 201402L #include #include #include @@ -46,4 +47,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