diff mbox series

[RFC] libstdc++: add #pragma diagnostic

Message ID 20240912205107.4021799-1-jason@redhat.com
State New
Headers show
Series [RFC] libstdc++: add #pragma diagnostic | expand

Commit Message

Jason Merrill Sept. 12, 2024, 8:49 p.m. UTC
Tested x86_64-pc-linux-gnu.  Thoughts about the remaining warnings discussed
below?  Any other comments?

-- 8< --

The use of #pragma GCC system_header in libstdc++ has led to bugs going
undetected for a while due to the silencing of compiler warnings that would
have revealed them promptly, and also interferes with warnings about
problematic template instantiations induced by user code.

But removing it, or even compiling with -Wsystem-header, is also problematic
due to warnings about deliberate uses of extensions.

So this patch adds #pragma GCC diagnostic as needed to suppress these
warnings.

The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI
19, to avoid lots of warnings that we now mangle concept requirements, which
are in any case still experimental.

It also enables -Wsystem-headers while building the library, so we see any
warnings not silenced by these #pragmas.  After this patch, the remaining
warnings I see are:

ios_base_init.h:12: warning about reserved init_priority
I'll add a warning flag to silence this.

exception_ptr.h:155: warning about useless attribute((const)) on void fn.
Should we remove the attribute?

cxx11-ios_failure.cc:98: warning about overriding the two-parameter
__do_upcast that isn't overridden in __si_class_type_info, rather than the
three-parameter form that is overridden in __si_class_type_info.
I suppose this must be working, and changing the signature would be an ABI
break, so maybe we just want to silence the warning?
It's also unclear that -Woverloaded-virtuals=1 is supposed to warn when the
function is in fact an override; it warns in this case because it's
overriding a function that its direct base didn't also override.

I have a follow-up patch to #ifdef out all the #pragma system_header, but
want that to be considered separately.

libstdc++-v3/ChangeLog:

	* include/bits/algorithmfwd.h:
	* include/bits/allocator.h:
	* include/bits/codecvt.h:
	* include/bits/concept_check.h:
	* include/bits/cpp_type_traits.h:
	* include/bits/hashtable.h:
	* include/bits/iterator_concepts.h:
	* include/bits/ostream_insert.h:
	* include/bits/ranges_base.h:
	* include/bits/regex_automaton.h:
	* include/bits/std_abs.h:
	* include/bits/stl_algo.h:
	* include/c_compatibility/fenv.h:
	* include/c_compatibility/inttypes.h:
	* include/c_compatibility/stdint.h:
	* include/ext/concurrence.h:
	* include/ext/type_traits.h:
	* testsuite/ext/type_traits/add_unsigned_floating_neg.cc:
	* testsuite/ext/type_traits/add_unsigned_integer_neg.cc:
	* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc:
	* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc:
	* include/bits/basic_ios.tcc:
	* include/bits/basic_string.tcc:
	* include/bits/fstream.tcc:
	* include/bits/istream.tcc:
	* include/bits/locale_classes.tcc:
	* include/bits/locale_facets.tcc:
	* include/bits/ostream.tcc:
	* include/bits/regex_compiler.tcc:
	* include/bits/sstream.tcc:
	* include/bits/streambuf.tcc:
	* configure: Regenerate.
	* include/bits/c++config:
	* include/c/cassert:
	* include/c/cctype:
	* include/c/cerrno:
	* include/c/cfloat:
	* include/c/climits:
	* include/c/clocale:
	* include/c/cmath:
	* include/c/csetjmp:
	* include/c/csignal:
	* include/c/cstdarg:
	* include/c/cstddef:
	* include/c/cstdio:
	* include/c/cstdlib:
	* include/c/cstring:
	* include/c/ctime:
	* include/c/cwchar:
	* include/c/cwctype:
	* include/c_global/climits:
	* include/c_global/cmath:
	* include/c_global/cstddef:
	* include/c_global/cstdlib:
	* include/decimal/decimal:
	* include/ext/rope:
	* include/std/any:
	* include/std/charconv:
	* include/std/complex:
	* include/std/coroutine:
	* include/std/format:
	* include/std/iomanip:
	* include/std/limits:
	* include/std/numbers:
	* include/tr1/functional:
	* include/tr1/tuple:
	* include/tr1/type_traits:
	* libsupc++/compare:
	* libsupc++/new: Add #pragma GCC diagnostic to suppress
	undesired warnings.
	* acinclude.m4: Change -Wabi version from 2 to 19.
