libstdc++: Add a test for <version> FTM redefinitions

This test detects redefinitions by compiling stdc++.h and <version>, 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.
This commit is contained in:
Arsen Arsenović 2023-03-08 17:01:24 +01:00
parent 9d63ce7c4c
commit 6f0d67b912
No known key found for this signature in database
GPG Key ID: 52C294301EA2C493
2 changed files with 11 additions and 1 deletions

View File

@ -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 <bits/c++config.h>

View File

@ -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 <bits/stdc++.h>
#include <version>