]> 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 00:59:10 +0000 (20:59 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 17 Sep 2025 00:59:10 +0000 (20:59 -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/20_util/unique_ptr/lwg4148.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>
libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
libstdc++-v3/testsuite/20_util/unique_ptr/lwg4148.cc
libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc

index 17e7b21c45cbef0551552213025c25afed41912f..32af0a27b8fecdfde1342f3c7e7fbb9001482f8e 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <functional>
 
 int f();
index 5eff8e31f82a4aadf37d452a811a061093f510d3..368866a63313f004f44568e46f9db035014c9092 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-2025 Free Software Foundation, Inc.
index c70d7a60631b1e3c3d7b7873cd4f9a2b28d8a6a5..f5697e4e402117a1c79532528f8e00129d6e3584 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 
 // LWG 4148. unique_ptr::operator* should not allow dangling references
 
index e959418a1c3c75a5b717e590b0477f0321caaa7e..1e2f71e9c628d297b4b6ba1e85a8926307ad35a5 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-2025 Free Software Foundation, Inc.
 //
index 8cc3f78da9f0db6d689b3fff6be1638bbdaa60f7..30e05b0391a152a9a6826db74acd6c4cedab974f 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <future>
 
 // C++20 [futures.task.members]