---
 libstdc++-v3/include/bits/algorithmfwd.h                 | 5 +++++
 libstdc++-v3/include/bits/allocator.h                    | 4 ++++
 libstdc++-v3/include/bits/codecvt.h                      | 4 ++++
 libstdc++-v3/include/bits/concept_check.h                | 4 ++++
 libstdc++-v3/include/bits/cpp_type_traits.h              | 5 +++++
 libstdc++-v3/include/bits/hashtable.h                    | 5 +++++
 libstdc++-v3/include/bits/iterator_concepts.h            | 4 ++++
 libstdc++-v3/include/bits/ostream_insert.h               | 4 ++++
 libstdc++-v3/include/bits/ranges_base.h                  | 4 ++++
 libstdc++-v3/include/bits/regex_automaton.h              | 5 +++++
 libstdc++-v3/include/bits/std_abs.h                      | 5 +++++
 libstdc++-v3/include/bits/stl_algo.h                     | 5 +++++
 libstdc++-v3/include/c_compatibility/fenv.h              | 5 +++++
 libstdc++-v3/include/c_compatibility/inttypes.h          | 5 +++++
 libstdc++-v3/include/c_compatibility/stdint.h            | 5 +++++
 libstdc++-v3/include/ext/concurrence.h                   | 5 +++++
 libstdc++-v3/include/ext/type_traits.h                   | 5 +++++
 .../ext/type_traits/add_unsigned_floating_neg.cc         | 2 +-
 .../ext/type_traits/add_unsigned_integer_neg.cc          | 2 +-
 .../ext/type_traits/remove_unsigned_floating_neg.cc      | 2 +-
 .../ext/type_traits/remove_unsigned_integer_neg.cc       | 2 +-
 libstdc++-v3/acinclude.m4                                | 2 +-
 libstdc++-v3/include/bits/basic_ios.tcc                  | 4 ++++
 libstdc++-v3/include/bits/basic_string.tcc               | 4 ++++
 libstdc++-v3/include/bits/fstream.tcc                    | 4 ++++
 libstdc++-v3/include/bits/istream.tcc                    | 4 ++++
 libstdc++-v3/include/bits/locale_classes.tcc             | 5 +++++
 libstdc++-v3/include/bits/locale_facets.tcc              | 4 ++++
 libstdc++-v3/include/bits/ostream.tcc                    | 4 ++++
 libstdc++-v3/include/bits/regex_compiler.tcc             | 7 ++++++-
 libstdc++-v3/include/bits/sstream.tcc                    | 4 ++++
 libstdc++-v3/include/bits/streambuf.tcc                  | 4 ++++
 libstdc++-v3/configure                                   | 2 +-
 libstdc++-v3/include/bits/c++config                      | 7 +++++++
 libstdc++-v3/include/c/cassert                           | 5 +++++
 libstdc++-v3/include/c/cctype                            | 5 +++++
 libstdc++-v3/include/c/cerrno                            | 5 +++++
 libstdc++-v3/include/c/cfloat                            | 5 +++++
 libstdc++-v3/include/c/climits                           | 5 +++++
 libstdc++-v3/include/c/clocale                           | 5 +++++
 libstdc++-v3/include/c/cmath                             | 5 +++++
 libstdc++-v3/include/c/csetjmp                           | 5 +++++
 libstdc++-v3/include/c/csignal                           | 5 +++++
 libstdc++-v3/include/c/cstdarg                           | 5 +++++
 libstdc++-v3/include/c/cstddef                           | 5 +++++
 libstdc++-v3/include/c/cstdio                            | 5 +++++
 libstdc++-v3/include/c/cstdlib                           | 5 +++++
 libstdc++-v3/include/c/cstring                           | 5 +++++
 libstdc++-v3/include/c/ctime                             | 5 +++++
 libstdc++-v3/include/c/cwchar                            | 5 +++++
 libstdc++-v3/include/c/cwctype                           | 5 +++++
 libstdc++-v3/include/c_global/climits                    | 5 +++++
 libstdc++-v3/include/c_global/cmath                      | 5 +++++
 libstdc++-v3/include/c_global/cstddef                    | 5 +++++
 libstdc++-v3/include/c_global/cstdlib                    | 4 ++++
 libstdc++-v3/include/decimal/decimal                     | 4 ++++
 libstdc++-v3/include/ext/rope                            | 6 ++++++
 libstdc++-v3/include/std/any                             | 5 +++++
 libstdc++-v3/include/std/charconv                        | 4 ++++
 libstdc++-v3/include/std/complex                         | 4 ++++
 libstdc++-v3/include/std/coroutine                       | 4 ++++
 libstdc++-v3/include/std/format                          | 9 +++++++++
 libstdc++-v3/include/std/iomanip                         | 4 ++++
 libstdc++-v3/include/std/limits                          | 6 ++++++
 libstdc++-v3/include/std/numbers                         | 5 +++++
 libstdc++-v3/include/tr1/functional                      | 5 +++++
 libstdc++-v3/include/tr1/tuple                           | 4 ++++
 libstdc++-v3/include/tr1/type_traits                     | 4 ++++
 libstdc++-v3/libsupc++/compare                           | 6 ++++++
 libstdc++-v3/libsupc++/new                               | 4 ++++
 70 files changed, 313 insertions(+), 7 deletions(-)


