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>
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
#include <functional>
int f();
// { 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.
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
// LWG 4148. unique_ptr::operator* should not allow dangling references
// { 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.
//
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wsystem-headers" }
#include <future>
// C++20 [futures.task.members]