From: Jonathan Wakely Date: Wed, 10 Nov 2021 11:43:46 +0000 (+0000) Subject: libstdc++: Fix test for libstdc++ not including [PR100117] X-Git-Tag: basepoints/gcc-13~3204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77963796aef8aa07993c0bc757c15848fab7432a;p=thirdparty%2Fgcc.git 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 --- 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 204975e03167..f98fa3b4fb9c 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 } }