base-commit: c5009eb887910271ea35a857aa68941c7227b9c7

Comments

Jonathan Wakely Sept. 18, 2024, 2:37 p.m. UTC | #1
On Thu, 12 Sept 2024 at 21:51, Jason Merrill <jason@redhat.com> wrote:
>
> Tested x86_64-pc-linux-gnu.  Thoughts about the remaining warnings discussed
> below?  Any other comments?
>
> -- 8< --
>
> The use of #pragma GCC system_header in libstdc++ has led to bugs going
> undetected for a while due to the silencing of compiler warnings that would
> have revealed them promptly, and also interferes with warnings about
> problematic template instantiations induced by user code.
>
> But removing it, or even compiling with -Wsystem-header, is also problematic
> due to warnings about deliberate uses of extensions.
>
> So this patch adds #pragma GCC diagnostic as needed to suppress these
> warnings.
>
> The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI
> 19, to avoid lots of warnings that we now mangle concept requirements, which
> are in any case still experimental.
>
> It also enables -Wsystem-headers while building the library, so we see any
> warnings not silenced by these #pragmas.  After this patch, the remaining
> warnings I see are:
>
> ios_base_init.h:12: warning about reserved init_priority
> I'll add a warning flag to silence this.
>
> exception_ptr.h:155: warning about useless attribute((const)) on void fn.
> Should we remove the attribute?

Yes, I'll do that.

> cxx11-ios_failure.cc:98: warning about overriding the two-parameter
> __do_upcast that isn't overridden in __si_class_type_info, rather than the
> three-parameter form that is overridden in __si_class_type_info.
> I suppose this must be working, and changing the signature would be an ABI
> break, so maybe we just want to silence the warning?

OK, I'll add:

--- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
+++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
@@ -94,6 +94,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
  {
    ~__iosfail_type_info();

+    using __si_class_type_info::__do_upcast;
+
    bool
    __do_upcast (const __class_type_info *dst_type,
                void **obj_ptr) const override;


> It's also unclear that -Woverloaded-virtuals=1 is supposed to warn when the
> function is in fact an override; it warns in this case because it's
> overriding a function that its direct base didn't also override.

Hmm ... the other virtual function is still hidden and only accessible
via the base class. Maybe it's helpful to warn.

> I have a follow-up patch to #ifdef out all the #pragma system_header, but
> want that to be considered separately.

Sounds good - this one looks fine, thanks.
diff mbox series

Patch

diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index 34bf9921f43..7f1f15970ab 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -39,6 +39,9 @@ 
 #include <initializer_list>
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -962,6 +965,8 @@  _GLIBCXX_END_NAMESPACE_ALGO
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #ifdef _GLIBCXX_PARALLEL
 # include <parallel/algorithmfwd.h>
 #endif
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 9e75b37fce7..ebb487a3ffe 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -49,6 +49,9 @@ 
 #include <type_traits>
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -292,4 +295,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h
index 41a1d30b11d..c51cc7d220d 100644
--- a/libstdc++-v3/include/bits/codecvt.h
+++ b/libstdc++-v3/include/bits/codecvt.h
@@ -41,6 +41,9 @@ 
 #include <bits/c++config.h>
 #include <bits/locale_classes.h> // locale::facet
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -840,4 +843,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif // _CODECVT_H
diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h
index 65f662b70bf..6479f2fa919 100644
--- a/libstdc++-v3/include/bits/concept_check.h
+++ b/libstdc++-v3/include/bits/concept_check.h
@@ -34,6 +34,9 @@ 
 
 #include <bits/c++config.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
+
 // All places in libstdc++-v3 where these are used, or /might/ be used, or
 // don't need to be used, or perhaps /should/ be used, are commented with
 // "concept requirements" (and maybe some more text).  So grep like crazy
@@ -78,4 +81,5 @@ 
 
 #endif // enable/disable
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_CONCEPT_CHECK
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index ff74c557245..e3a80e06346 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -40,6 +40,9 @@ 
 # include <type_traits> // is_same_v, is_integral_v
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlong-long"
+
 //
 // This file provides some compile-time information about various types.
 // These representations were designed, on purpose, to be constant-expressions
@@ -582,4 +585,6 @@  _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 } // extern "C++"
 
