From: Arsen Arsenović Date: Wed, 8 Mar 2023 16:01:24 +0000 (+0100) Subject: libstdc++: Add a test for FTM redefinitions X-Git-Tag: basepoints/gcc-14~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f0d67b912900009bff5018bd58e17ea1db1de69;p=thirdparty%2Fgcc.git libstdc++: Add a test for FTM redefinitions This test detects redefinitions by compiling stdc++.h and , by disabling the system_header pragma on the latter, to allow warnings in it. Thanks Patrick Palka for the suggestion. libstdc++-v3/ChangeLog: * testsuite/17_intro/versionconflict.cc: New test. * include/std/version: Allow disabling the system_header pragma via _GLIBCXX_TESTING_SYSHDR. --- diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index cdd24248c57c..1069bc6c9f6f 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -30,7 +30,10 @@ #ifndef _GLIBCXX_VERSION_INCLUDED #define _GLIBCXX_VERSION_INCLUDED -#pragma GCC system_header +// To facilitate testsuite/17_intro/versionconflict.cc +#ifndef _GLIBCXX_TESTING_SYSHDR +# pragma GCC system_header +#endif #include diff --git a/libstdc++-v3/testsuite/17_intro/versionconflict.cc b/libstdc++-v3/testsuite/17_intro/versionconflict.cc new file mode 100644 index 000000000000..6c212980ab06 --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/versionconflict.cc @@ -0,0 +1,7 @@ +// { dg-do preprocess } +// { dg-additional-options "-Werror" } + +// Test for redefinitions of FTMs using bits/stdc++.h. +#define _GLIBCXX_TESTING_SYSHDR +#include +#include