From 98d302bab9a87d3f2daecf9d54d62f33ba216673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= Date: Wed, 8 Mar 2023 17:01:24 +0100 Subject: [PATCH 2/4] libstdc++: Add a test for FTM redefinitions This test detects redefinitions by compiling stdc++.h with -Wsystem-headers. Thanks Patrick Palka for the suggestion. libstdc++-v3/ChangeLog: * testsuite/17_intro/versionconflict.cc: New test. --- libstdc++-v3/include/std/version | 5 ++++- libstdc++-v3/testsuite/17_intro/versionconflict.cc | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/17_intro/versionconflict.cc diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index cdd24248c57..1069bc6c9f6 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 00000000000..6c212980ab0 --- /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 -- 2.40.0