+#pragma GCC diagnostic pop
+
 #endif //_CPP_TYPE_TRAITS_H
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index 361da2b3b4d..b02bddf5635 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -40,6 +40,9 @@ 
 # include <bits/node_handle.h>
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -2758,4 +2761,6 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #endif // _HASHTABLE_H
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index 642c709fee0..4ac6e6bfbe7 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -37,6 +37,9 @@ 
 #include <bits/ptr_traits.h>	// to_address
 #include <bits/ranges_cmp.h>	// identity, ranges::less
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1044,5 +1047,6 @@  namespace ranges
 #endif // C++20 library concepts
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
+#pragma GCC diagnostic pop
 #endif // C++20
 #endif // _ITERATOR_CONCEPTS_H
diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h
index e6857615790..d61b4b14f97 100644
--- a/libstdc++-v3/include/bits/ostream_insert.h
+++ b/libstdc++-v3/include/bits/ostream_insert.h
@@ -36,6 +36,9 @@ 
 #include <bits/cxxabi_forced.h>
 #include <bits/exception_defines.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -131,4 +134,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif /* _OSTREAM_INSERT_H */
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h
index 63eb552b48b..0c6a4e83bb2 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -39,6 +39,9 @@ 
 #include <bits/max_size_type.h>
 #include <bits/version.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+
 #ifdef __cpp_lib_concepts
 namespace std _GLIBCXX_VISIBILITY(default)
 {
@@ -1073,5 +1076,6 @@  namespace ranges
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // library concepts
+#pragma GCC diagnostic pop
 #endif // C++20
 #endif // _GLIBCXX_RANGES_BASE_H
diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h
index 574ec90dc3a..03179a0e687 100644
--- a/libstdc++-v3/include/bits/regex_automaton.h
+++ b/libstdc++-v3/include/bits/regex_automaton.h
@@ -33,6 +33,9 @@ 
 #define _GLIBCXX_REGEX_STATE_LIMIT 100000
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // anon struct
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -397,4 +400,6 @@  namespace __detail
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #include <bits/regex_automaton.tcc>
diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h
index 48d44160bab..1e9ed83a0b2 100644
--- a/libstdc++-v3/include/bits/std_abs.h
+++ b/libstdc++-v3/include/bits/std_abs.h
@@ -43,6 +43,9 @@ 
 
 #undef abs
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlong-long"
+
 extern "C++"
 {
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -151,4 +154,6 @@  _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 } // extern "C++"
 
+#pragma GCC diagnostic pop
+
 #endif // _GLIBCXX_BITS_STD_ABS_H
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index 778a37ac46f..a1ef665506d 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -72,6 +72,9 @@ 
 # endif
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // inline namespace
+
 // See concept_check.h for the __glibcxx_*_requires macros.
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -5901,4 +5904,6 @@  _GLIBCXX_END_NAMESPACE_ALGO
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #endif /* _STL_ALGO_H */
diff --git a/libstdc++-v3/include/c_compatibility/fenv.h b/libstdc++-v3/include/c_compatibility/fenv.h
index 6800814bca5..a587e7308af 100644
--- a/libstdc++-v3/include/c_compatibility/fenv.h
+++ b/libstdc++-v3/include/c_compatibility/fenv.h
@@ -31,11 +31,16 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 #if _GLIBCXX_HAVE_FENV_H
 # include_next <fenv.h>
 #endif
 
+#pragma GCC diagnostic pop
+
 #if __cplusplus >= 201103L
 
 #if _GLIBCXX_USE_C99_FENV
diff --git a/libstdc++-v3/include/c_compatibility/inttypes.h b/libstdc++-v3/include/c_compatibility/inttypes.h
index bc63119097c..5a428ce0bd7 100644
--- a/libstdc++-v3/include/c_compatibility/inttypes.h
+++ b/libstdc++-v3/include/c_compatibility/inttypes.h
@@ -31,6 +31,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 
 #if __cplusplus >= 201103L
@@ -88,4 +91,6 @@  namespace std
 
 #endif // C++11
 
+#pragma GCC diagnostic pop
+
 #endif // _GLIBCXX_INTTYPES_H
diff --git a/libstdc++-v3/include/c_compatibility/stdint.h b/libstdc++-v3/include/c_compatibility/stdint.h
index 0b6a8c16627..2d892e7ceb2 100644
--- a/libstdc++-v3/include/c_compatibility/stdint.h
+++ b/libstdc++-v3/include/c_compatibility/stdint.h
@@ -31,6 +31,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 
 #if __cplusplus >= 201103L
@@ -107,4 +110,6 @@  namespace std
 
 #endif // C++11
 
+#pragma GCC diagnostic pop
+
 #endif // _GLIBCXX_STDINT_H
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h
index 7629c1b1129..8188c1366b0 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -37,6 +37,9 @@ 
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -312,4 +315,6 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/ext/type_traits.h b/libstdc++-v3/include/ext/type_traits.h
index 75d7edf85b8..165e1b43da0 100644
--- a/libstdc++-v3/include/ext/type_traits.h
+++ b/libstdc++-v3/include/ext/type_traits.h
@@ -34,6 +34,9 @@ 
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlong-long"
+
 extern "C++" {
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
@@ -270,4 +273,6 @@  _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 } // extern "C++"
 
+#pragma GCC diagnostic pop
+
 #endif 
diff --git a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
index 261fe84b0ae..458748af28a 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_floating_neg.cc
@@ -35,4 +35,4 @@  int main()
 }
 
 // { dg-error "required from" "" { target *-*-* } 28 }
