From d911f3f4372472ca0278ccad587f2792b1e3e470 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Apr 2026 09:47:36 +0200 Subject: [PATCH] testsuite: Fix up g++.dg/lto/20091022-2_0.C test [PR124828] From what I can see, this test was added for PR41791 where we didn't stream in/out the system header flags for LTO. The test isn't perfect, because even when we actually do stream those flags, whether it fails or not depends on the exact decisions of the inliner whether it decides to inline all inline/constexpr functions or not (maybe it would help to use some --params to request inlining as few functions as possible). Anyway, guess at some point we simply started to inline everything that was used and so whether the test stopped failing even if it would use -Wsystem-headers. Now, when not using installed gcc testing, we use libstdc++-v3/scripts/testsuite_flags script which uses -I options rather than -isystem, but the headers still had #pragma GCC system_header pragmas. Except that r15-3859 guarded those pragmas with a macro which isn't defined by default and needs to be defined only when we want to make sure the headers are treated as system headers. And later on the recent changes for C++20 stable string exports started seeing a constexpr (thus implicitly inline for -Winline purposes) being too large for default inlining and so the test started to fail again. The following patch fixes it by making sure the libstdc++ headers are treated as system headers, so the test tests again what it was supposed to test. 2026-04-10 Jakub Jelinek PR lto/124828 * g++.dg/lto/20091022-2_0.C (_GLIBCXX_SYSHDR): Define before including . Reviewed-by: Richard Biener --- gcc/testsuite/g++.dg/lto/20091022-2_0.C | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/testsuite/g++.dg/lto/20091022-2_0.C b/gcc/testsuite/g++.dg/lto/20091022-2_0.C index a1606bc3b627..e9f213de55dd 100644 --- a/gcc/testsuite/g++.dg/lto/20091022-2_0.C +++ b/gcc/testsuite/g++.dg/lto/20091022-2_0.C @@ -2,6 +2,7 @@ // { dg-lto-options {{-O3 -flto -Winline}} } // { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } +#define _GLIBCXX_SYSHDR #include int -- 2.47.3