https://gcc.gnu.org/g:9c3777e9619ad3e776870843d248b7fc4d8c80ed

commit r14-12048-g9c3777e9619ad3e776870843d248b7fc4d8c80ed
Author: Patrick Palka <[email protected]>
Date:   Tue Sep 16 21:00:50 2025 -0400

    libstdc++: Explicitly pass -Wsystem-headers in tests that need it
    
    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 <[email protected]>
    (cherry picked from commit e690b97761e18daccb4fff0151c97c1d0115b55f)

Diff:
---
 libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc                     | 1 +
 libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc     | 2 +-
 .../testsuite/29_atomics/atomic/operators/pointer_partial_void.cc       | 1 +
 libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc    | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc 
b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
index 70393e4392f8..eefaccd4badb 100644
--- a/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
+++ b/libstdc++-v3/testsuite/20_util/bind/dangling_ref.cc
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <functional>
 
 int f();
diff --git 
a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc 
b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
index 33c1f59bb77b..ced900bd4727 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
@@ -1,6 +1,6 @@
 // { dg-do compile { target c++11 } }
 // { dg-require-cstdint "" }
-
+// { dg-additional-options "-Wsystem-headers" }
 // 2008-07-03 Chris Fairles <[email protected]>
 
 // Copyright (C) 2008-2024 Free Software Foundation, Inc.
diff --git 
a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc 
b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
index cef43ec26f31..255912e85c4c 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
@@ -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.
 //
diff --git 
a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc 
b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc
index 9b3434a0bf6f..efe72eb99f52 100644
--- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/dangling_ref.cc
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
 #include <future>
 
 // C++20 [futures.task.members]

Reply via email to