-// { dg-error "no type" "" { target *-*-* } 71 } 
+// { dg-error "no type" "" { target *-*-* } 74 }
diff --git a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
index f592478dd97..c1dde44e118 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/add_unsigned_integer_neg.cc
@@ -36,5 +36,5 @@  int main()
 }
 
 // { dg-error "invalid use of incomplete" "" { target *-*-* } 28 } 
-// { dg-error "declaration of" "" { target *-*-* } 100 }
 // { dg-error "declaration of" "" { target *-*-* } 103 }
+// { dg-error "declaration of" "" { target *-*-* } 106 }
diff --git a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
index 42078e556f6..5f77c1a652a 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_floating_neg.cc
@@ -35,4 +35,4 @@  int main()
 }
 
 // { dg-error "required from" "" { target *-*-* } 28 }
-// { dg-error "no type" "" { target *-*-* } 114 }
+// { dg-error "no type" "" { target *-*-* } 117 }
diff --git a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
index f017aecdb8a..7f5a304c526 100644
--- a/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
+++ b/libstdc++-v3/testsuite/ext/type_traits/remove_unsigned_integer_neg.cc
@@ -36,5 +36,5 @@  int main()
 }
 
 // { dg-error "invalid use of incomplete" "" { target *-*-* } 28 } 
-// { dg-error "declaration of" "" { target *-*-* } 143 }
 // { dg-error "declaration of" "" { target *-*-* } 146 }
+// { dg-error "declaration of" "" { target *-*-* } 149 }
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e4ed583b3ae..768c2991ec2 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -707,7 +707,7 @@  AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
-  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2"
+  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19 -Wsystem-headers"
   AC_SUBST(WARN_FLAGS)
 ])
 
diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc
index 0197bdf8f67..1519603f6b5 100644
--- a/libstdc++-v3/include/bits/basic_ios.tcc
+++ b/libstdc++-v3/include/bits/basic_ios.tcc
@@ -32,6 +32,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -181,4 +184,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index e458c1880b2..8a764855698 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -41,6 +41,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 #include <bits/cxxabi_forced.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -1031,4 +1034,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index a5accecd846..7b246ad59d2 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -36,6 +36,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 #include <bits/cxxabi_forced.h>
 #include <bits/move.h>   // for swap
 #include <cerrno>
@@ -1094,4 +1097,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 16423bfbfcb..23a7c849777 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -36,6 +36,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 #include <bits/cxxabi_forced.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -1166,4 +1169,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index d5ef1911057..4dedfd76af6 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -36,6 +36,10 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -380,4 +384,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index cde81bffc08..4e9bf6fb8f9 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -32,6 +32,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1433,4 +1436,5 @@  _GLIBCXX_END_NAMESPACE_LDBL
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 972de79ea70..7aeb23ad38d 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -36,6 +36,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 #include <bits/cxxabi_forced.h>
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -390,4 +393,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 3c6cb6649df..9c5a46a47cd 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -55,6 +55,9 @@ 
 // All dummy nodes will be eliminated at the end of compilation.
 */
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++20-extensions" // variadic macro with 0 args
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -621,4 +624,6 @@  namespace __detail
 } // namespace __detail
 
 _GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+} // namespace std
+
+#pragma GCC diagnostic pop
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 9acf15f399f..7eb5561b630 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -36,6 +36,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -304,4 +307,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc
index 3cfee68defc..0c28033f491 100644
--- a/libstdc++-v3/include/bits/streambuf.tcc
+++ b/libstdc++-v3/include/bits/streambuf.tcc
@@ -36,6 +36,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -166,4 +169,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
 #endif
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 005c4a29fd0..de05e63de4c 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -55720,7 +55720,7 @@  $as_echo "$gxx_include_dir" >&6; }
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
 
 
-  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2"
+  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19 -Wsystem-headers"
 
 
 
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 54d455be226..66d03cfd037 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -32,6 +32,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvariadic-macros"
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+#pragma GCC diagnostic ignored "-Wc++23-extensions" // bf16
+
 // The major release number for the GCC release the C++ library belongs to.
 #define _GLIBCXX_RELEASE
 
