From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 85E5D3857C75; Wed, 24 Nov 2021 11:50:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85E5D3857C75 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-9277] libstdc++: Fix test for libstdc++ not including [PR100117] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 092cc2c68a980554e239482bec4765fa64496d4b X-Git-Newrev: 176e55cc28a61b7b246bd9e16ffeaa31367a8985 Message-Id: <20211124115016.85E5D3857C75@sourceware.org> Date: Wed, 24 Nov 2021 11:50:16 +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: Wed, 24 Nov 2021 11:50:16 -0000 https://gcc.gnu.org/g:176e55cc28a61b7b246bd9e16ffeaa31367a8985 commit r11-9277-g176e55cc28a61b7b246bd9e16ffeaa31367a8985 Author: Jonathan Wakely Date: Wed Nov 10 11:43:46 2021 +0000 libstdc++: Fix test for libstdc++ not including [PR100117] The headers for the C library are not under our control, so we can't prevent them from including . Change the PR 49745 test to only include the C++ library headers, not the ones. To ensure isn't included automatically we need to use no_pch to disable PCH. libstdc++-v3/ChangeLog: PR libstdc++/100117 * testsuite/17_intro/headers/c++1998/49745.cc: Explicitly list all C++ headers instead of including (cherry picked from commit 77963796aef8aa07993c0bc757c15848fab7432a) Diff: --- .../testsuite/17_intro/headers/c++1998/49745.cc | 113 ++++++++++++++++++++- 1 file changed, 112 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc index 204975e0316..f98fa3b4fb9 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/49745.cc @@ -1,4 +1,5 @@ // { dg-do compile { target *-*-linux* *-*-gnu* } } +// { dg-add-options no_pch } // Copyright (C) 2011-2021 Free Software Foundation, Inc. // @@ -18,7 +19,117 @@ // . // libstdc++/49745 -#include +// error: 'int truncate' redeclared as different kind of symbol + +// This tests that no libstdc++ headers include . +// However, as discussed in PR libstdc++/100117 we cannot guarantee that +// no libc headers include it indirectly, so only include the C++ headers. +// That means we can't use because that includes etc. +// so we list the C++ headers explicitly here. This list is unfortunately +// doomed to get out of date as new headers are added to the library. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if __cplusplus >= 201103L +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#if __cplusplus >= 201402L +#include +#endif + +#if __cplusplus >= 201703L +#include +#include +// #include +#include +#include +#include +#include +#include +#endif + +#if __cplusplus >= 202002L +#include +#include +#include +#include +#if __cpp_impl_coroutine +# include +#endif +#if __has_include () +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#if __cplusplus > 202002L +#if __has_include() +# include +#endif +#if __has_include() +# include +#endif +#endif + int truncate = 0; // { dg-xfail-if "PR libstdc++/99995" { c++20 } }