]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Explicitly pass -Wsystem-headers in tests that need it
authorPatrick Palka <ppalka@redhat.com>
Wed, 17 Sep 2025 01:00:50 +0000 (21:00 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 1 Oct 2025 14:09:01 +0000 (10:09 -0400)
When running libstdc++ tests using an installed gcc (as opposed to an
in-tree gcc), we naturally use system stdlib headers instead of the
in-tree headers.  But warnings from within system headers are suppressed
by default, so tests that check for such warnings spuriously fail in such
a setup.  This patch makes us compile such tests with -Wsystem-headers so
that they consistently pass.

libstdc++-v3/ChangeLog:

* testsuite/20_util/bind/dangling_ref.cc: Compile with
-Wsystem-headers.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
Likewise.
* testsuite/30_threads/packaged_task/cons/dangling_ref.cc:
Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit e690b97761e18daccb4fff0151c97c1d0115b55f)

libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc

index 70393e4392f8b5bd9c6b413defa347dfcfb41c26..eefaccd4badb27d8a7e9f7d852bacee6bd34e804 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <functional>
 
 int f();
index 33c1f59bb77b59b5c4085da844c742be5598f50a..ced900bd4727ea968e359963c30cc432a9a095ce 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-do compile { target c++11 } }
 // { dg-require-cstdint "" }
-
+// { dg-additional-options "-Wsystem-headers" }
 // 2008-07-03 Chris Fairles <chris.fairles@gmail.com>
 
 // Copyright (C) 2008-2024 Free Software Foundation, Inc.
index cef43ec26f31caaec36e1177fbae76e62334e6ed..255912e85c4c28008957a30b0c2b797de322344e 100644 (file)
@@ -1,6 +1,7 @@
 // { dg-do run { target { c++11_only || c++14_only } } }
 // { dg-require-atomic-builtins "" }
 // { dg-require-effective-target hosted }
+// { dg-additional-options "-Wsystem-headers" }
 
 // Copyright (C) 2012-2024 Free Software Foundation, Inc.
 //
index 9b3434a0bf6fa1f80ab8c58227e7e01e9c878cb4..efe72eb99f529c0df00de506514be28ad84e5870 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <future>
 
 // C++20 [futures.task.members]