@@ -910,4 +915,6 @@  namespace __gnu_cxx
 #endif // __has_include
 #endif // C++17
 
+#pragma GCC diagnostic pop
+
 // End of prewritten config; the settings discovered at configure time follow.
diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert
index 5cd11fff9ec..ef6e844a72b 100644
--- a/libstdc++-v3/include/c/cassert
+++ b/libstdc++-v3/include/c/cassert
@@ -30,5 +30,10 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 #include_next <assert.h>
+
+#pragma GCC diagnostic pop
diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype
index c6f65039435..a7a59551d86 100644
--- a/libstdc++-v3/include/c/cctype
+++ b/libstdc++-v3/include/c/cctype
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <ctype.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno
index 9e47b182d25..29bf0b403aa 100644
--- a/libstdc++-v3/include/c/cerrno
+++ b/libstdc++-v3/include/c/cerrno
@@ -40,9 +40,14 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 #include_next <errno.h>
 
+#pragma GCC diagnostic pop
+
 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
 #ifndef errno
 #define errno errno
diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat
index 81d9772ed9f..1f9edada950 100644
--- a/libstdc++-v3/include/c/cfloat
+++ b/libstdc++-v3/include/c/cfloat
@@ -31,7 +31,12 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 #include_next <float.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits
index 255bed41125..846fe190707 100644
--- a/libstdc++-v3/include/c/climits
+++ b/libstdc++-v3/include/c/climits
@@ -31,7 +31,12 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 #include_next <limits.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale
index 4258df1958b..62d85ed6609 100644
--- a/libstdc++-v3/include/c/clocale
+++ b/libstdc++-v3/include/c/clocale
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <locale.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath
index 43020eee9d2..371ee59986c 100644
--- a/libstdc++-v3/include/c/cmath
+++ b/libstdc++-v3/include/c/cmath
@@ -33,8 +33,13 @@ 
 
 #include <bits/c++config.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <math.h>
 
+#pragma GCC diagnostic pop
+
 // Get rid of those macros defined in <math.h> in lieu of real functions.
 #undef abs
 #undef div
diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp
index 4a5b0334590..acf113a0c5a 100644
--- a/libstdc++-v3/include/c/csetjmp
+++ b/libstdc++-v3/include/c/csetjmp
@@ -31,8 +31,13 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <setjmp.h>
 
+#pragma GCC diagnostic pop
+
 // Get rid of those macros defined in <setjmp.h> in lieu of real functions.
 #undef longjmp
 
diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal
index 040b48368f9..c04bb6042f4 100644
--- a/libstdc++-v3/include/c/csignal
+++ b/libstdc++-v3/include/c/csignal
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <signal.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg
index 5d97e043da8..7648662680c 100644
--- a/libstdc++-v3/include/c/cstdarg
+++ b/libstdc++-v3/include/c/cstdarg
@@ -31,7 +31,12 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #undef __need___va_list
 #include_next <stdarg.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef
index 4fd889a1dff..e1435b94556 100644
--- a/libstdc++-v3/include/c/cstddef
+++ b/libstdc++-v3/include/c/cstddef
@@ -31,10 +31,15 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #define __need_size_t
 #define __need_ptrdiff_t
 #define __need_NULL
 #define __need_offsetof
 #include_next <stddef.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio
index 01293054d50..99aead4ef9c 100644
--- a/libstdc++-v3/include/c/cstdio
+++ b/libstdc++-v3/include/c/cstdio
@@ -31,8 +31,13 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <stdio.h>
 
+#pragma GCC diagnostic pop
+
 // Get rid of those macros defined in <stdio.h> in lieu of real functions.
 #undef clearerr
 #undef fclose
diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib
index f5707f8a8ce..75e6382c01b 100644
--- a/libstdc++-v3/include/c/cstdlib
+++ b/libstdc++-v3/include/c/cstdlib
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <stdlib.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring
index 0082080fcab..05d75182a7a 100644
--- a/libstdc++-v3/include/c/cstring
+++ b/libstdc++-v3/include/c/cstring
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <string.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime
index 5476ff7da39..73e2a7a0167 100644
--- a/libstdc++-v3/include/c/ctime
+++ b/libstdc++-v3/include/c/ctime
@@ -31,6 +31,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include_next <time.h>
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar
index 7a62eb74abb..921de267750 100644
--- a/libstdc++-v3/include/c/cwchar
+++ b/libstdc++-v3/include/c/cwchar
@@ -35,10 +35,15 @@ 
 #include <cstddef>
 #include <ctime>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #if _GLIBCXX_HAVE_WCHAR_H
 #include_next <wchar.h>
 #endif
 
+#pragma GCC diagnostic pop
+
 // Need to do a bit of trickery here with mbstate_t as char_traits
 // assumes it is in wchar.h, regardless of wchar_t specializations.
 #ifndef _GLIBCXX_HAVE_MBSTATE_T
diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype
index 011ceadbb1b..0d2f55d9d6d 100644
--- a/libstdc++-v3/include/c/cwctype
+++ b/libstdc++-v3/include/c/cwctype
@@ -31,10 +31,15 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
+
 #include <bits/c++config.h>
 
 #if _GLIBCXX_HAVE_WCTYPE_H
 #include_next <wctype.h>
 #endif
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits
index 7e374ef0c79..c85fc283ae6 100644
--- a/libstdc++-v3/include/c_global/climits
+++ b/libstdc++-v3/include/c_global/climits
@@ -44,6 +44,9 @@ 
 #ifndef _GLIBCXX_CLIMITS
 #define _GLIBCXX_CLIMITS 1
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wlong-long"
+
 #ifndef LLONG_MIN
 #define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
 #endif
@@ -56,4 +59,6 @@ 
 #define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
 #endif
 
+#pragma GCC diagnostic pop
+
 #endif
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index dd0174f1987..4958dfd2ff1 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -43,9 +43,14 @@ 
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
 #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
 #include_next <math.h>
 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+#pragma GCC diagnostic pop
+
 #include <bits/std_abs.h>
 
 #ifndef _GLIBCXX_CMATH
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index b25a6b3eec9..f49f56ae372 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -52,6 +52,9 @@ 
 #define __glibcxx_want_byte
 #include <bits/version.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+
 extern "C++"
 {
 #if __cplusplus >= 201103L
@@ -189,4 +192,6 @@  _GLIBCXX_END_NAMESPACE_VERSION
 #endif // __cpp_lib_byte
 } // extern "C++"
 
+#pragma GCC diagnostic pop
+
 #endif // _GLIBCXX_CSTDDEF
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 69e7a39eb44..72baff24991 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -75,9 +75,13 @@  namespace std
 
 // Need to ensure this finds the C library's <stdlib.h> not a libstdc++
 // wrapper that might already be installed later in the include search path.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // include_next
 #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
 #include_next <stdlib.h>
 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+#pragma GCC diagnostic pop
+
 #include <bits/std_abs.h>
 
 // Get rid of those macros defined in <stdlib.h> in lieu of real functions.
diff --git a/libstdc++-v3/include/decimal/decimal b/libstdc++-v3/include/decimal/decimal
index d20e012f9c5..a64ddde4756 100644
--- a/libstdc++-v3/include/decimal/decimal
+++ b/libstdc++-v3/include/decimal/decimal
@@ -33,6 +33,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // DF suffix
+
 #include <bits/c++config.h>
 
 #ifndef _GLIBCXX_USE_DECIMAL_FLOAT
@@ -491,4 +494,5 @@  _GLIBCXX_END_NAMESPACE_VERSION
 
 #include <decimal/decimal.h>
 
+#pragma GCC diagnostic pop
 #endif /* _GLIBCXX_DECIMAL */
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index b5ebb132274..19199e82806 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -66,6 +66,10 @@ 
 
 #include <ext/memory> // For uninitialized_copy_n
 
+// Ignore warnings about default member initializers.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -3009,6 +3013,8 @@  namespace tr1
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 # include <ext/ropeimpl.h>
 
 #endif
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index 9ae29aab99f..d24260eaace 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -42,6 +42,9 @@ 
 #include <type_traits>
 #include <bits/utility.h> // in_place_type_t
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // aligned_storage
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -661,5 +664,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #endif // __cpp_lib_any
 #endif // _GLIBCXX_ANY
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index 00c4f206922..de671393b88 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -31,6 +31,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+
 #include <bits/requires_hosted.h> // for error codes
 
 // As an extension we support <charconv> in C++14, but this header should not
@@ -932,4 +935,5 @@  namespace __detail
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // C++14
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_CHARCONV
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index be810b6d05d..c688d0cb728 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -38,6 +38,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
+
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
@@ -2650,4 +2653,5 @@  _GLIBCXX_END_NAMESPACE_VERSION
 #pragma clang diagnostic pop
 #endif
 
+#pragma GCC diagnostic pop
 #endif  /* _GLIBCXX_COMPLEX */
diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/std/coroutine
index ccd016b255e..30b4d33711e 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -31,6 +31,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++17-extensions"
+
 #define __glibcxx_want_coroutine
 #include <bits/version.h>
 
@@ -358,4 +361,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #endif // __cpp_lib_coroutine
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_COROUTINE
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 52243eb5479..88a42d1158a 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -63,6 +63,10 @@ 
 # include <cctype>
 #endif
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+#pragma GCC diagnostic ignored "-Wc++23-extensions" // bf16
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1674,6 +1678,10 @@  namespace __format
 
 	      do
 		{
+		  // Mangling of this lambda, and thus resize_and_overwrite
+		  // instantiated with it, was fixed in ABI 18 (G++ 13).  Since
+		  // <format> was new in G++ 13, and is experimental, that
+		  // isn't a problem.
 		  auto __overwrite = [&__to_chars, &__res] (char* __p, size_t __n)
 		  {
 		    __res = __to_chars(__p + 1, __p + __n - 1);
@@ -4734,4 +4742,5 @@  namespace __format
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif // __cpp_lib_format
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_FORMAT
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index fdf80fc8b50..9d8ecea5d65 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -35,6 +35,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 #include <bits/requires_hosted.h> // iostreams
 
 #include <bits/c++config.h>
@@ -543,4 +546,5 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
 
+#pragma GCC diagnostic pop
 #endif /* _GLIBCXX_IOMANIP */
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index 4b0698e4713..b0ab57c1ad7 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -39,6 +39,11 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // Q suffix
+#pragma GCC diagnostic ignored "-Wlong-long"
+#pragma GCC diagnostic ignored "-Wc++23-extensions"
+
 #include <bits/c++config.h>
 
 //
@@ -2229,4 +2234,5 @@  _GLIBCXX_END_NAMESPACE_VERSION
 #undef __glibcxx_digits10
 #undef __glibcxx_max_digits10
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_NUMERIC_LIMITS
diff --git a/libstdc++-v3/include/std/numbers b/libstdc++-v3/include/std/numbers
index 9836afac645..f04000f1dd9 100644
--- a/libstdc++-v3/include/std/numbers
+++ b/libstdc++-v3/include/std/numbers
@@ -38,6 +38,9 @@ 
 
 #include <type_traits>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // Q extension
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -232,5 +235,7 @@  __glibcxx_numbers (__float128, Q);
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #endif // __cpp_lib_math_constants
 #endif // _GLIBCXX_NUMBERS
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 5fc808623a7..f2cd42bed4e 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -44,6 +44,10 @@ 
 #include <ext/type_traits.h>
 #include <bits/move.h> // for std::__addressof
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvolatile" // volatile parm/return
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -2282,4 +2286,5 @@  namespace tr1
 _GLIBCXX_END_NAMESPACE_VERSION
 }
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_TR1_FUNCTIONAL
diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple
index be26d283f8c..40e2d091514 100644
--- a/libstdc++-v3/include/tr1/tuple
+++ b/libstdc++-v3/include/tr1/tuple
@@ -34,6 +34,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 #include <bits/requires_hosted.h> // TR1
 
 #include <utility>
@@ -425,4 +428,5 @@  namespace tr1
 _GLIBCXX_END_NAMESPACE_VERSION
 }
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_TR1_TUPLE
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index f5714b0032c..62b30e7d658 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -31,6 +31,9 @@ 
 
 #pragma GCC system_header
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions"
+
 #include <bits/requires_hosted.h> // TR1
 
 #include <bits/c++config.h>
@@ -684,4 +687,5 @@  namespace tr1
 _GLIBCXX_END_NAMESPACE_VERSION
 }
 
+#pragma GCC diagnostic pop
 #endif // _GLIBCXX_TR1_TYPE_TRAITS
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index 63ad6b5c23e..ac8ffdb6c5a 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -39,6 +39,10 @@ 
 
 #include <concepts>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic" // __int128
+#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+
 namespace std _GLIBCXX_VISIBILITY(default)
 {
   // [cmp.categories], comparison category types
@@ -1258,6 +1262,8 @@  namespace std _GLIBCXX_VISIBILITY(default)
 #endif // __cpp_lib_three_way_comparison >= 201907L
 } // namespace std
 
+#pragma GCC diagnostic pop
+
 #endif // C++20
 
 #endif // _COMPARE
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index 2e2038e1a82..eaf1f502705 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -46,6 +46,9 @@ 
 #define __glibcxx_want_constexpr_new
 #include <bits/version.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wc++11-extensions" // scoped enum
+
 #pragma GCC visibility push(default)
 
 extern "C++" {
@@ -245,5 +248,6 @@  namespace std
 #endif // C++20
 
 #pragma GCC visibility pop
+#pragma GCC diagnostic pop
 
 #endif