diff --git a/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C b/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C
index 483cefd6ec31d3517300a7dda999b938cfacd128..d2381d0af3d60593f086ff2217e642b43e783223 100644
--- a/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C
+++ b/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-default.C
@@ -1,6 +1,7 @@
 /* { dg-skip-if "no shared_ptr in C++98" { c++98_only }  } */
 /* { dg-skip-if "requires hosted libstdc++ for memory shared_ptr" { ! hostedlib } } */
 
+#define _GLIBCXX_SYSHDR
 #include <memory>
 
 struct A {int x; int y;};
diff --git a/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C b/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C
index 10d220fa940427ed3ccf24aa2ecd9f1ede85abc4..e143645074bddcf958952904a7dc647bae49f215 100644
--- a/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C
+++ b/gcc/testsuite/g++.dg/analyzer/fanalyzer-show-events-in-system-headers-no.C
@@ -2,6 +2,7 @@
 /* { dg-skip-if "no shared_ptr in C++98" { c++98_only }  } */
 /* { dg-skip-if "requires hosted libstdc++ for memory shared_ptr" { ! hostedlib } } */
 
+#define _GLIBCXX_SYSHDR
 #include <memory>
 
 struct A {int x; int y;};
diff --git a/gcc/testsuite/g++.dg/diagnostic/disable.C b/gcc/testsuite/g++.dg/diagnostic/disable.C
index c055c40bd499736f4e4d661ca8571f338eb618b6..464066fd6ff6951533d29e133e929e988c15e1e6 100644
--- a/gcc/testsuite/g++.dg/diagnostic/disable.C
+++ b/gcc/testsuite/g++.dg/diagnostic/disable.C
@@ -1,6 +1,7 @@
 // { dg-options "-Wtemplates -Wmultiple-inheritance -Wvirtual-inheritance -Wnamespaces" }
 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
 
+#define _GLIBCXX_SYSHDR
 #include <iostream>
 #include <algorithm>
 
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 768c2991ec29f667cf620996f40217978e2598aa..b3423d7957ac6326ca090107b6d7ea8c45141ee3 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=19 -Wsystem-headers"
+  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19"
   AC_SUBST(WARN_FLAGS)
 ])
 
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index de05e63de4c5b642dc7eed402f8590420d64cc84..e115ee55739f4820a8eca6e0d30a1451d7735d4b 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=19 -Wsystem-headers"
+  WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19"
 
 
 
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h
index df14864d210ecd6c1f179f037ae9478a1ce42033..0016dcd42e93c311133da09011d166c0ccf54d00 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ALGORITHMFWD_H
 #define _GLIBCXX_ALGORITHMFWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/stl_pair.h>
diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index 7c27bd8c9514e9262278bcd2594d192ff923bc83..7093d0fc82262212b7238b0ea8e6820cbbea12ae 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ATOMIC_BASE_H
 #define _GLIBCXX_ATOMIC_BASE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <new> // For placement new
diff --git a/libstdc++-v3/include/bits/atomic_futex.h b/libstdc++-v3/include/bits/atomic_futex.h
index dd65417487396bc1105ab14a5f9f79f4c3aa4086..c7d90466418d1c21019a8341b2efd5917fd3928e 100644
--- a/libstdc++-v3/include/bits/atomic_futex.h
+++ b/libstdc++-v3/include/bits/atomic_futex.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ATOMIC_FUTEX_H
 #define _GLIBCXX_ATOMIC_FUTEX_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <atomic>
 #if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1)
diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h b/libstdc++-v3/include/bits/atomic_timed_wait.h
index 778d2868b0315fd3e8687324e7f56a169e5dd99e..b1eeb3ceeac1296c0ff6a5102c4d9b6afaf7a71f 100644
--- a/libstdc++-v3/include/bits/atomic_timed_wait.h
+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ATOMIC_TIMED_WAIT_H
 #define _GLIBCXX_ATOMIC_TIMED_WAIT_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/atomic_wait.h>
 
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index f1c183f9dbbb286627b36e9cbd592b2108e87f14..e31b535132a784148ea600caf4f2071dd4d9b1ee 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ATOMIC_WAIT_H
 #define _GLIBCXX_ATOMIC_WAIT_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h
index 2c2334d0fe3c6b0aaea2612cfed433fe32e164fd..a2d8060edd228fe620cccf8283c35dd7dcc96df1 100644
--- a/libstdc++-v3/include/bits/basic_ios.h
+++ b/libstdc++-v3/include/bits/basic_ios.h
@@ -30,7 +30,9 @@
 #ifndef _BASIC_IOS_H
 #define _BASIC_IOS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/localefwd.h>
 #include <bits/locale_classes.h>
diff --git a/libstdc++-v3/include/bits/basic_ios.tcc b/libstdc++-v3/include/bits/basic_ios.tcc
index 1519603f6b5c62bdc52ab87e1703205cd9bed707..d28424fa39d1fd45d65c7b5aa46481bb22620330 100644
--- a/libstdc++-v3/include/bits/basic_ios.tcc
+++ b/libstdc++-v3/include/bits/basic_ios.tcc
@@ -30,7 +30,9 @@
 #ifndef _BASIC_IOS_TCC
 #define _BASIC_IOS_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 120c0bc9a179fd23769f7b03c2ccd8f491b9cd1b..976577f8f22d2b17d81e8ff3f1f20f98289f4318 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -34,7 +34,9 @@
 #ifndef _BASIC_STRING_H
 #define _BASIC_STRING_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <ext/alloc_traits.h>
 #include <debug/debug.h>
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 8a764855698d0223c06e2d9f438d48499c59184a..2c17d258bfe45a44b65394d32fb18c8669273e5e 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -39,7 +39,9 @@
 #ifndef _BASIC_STRING_TCC
 #define _BASIC_STRING_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions"
diff --git a/libstdc++-v3/include/bits/boost_concept_check.h b/libstdc++-v3/include/bits/boost_concept_check.h
index a042ae670fe881a8cd9e8fe11e76ffb728dd4ed5..76b5abbecd2d295e429b42257efeee278333f938 100644
--- a/libstdc++-v3/include/bits/boost_concept_check.h
+++ b/libstdc++-v3/include/bits/boost_concept_check.h
@@ -39,7 +39,9 @@
 #ifndef _BOOST_CONCEPT_CHECK_H
 #define _BOOST_CONCEPT_CHECK_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/stl_iterator_base_types.h>    // for traits and tags
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 16c67b80e7694265f1c139aeb8557c4fbd4888b7..29d795f687c6bda0883b42db5a883ded04e67786 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CXX_CONFIG_H
 #define _GLIBCXX_CXX_CONFIG_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wvariadic-macros"
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index ac3e43e34b96f6da83b7756e0f3c4cf8e8a836f8..fa922e535cef9180137642e3e496ea5d7b2fd5ea 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -34,7 +34,9 @@
 #ifndef _CHAR_TRAITS_H
 #define _CHAR_TRAITS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/charconv.h b/libstdc++-v3/include/bits/charconv.h
index c9d439b99f273739f4ba4d30afbf8862050bbdcf..b22c7e1195f088627e4a34d13be78b69954cba7d 100644
--- a/libstdc++-v3/include/bits/charconv.h
+++ b/libstdc++-v3/include/bits/charconv.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CHARCONV_H
 #define _GLIBCXX_CHARCONV_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 
diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h
index fd9c4642f4f2306b253d8db24b0475c84a2ae363..3a5ab95e1adfddfeddfc9f6b081533f2398f0a32 100644
--- a/libstdc++-v3/include/bits/chrono.h
+++ b/libstdc++-v3/include/bits/chrono.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CHRONO_H
 #define _GLIBCXX_CHRONO_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 
diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index c7d2c9862fcf7917ff7452715f4699a1d6a8991b..1e34c82b532d2205f337240e8d629eaf2c8985fa 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CHRONO_IO_H
 #define _GLIBCXX_CHRONO_IO_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 202002L
 
diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h
index c51cc7d220d3aa5b7f41252098af0b84cae52668..ce520a6d8decbed925e6072e6be6c19805fc7f82 100644
--- a/libstdc++-v3/include/bits/codecvt.h
+++ b/libstdc++-v3/include/bits/codecvt.h
@@ -36,7 +36,9 @@
 #ifndef _CODECVT_H
 #define _CODECVT_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/locale_classes.h> // locale::facet
diff --git a/libstdc++-v3/include/bits/concept_check.h b/libstdc++-v3/include/bits/concept_check.h
index 6479f2fa919e2a82c420fe6ebd3c52b76b5143b9..cfedeb8dacf5668281470c55edd98f4a0daaa3ca 100644
--- a/libstdc++-v3/include/bits/concept_check.h
+++ b/libstdc++-v3/include/bits/concept_check.h
@@ -30,7 +30,9 @@
 #ifndef _CONCEPT_CHECK_H
 #define _CONCEPT_CHECK_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index e3a80e06346efb2d77ddfe9db52894bc48688377..19bf1edf647e05dc3c45e19dc564a20bdd694560 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -32,7 +32,9 @@
 #ifndef _CPP_TYPE_TRAITS_H
 #define _CPP_TYPE_TRAITS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/bits/elements_of.h b/libstdc++-v3/include/bits/elements_of.h
index 2c65f2574cbc684421960403eceabb0627ad13db..118efeb32091c8f98fa09c082f637b27533ab36a 100644
--- a/libstdc++-v3/include/bits/elements_of.h
+++ b/libstdc++-v3/include/bits/elements_of.h
@@ -25,7 +25,9 @@
 #ifndef _GLIBCXX_BITS_ELEMENTS_OF
 #define _GLIBCXX_BITS_ELEMENTS_OF
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/enable_special_members.h b/libstdc++-v3/include/bits/enable_special_members.h
index 73a9b0202ce5b85f71fe7c828f133a25ab6c9993..b53ff341108c29b028e2929213119037b9aef2d9 100644
--- a/libstdc++-v3/include/bits/enable_special_members.h
+++ b/libstdc++-v3/include/bits/enable_special_members.h
@@ -30,7 +30,9 @@
 #ifndef _ENABLE_SPECIAL_MEMBERS_H
 #define _ENABLE_SPECIAL_MEMBERS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h
index 1fc348db1e3e52e113bfe6dff803875795b09f46..327dade0081015791151e1f5b296b10825e80de9 100644
--- a/libstdc++-v3/include/bits/erase_if.h
+++ b/libstdc++-v3/include/bits/erase_if.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ERASE_IF_H
 #define _GLIBCXX_ERASE_IF_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 5ab2253f6093f9ae4ca83f611faadcb0d01d4b67..eee773c0212158c20d174f4a6bc91d19369cb292 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -30,7 +30,9 @@
 #ifndef _FORWARD_LIST_H
 #define _FORWARD_LIST_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <initializer_list>
 #include <bits/stl_iterator_base_types.h>
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index 7b246ad59d2c44752483cab80b5bc8e76f0a5e58..9f250d33c453308ac11518877d696110eb002217 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -34,7 +34,9 @@
 #ifndef _FSTREAM_TCC
 #define _FSTREAM_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index 3626ebe816b814398ebe297da650063b18a1da18..e7d8c6c20545ca375da9c23572713b4f9c4f5d32 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -30,7 +30,9 @@
 #ifndef _FUNCTIONAL_HASH_H
 #define _FUNCTIONAL_HASH_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <type_traits>
 #include <bits/hash_bytes.h>
diff --git a/libstdc++-v3/include/bits/gslice.h b/libstdc++-v3/include/bits/gslice.h
index d9a8b929a5710d3dcec6d45caf86746f679f3c3a..90e21fdf6bf421b5634ce0d714545372a31e799f 100644
--- a/libstdc++-v3/include/bits/gslice.h
+++ b/libstdc++-v3/include/bits/gslice.h
@@ -32,7 +32,9 @@
 #ifndef _GSLICE_H
 #define _GSLICE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/gslice_array.h b/libstdc++-v3/include/bits/gslice_array.h
index a358123a2c6e0f43782a8ac167851730add071b5..fc3cdb9d157a7c801c94499ddf84afad0eee94cc 100644
--- a/libstdc++-v3/include/bits/gslice_array.h
+++ b/libstdc++-v3/include/bits/gslice_array.h
@@ -32,7 +32,9 @@
 #ifndef _GSLICE_ARRAY_H
 #define _GSLICE_ARRAY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index b02bddf5635b67f59a6322227fd883408c42d91e..92b57071f1c6219250a0b128870e699570eca8e0 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -30,7 +30,9 @@
 #ifndef _HASHTABLE_H
 #define _HASHTABLE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/hashtable_policy.h>
 #include <bits/enable_special_members.h>
diff --git a/libstdc++-v3/include/bits/indirect_array.h b/libstdc++-v3/include/bits/indirect_array.h
index 99980d5dbc1e89cd70c37fc75895b8990e688f55..b6829530daa404916da522f9e0a6b2af962a9a40 100644
--- a/libstdc++-v3/include/bits/indirect_array.h
+++ b/libstdc++-v3/include/bits/indirect_array.h
@@ -32,7 +32,9 @@
 #ifndef _INDIRECT_ARRAY_H
 #define _INDIRECT_ARRAY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/invoke.h b/libstdc++-v3/include/bits/invoke.h
index 2c66a36db81eda8aad59483dec889d222ce970b6..eff2ff5c23839a43a45833eca7b9c1ebf1d86ae9 100644
--- a/libstdc++-v3/include/bits/invoke.h
+++ b/libstdc++-v3/include/bits/invoke.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_INVOKE_H
 #define _GLIBCXX_INVOKE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index 6e343658096786723729f4d2a40c75929863cea4..a649448e298f14cb8179ad23e6e67381c132d51a 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -34,7 +34,9 @@
 #ifndef _IOS_BASE_H
 #define _IOS_BASE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <ext/atomicity.h>
 #include <bits/localefwd.h>
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index 23a7c84977790b77e2c32ba277139aad74137572..e8957fd2c3bf85c26fa3b3641786c84e8ced39a9 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -34,7 +34,9 @@
 #ifndef _ISTREAM_TCC
 #define _ISTREAM_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h
index d96573f4213b3a73e82042d1ded6c81bf4a708fa..490a362cdf1cabc8b360d429a0ba1f9b48f88dae 100644
--- a/libstdc++-v3/include/bits/iterator_concepts.h
+++ b/libstdc++-v3/include/bits/iterator_concepts.h
@@ -30,7 +30,9 @@
 #ifndef _ITERATOR_CONCEPTS_H
 #define _ITERATOR_CONCEPTS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 202002L
 #include <concepts>
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index e168881b516277ac64183df1020cd32883fd1767..0edb815aee0f90875a95954ff246a2ca1380bb3c 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -34,7 +34,9 @@
 #ifndef _LOCALE_CLASSES_H
 #define _LOCALE_CLASSES_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/localefwd.h>
 #include <string>
diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc
index 4f3af2461a5d1698d237e13f4a603ed5f3ff3fec..2b78008e9ae3d442099e436731793bddab226bb4 100644
--- a/libstdc++-v3/include/bits/locale_classes.tcc
+++ b/libstdc++-v3/include/bits/locale_classes.tcc
@@ -34,8 +34,9 @@
 #ifndef _LOCALE_CLASSES_TCC
 #define _LOCALE_CLASSES_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
-
+#endif
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
 #pragma GCC diagnostic ignored "-Wvariadic-macros"
diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index 53bb108e3ead2a02dc5839e492d0cc920331d2a5..afa239ad96a71014af6dd54d7d0021f34f21c960 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -34,7 +34,9 @@
 #ifndef _LOCALE_FACETS_H
 #define _LOCALE_FACETS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <cwctype>	// For wctype_t
 #include <cctype>
diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc
index 4e9bf6fb8f94c9d502c8ccc8587b6f28915f8ae4..14e87ab0ed35c4de44e7baf4a9d6092d0e302ff8 100644
--- a/libstdc++-v3/include/bits/locale_facets.tcc
+++ b/libstdc++-v3/include/bits/locale_facets.tcc
@@ -30,8 +30,9 @@
 #ifndef _LOCALE_FACETS_TCC
 #define _LOCALE_FACETS_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
-
+#endif
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
 
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h
index f9e70e5b2271557b8e5a593b6492ea5cbbaabf0c..298ffc10ed3206b1e7e35b061701c164a68b9ddc 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.h
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.h
@@ -34,7 +34,9 @@
 #ifndef _LOCALE_FACETS_NONIO_H
 #define _LOCALE_FACETS_NONIO_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <ctime>	// For struct tm
 
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 72136f42f0866a6537d529af46461e7e496d741b..7b597c86aeac27e18228e6c3084d3233da58fa95 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -30,7 +30,9 @@
 #ifndef _LOCALE_FACETS_NONIO_TCC
 #define _LOCALE_FACETS_NONIO_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h
index 07e5443b2bb48c753ed69549fefb6311c0e9e37e..cee5c4d513441871df2f3607f0e12ff706539eea 100644
--- a/libstdc++-v3/include/bits/localefwd.h
+++ b/libstdc++-v3/include/bits/localefwd.h
@@ -34,7 +34,9 @@
 #ifndef _LOCALE_FWD_H
 #define _LOCALE_FWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/c++locale.h>  // Defines __c_locale, config-specific include
diff --git a/libstdc++-v3/include/bits/mask_array.h b/libstdc++-v3/include/bits/mask_array.h
index 58fcc3027e10c3d96787268e72ae94a9d9147386..341b828f70016960903425c8f4b7de5ad116eec1 100644
--- a/libstdc++-v3/include/bits/mask_array.h
+++ b/libstdc++-v3/include/bits/mask_array.h
@@ -32,7 +32,9 @@
 #ifndef _MASK_ARRAY_H
 #define _MASK_ARRAY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/max_size_type.h b/libstdc++-v3/include/bits/max_size_type.h
index 7d686708507dcd9278203e8a22802555d074d226..d3392b2e6b5e8b51c142654336552bb7c3468ab3 100644
--- a/libstdc++-v3/include/bits/max_size_type.h
+++ b/libstdc++-v3/include/bits/max_size_type.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_MAX_SIZE_TYPE_H
 #define _GLIBCXX_MAX_SIZE_TYPE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus > 201703L && __cpp_lib_concepts
 #include <ext/numeric_traits.h>
diff --git a/libstdc++-v3/include/bits/memory_resource.h b/libstdc++-v3/include/bits/memory_resource.h
index db515fb30ef93550184b542c1a8c8a3f77030f26..a40c9729c5763df04b3f20e934f0d8c5652c9af8 100644
--- a/libstdc++-v3/include/bits/memory_resource.h
+++ b/libstdc++-v3/include/bits/memory_resource.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_MEMORY_RESOURCE_H
 #define _GLIBCXX_MEMORY_RESOURCE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201703L
 
diff --git a/libstdc++-v3/include/bits/memoryfwd.h b/libstdc++-v3/include/bits/memoryfwd.h
index 03d1162e2334f8c69ae0ea80c0d01aa6b0a77384..bb6bdcc2225075bbf8b2d4087b18b0b4d57b19a1 100644
--- a/libstdc++-v3/include/bits/memoryfwd.h
+++ b/libstdc++-v3/include/bits/memoryfwd.h
@@ -43,7 +43,9 @@
 #ifndef _MEMORYFWD_H
 #define _MEMORYFWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/move_only_function.h b/libstdc++-v3/include/bits/move_only_function.h
index 2a40ff400dece4182a8f181cb860236f68ce63c7..42b33d019014e93edd2f140d98104a5452e4aad9 100644
--- a/libstdc++-v3/include/bits/move_only_function.h
+++ b/libstdc++-v3/include/bits/move_only_function.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_MOVE_ONLY_FUNCTION_H
 #define _GLIBCXX_MOVE_ONLY_FUNCTION_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h
index 2d8e47c50621b7593a3052c8ea8044c985dca532..d8ba11180bd9e57ee4ef6055a51ff26664876628 100644
--- a/libstdc++-v3/include/bits/node_handle.h
+++ b/libstdc++-v3/include/bits/node_handle.h
@@ -31,7 +31,9 @@
 #ifndef _NODE_HANDLE
 #define _NODE_HANDLE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 7aeb23ad38d1e39a94a3c60ff2f3519d1d23afec..06cf2da1e0706877245bd6ef0a76d0d8155daa43 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -34,8 +34,9 @@
 #ifndef _OSTREAM_TCC
 #define _OSTREAM_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
-
+#endif
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
 
diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h
index d61b4b14f97a21b4be1390a1bfa53bfcab39a0e3..c92504eed654ae0721fd28c924afde685e9bf885 100644
--- a/libstdc++-v3/include/bits/ostream_insert.h
+++ b/libstdc++-v3/include/bits/ostream_insert.h
@@ -30,7 +30,9 @@
 #ifndef _OSTREAM_INSERT_H
 #define _OSTREAM_INSERT_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <iosfwd>
 #include <bits/cxxabi_forced.h>
diff --git a/libstdc++-v3/include/bits/out_ptr.h b/libstdc++-v3/include/bits/out_ptr.h
index d74c9f52d3b5361f7f7d2344edde978c12481072..00ba09d0f18db684441d9b00e044d9e71043ee2e 100644
--- a/libstdc++-v3/include/bits/out_ptr.h
+++ b/libstdc++-v3/include/bits/out_ptr.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_OUT_PTR_H
 #define _GLIBCXX_OUT_PTR_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/parse_numbers.h b/libstdc++-v3/include/bits/parse_numbers.h
index 97c08ca7371af1071ebdcd382c75572ebc44e858..7d352ce625b80baf7f6d83ebcf3bab4e22b1d80a 100644
--- a/libstdc++-v3/include/bits/parse_numbers.h
+++ b/libstdc++-v3/include/bits/parse_numbers.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_PARSE_NUMBERS_H
 #define _GLIBCXX_PARSE_NUMBERS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 // From n3642.pdf except I added binary literals and digit separator '\''.
 
diff --git a/libstdc++-v3/include/bits/postypes.h b/libstdc++-v3/include/bits/postypes.h
index 3da558b1ad41b09d54db1dceae546722c57053e2..7bd973e089b6ddf904021a2216b4fd07604127c6 100644
--- a/libstdc++-v3/include/bits/postypes.h
+++ b/libstdc++-v3/include/bits/postypes.h
@@ -35,7 +35,9 @@
 #ifndef _GLIBCXX_POSTYPES_H
 #define _GLIBCXX_POSTYPES_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <cwchar> // For mbstate_t
 
diff --git a/libstdc++-v3/include/bits/quoted_string.h b/libstdc++-v3/include/bits/quoted_string.h
index e2f2518638b359359a72634e0774f48d3999bf50..a0b67265ec3c30f204cfa28e541d364d8cd60062 100644
--- a/libstdc++-v3/include/bits/quoted_string.h
+++ b/libstdc++-v3/include/bits/quoted_string.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_QUOTED_STRING_H
 #define _GLIBCXX_QUOTED_STRING_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
index a9896d109ef2a4a4d47d84c5f9eca0e15c01bd07..2dacbedfa53305eb2372b33d6ab0a1f502c41d0b 100644
--- a/libstdc++-v3/include/bits/range_access.h
+++ b/libstdc++-v3/include/bits/range_access.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_RANGE_ACCESS_H
 #define _GLIBCXX_RANGE_ACCESS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 #include <initializer_list>
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h
index ebd4f7e59569b853535ab7809c95f98684103f02..137c3c98e146367aa04427e0c70cc0b35866e0a3 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_RANGES_BASE_H
 #define _GLIBCXX_RANGES_BASE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus > 201703L
 #include <initializer_list>
diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h
index 71ec2b297b7c1c4d7b5691c2790550553b68ec0a..a73cdc9c71ef9dbb6c317323e1330b4819cb5f9f 100644
--- a/libstdc++-v3/include/bits/refwrap.h
+++ b/libstdc++-v3/include/bits/refwrap.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_REFWRAP_H
 #define _GLIBCXX_REFWRAP_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 
diff --git a/libstdc++-v3/include/bits/sat_arith.h b/libstdc++-v3/include/bits/sat_arith.h
index 71793467984ba0ec81325b22f4c4b08bc0712451..97545d272ca745597928bb1d4f3a312ef719441a 100644
--- a/libstdc++-v3/include/bits/sat_arith.h
+++ b/libstdc++-v3/include/bits/sat_arith.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_SAT_ARITH_H
 #define _GLIBCXX_SAT_ARITH_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h
index 2b19c9c6c6ac0a35bfe63a654e1239ff5ee32b9e..9d73b37e60a161fd647bcc8dc8d90dbf0eae785b 100644
--- a/libstdc++-v3/include/bits/semaphore_base.h
+++ b/libstdc++-v3/include/bits/semaphore_base.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_SEMAPHORE_BASE_H
 #define _GLIBCXX_SEMAPHORE_BASE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/atomic_base.h>
 #include <bits/chrono.h>
diff --git a/libstdc++-v3/include/bits/slice_array.h b/libstdc++-v3/include/bits/slice_array.h
index 10e1604a6c0905239c528f8bfad3cf4b8c273879..50ed758726af53feeed5f3df6ff5510e302c1f4b 100644
--- a/libstdc++-v3/include/bits/slice_array.h
+++ b/libstdc++-v3/include/bits/slice_array.h
@@ -32,7 +32,9 @@
 #ifndef _SLICE_ARRAY_H
 #define _SLICE_ARRAY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 7eb5561b6309a9bdbdcf0a03bb835cf7b90b331f..e6a06d13fff81dd94bc109243b1733e17be28ad0 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -34,8 +34,9 @@
 #ifndef _SSTREAM_TCC
 #define _SSTREAM_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
-
+#endif
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
 
diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h
index d143ec14179da080c076906740a98dd19a3e3e34..0fa6468a0c8c70eaef90b456d01c09f1076191cf 100644
--- a/libstdc++-v3/include/bits/std_abs.h
+++ b/libstdc++-v3/include/bits/std_abs.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_BITS_STD_ABS_H
 #define _GLIBCXX_BITS_STD_ABS_H
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h
index bb8d8b9306cd1614cb6ea7c3a7ac3139bb07e674..d6c448159f2f1821cda7ff16156c7413b90e940f 100644
--- a/libstdc++-v3/include/bits/std_function.h
+++ b/libstdc++-v3/include/bits/std_function.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_STD_FUNCTION_H
 #define _GLIBCXX_STD_FUNCTION_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h
index c4b287672e02bae2e01edb74a7c855eb42bb977b..2ade4c59dbe93a8c10df4b6d40ebe576ba1423c3 100644
--- a/libstdc++-v3/include/bits/std_mutex.h
+++ b/libstdc++-v3/include/bits/std_mutex.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_MUTEX_H
 #define _GLIBCXX_MUTEX_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/bits/std_thread.h b/libstdc++-v3/include/bits/std_thread.h
index 5817bfb29ddeebf202402566835511e5e7ad28db..eca2de7afa47a1f923dd4734fd61d6a2ea142a2f 100644
--- a/libstdc++-v3/include/bits/std_thread.h
+++ b/libstdc++-v3/include/bits/std_thread.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_THREAD_H
 #define _GLIBCXX_THREAD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 #include <bits/c++config.h>
diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
index 2c9eaf9226d64dde3c7538792cce0423366db4e4..0ee50aae993d54231ffb6a79f7d4f23846a7190b 100644
--- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
+++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
@@ -59,7 +59,9 @@
 #ifndef _STL_ITERATOR_BASE_FUNCS_H
 #define _STL_ITERATOR_BASE_FUNCS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/concept_check.h>
 #include <debug/assertions.h>
diff --git a/libstdc++-v3/include/bits/stl_iterator_base_types.h b/libstdc++-v3/include/bits/stl_iterator_base_types.h
index 14ea0d44e285354abb99e3411a6b08139a633cbf..710e367c9786eafdc772532e51bd3661cb2a4a85 100644
--- a/libstdc++-v3/include/bits/stl_iterator_base_types.h
+++ b/libstdc++-v3/include/bits/stl_iterator_base_types.h
@@ -59,7 +59,9 @@
 #ifndef _STL_ITERATOR_BASE_TYPES_H
 #define _STL_ITERATOR_BASE_TYPES_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 978093fc58779a46c56ee204e95fa24f06ff46ca..bc27e191e8b846bfaaeb28fdfbcb5c02dd53cec0 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -58,7 +58,9 @@
 #ifndef _STL_TREE_H
 #define _STL_TREE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h
index 6c3ba9d6b8baadceefd2b41f02606e8eee0bfcde..32b265c90ec8dbb172aa1f591f33b21e8fecc8f0 100644
--- a/libstdc++-v3/include/bits/stream_iterator.h
+++ b/libstdc++-v3/include/bits/stream_iterator.h
@@ -30,7 +30,9 @@
 #ifndef _STREAM_ITERATOR_H
 #define _STREAM_ITERATOR_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <iosfwd>
 #include <bits/move.h>
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc
index 0c28033f4916ab1c991515818d7b777c1f6564cc..991c27e19a78ac44b913c46da23d0fca00fe33ba 100644
--- a/libstdc++-v3/include/bits/streambuf.tcc
+++ b/libstdc++-v3/include/bits/streambuf.tcc
@@ -34,7 +34,9 @@
 #ifndef _STREAMBUF_TCC
 #define _STREAMBUF_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h
index 579bf0b1819b38d3c149b5bac8d7856613f58b86..078eeb358b93c7940d2b59c0865f8cdd37afcd9f 100644
--- a/libstdc++-v3/include/bits/streambuf_iterator.h
+++ b/libstdc++-v3/include/bits/streambuf_iterator.h
@@ -30,7 +30,9 @@
 #ifndef _STREAMBUF_ITERATOR_H
 #define _STREAMBUF_ITERATOR_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <streambuf>
 #include <bits/stl_iterator_base_types.h>
diff --git a/libstdc++-v3/include/bits/string_view.tcc b/libstdc++-v3/include/bits/string_view.tcc
index 5fa50493db7cb801b4abbf3fd37a30d509ecc7bb..a9ba668d05cfe5b13e8834c5be573434020208cf 100644
--- a/libstdc++-v3/include/bits/string_view.tcc
+++ b/libstdc++-v3/include/bits/string_view.tcc
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_STRING_VIEW_TCC
 #define _GLIBCXX_STRING_VIEW_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201703L
 
diff --git a/libstdc++-v3/include/bits/stringfwd.h b/libstdc++-v3/include/bits/stringfwd.h
index dcbc9ed6419f60ef040f2d9ee5e28c775569402f..8f9a32dcb3bd2e1189b704299687911fdd4937b1 100644
--- a/libstdc++-v3/include/bits/stringfwd.h
+++ b/libstdc++-v3/include/bits/stringfwd.h
@@ -34,7 +34,9 @@
 #ifndef _STRINGFWD_H
 #define _STRINGFWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/memoryfwd.h>
diff --git a/libstdc++-v3/include/bits/this_thread_sleep.h b/libstdc++-v3/include/bits/this_thread_sleep.h
index b7ddd1beaab2ae0b12fa5df667167e5cc53e1eea..d1b1436f4fab9ac417ab9b05b1e79d583d0c0b01 100644
--- a/libstdc++-v3/include/bits/this_thread_sleep.h
+++ b/libstdc++-v3/include/bits/this_thread_sleep.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_THIS_THREAD_SLEEP_H
 #define _GLIBCXX_THIS_THREAD_SLEEP_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 #include <bits/chrono.h> // std::chrono::*
diff --git a/libstdc++-v3/include/bits/unique_lock.h b/libstdc++-v3/include/bits/unique_lock.h
index efb24cf91d36c271fa43115c349881eb6930fa3c..acb6545926eb71cfcaf9d768bede85414007d322 100644
--- a/libstdc++-v3/include/bits/unique_lock.h
+++ b/libstdc++-v3/include/bits/unique_lock.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_UNIQUE_LOCK_H
 #define _GLIBCXX_UNIQUE_LOCK_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/bits/uses_allocator_args.h b/libstdc++-v3/include/bits/uses_allocator_args.h
index 92097c9c60c3e80206dc4b21e03dc4f704b4b277..18fd4bb360d7902f96304ab9a0640d4f13bb948d 100644
--- a/libstdc++-v3/include/bits/uses_allocator_args.h
+++ b/libstdc++-v3/include/bits/uses_allocator_args.h
@@ -30,7 +30,9 @@
 #ifndef _USES_ALLOCATOR_ARGS
 #define _USES_ALLOCATOR_ARGS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/version.h>
 
diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h
index 751ff7b9a2779d23313c21adb2ddbb1eed28cdff..4a6c16dc2e0134de8a6b23120d63488dfe99d3ab 100644
--- a/libstdc++-v3/include/bits/utility.h
+++ b/libstdc++-v3/include/bits/utility.h
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_UTILITY_H
 #define _GLIBCXX_UTILITY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 
diff --git a/libstdc++-v3/include/bits/valarray_after.h b/libstdc++-v3/include/bits/valarray_after.h
index b7c93fc1fa76104c586fec70428724b363425fe4..380839cccefce7d3f5bb257e38bef097034ef08b 100644
--- a/libstdc++-v3/include/bits/valarray_after.h
+++ b/libstdc++-v3/include/bits/valarray_after.h
@@ -32,7 +32,9 @@
 #ifndef _VALARRAY_AFTER_H
 #define _VALARRAY_AFTER_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/bits/valarray_array.h b/libstdc++-v3/include/bits/valarray_array.h
index 0dc28333f33508caf15785a5723b1af9e115692b..0c143313882598f5ee28b5ed390055ad6461584d 100644
--- a/libstdc++-v3/include/bits/valarray_array.h
+++ b/libstdc++-v3/include/bits/valarray_array.h
@@ -32,7 +32,9 @@
 #ifndef _VALARRAY_ARRAY_H
 #define _VALARRAY_ARRAY_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
diff --git a/libstdc++-v3/include/bits/valarray_before.h b/libstdc++-v3/include/bits/valarray_before.h
index af5a1c20dddda119cc1792b9813dd7ad2ed5c937..c6eabd2a16d828f6d7150ec3737b237a032c1cda 100644
--- a/libstdc++-v3/include/bits/valarray_before.h
+++ b/libstdc++-v3/include/bits/valarray_before.h
@@ -32,7 +32,9 @@
 #ifndef _VALARRAY_BEFORE_H
 #define _VALARRAY_BEFORE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/slice_array.h>
 
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index 22526e851457605704399ac370d67374a41fa8a8..dcd93fd432da7275fb9413eec91dc57de70b72c1 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -44,7 +44,9 @@
 // if unwanted, to permit bits and other FTMs to depend on them for condtional
 // computation without exposing extra FTMs to user code.
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/bits/version.tpl b/libstdc++-v3/include/bits/version.tpl
index 4a7d5e29c10da2652380b39893e3d07e028eba39..d4cb88f40fa2c0b3c2c87ec2468908e67f7552a3 100644
--- a/libstdc++-v3/include/bits/version.tpl
+++ b/libstdc++-v3/include/bits/version.tpl
@@ -44,7 +44,9 @@ h
 // if unwanted, to permit bits and other FTMs to depend on them for condtional
 // computation without exposing extra FTMs to user code.
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 /*{
diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert
index ef6e844a72b71abb9aefd8db5d1edc85791a55fc..8163d0ca9c53ba4a6a0a823e9c1e81e0ba8c58aa 100644
--- a/libstdc++-v3/include/c/cassert
+++ b/libstdc++-v3/include/c/cassert
@@ -28,7 +28,9 @@
 
 // No include guards on this header...
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype
index a7a59551d86909dce27a802bf2c04d0c0d78da09..cc5ebf57465955c65d42e9010a2471b20f19b317 100644
--- a/libstdc++-v3/include/c/cctype
+++ b/libstdc++-v3/include/c/cctype
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CCTYPE
 #define _GLIBCXX_CCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno
index 29bf0b403aad2b14a3d91519953643e46f4b8100..18750543bc0f7bf121a1cb5dcb9a730e87a11828 100644
--- a/libstdc++-v3/include/c/cerrno
+++ b/libstdc++-v3/include/c/cerrno
@@ -38,7 +38,9 @@
 #ifndef _GLIBCXX_CERRNO
 #define _GLIBCXX_CERRNO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat
index 1f9edada950cecabe71ec3830db4b68e1178be4e..9eab4fb1c767fe77a81a3021cd081de737b617e6 100644
--- a/libstdc++-v3/include/c/cfloat
+++ b/libstdc++-v3/include/c/cfloat
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CFLOAT
 #define _GLIBCXX_CFLOAT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/ciso646 b/libstdc++-v3/include/c/ciso646
index 2b6f797c5804f6124bbaed6d2658ca60cda85c7c..bd04ef3f22a67d8d9ae7694f18b942bafa902784 100644
--- a/libstdc++-v3/include/c/ciso646
+++ b/libstdc++-v3/include/c/ciso646
@@ -32,7 +32,9 @@
 #ifndef _GLIBCXX_CISO646
 #define _GLIBCXX_CISO646
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #endif
diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits
index 846fe190707a7f610219bae3b9c09b9a61706b93..9728ca5832f1961cca10fc93d4e2ec6fca5a6d4b 100644
--- a/libstdc++-v3/include/c/climits
+++ b/libstdc++-v3/include/c/climits
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CLIMITS
 #define _GLIBCXX_CLIMITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale
index 62d85ed6609aee1826d11724a7c911813bbaee7a..183d22479a8c2fc2ffeb1f6c0461cdf62569cada 100644
--- a/libstdc++-v3/include/c/clocale
+++ b/libstdc++-v3/include/c/clocale
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CLOCALE
 #define _GLIBCXX_CLOCALE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath
index 371ee59986c83565adfb9a29e97bbbe8892b8478..43ff06aba7564a11103f79318a5b214bbb5ff51f 100644
--- a/libstdc++-v3/include/c/cmath
+++ b/libstdc++-v3/include/c/cmath
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CMATH
 #define _GLIBCXX_CMATH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp
index acf113a0c5a1b0c1f3307c2889f8095279d3c45d..10e5e933a52fb5380e9b3bcdf7f66129ef363a36 100644
--- a/libstdc++-v3/include/c/csetjmp
+++ b/libstdc++-v3/include/c/csetjmp
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSETJMP
 #define _GLIBCXX_CSETJMP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal
index c04bb6042f45c912e204e14591a967ec04bd4d0a..987d457e48ef9311306f930d6544e955c78fef1c 100644
--- a/libstdc++-v3/include/c/csignal
+++ b/libstdc++-v3/include/c/csignal
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSIGNAL
 #define _GLIBCXX_CSIGNAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg
index 7648662680c0ba2148035688d543b8588d4bd22e..520c3399c1c2a186db5a9fc09f0c3b742ba0e146 100644
--- a/libstdc++-v3/include/c/cstdarg
+++ b/libstdc++-v3/include/c/cstdarg
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDARG
 #define _GLIBCXX_CSTDARG 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef
index e1435b94556b58f48edca4042328e85ecab0820a..657363cf249992ad300a21eda5a45d098ff629a9 100644
--- a/libstdc++-v3/include/c/cstddef
+++ b/libstdc++-v3/include/c/cstddef
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDDEF
 #define _GLIBCXX_CSTDDEF 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio
index 99aead4ef9c8bb786504729f01306e5733841125..4e044fc62fd395e24a347a2f02fc660def143cf1 100644
--- a/libstdc++-v3/include/c/cstdio
+++ b/libstdc++-v3/include/c/cstdio
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDIO
 #define _GLIBCXX_CSTDIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib
index 75e6382c01b2cd76c64f6df76d8e2cbc0d01efa8..7aaf8d109871852f84aa69413a544d0790c060ed 100644
--- a/libstdc++-v3/include/c/cstdlib
+++ b/libstdc++-v3/include/c/cstdlib
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDLIB
 #define _GLIBCXX_CSTDLIB 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring
index 05d75182a7acdc9f4027b1c7830e557de7205c79..b0dae9dfef183bbcb3f8380783b1a6934d3c286d 100644
--- a/libstdc++-v3/include/c/cstring
+++ b/libstdc++-v3/include/c/cstring
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTRING
 #define _GLIBCXX_CSTRING 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime
index 73e2a7a016714ab22dae67aef95e21d24f48da7d..fb6ba3f256023c01267d5c48c8eccedb43a0dbd2 100644
--- a/libstdc++-v3/include/c/ctime
+++ b/libstdc++-v3/include/c/ctime
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CTIME
 #define _GLIBCXX_CTIME 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar
index 430d1ff50ba16f17af9d31b167a5d4aacd3443e0..58aa822e2ce091949cb5d4b984699b2d9c7c4f5e 100644
--- a/libstdc++-v3/include/c/cuchar
+++ b/libstdc++-v3/include/c/cuchar
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CUCHAR
 #define _GLIBCXX_CUCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar
index 921de2677507783bfc9e8fe37effdc6c0a637bd4..7f6de347de59890d833700f1eb18fde783425fd8 100644
--- a/libstdc++-v3/include/c/cwchar
+++ b/libstdc++-v3/include/c/cwchar
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CWCHAR
 #define _GLIBCXX_CWCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <cstddef>
diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype
index 0d2f55d9d6d0c78123033fda2c907bdce08512d3..9505dd93bb90dde87dc6175aeca333896b7f8f45 100644
--- a/libstdc++-v3/include/c/cwctype
+++ b/libstdc++-v3/include/c/cwctype
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CWCTYPE
 #define _GLIBCXX_CWCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c_compatibility/fenv.h b/libstdc++-v3/include/c_compatibility/fenv.h
index a587e7308af93d76c31012a2300ce4b1677755ca..957de38b509a297263a093c01e0ebf3377427e2b 100644
--- a/libstdc++-v3/include/c_compatibility/fenv.h
+++ b/libstdc++-v3/include/c_compatibility/fenv.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_FENV_H
 #define _GLIBCXX_FENV_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c_compatibility/inttypes.h b/libstdc++-v3/include/c_compatibility/inttypes.h
index 5a428ce0bd75f9da0db18294f1033f4cc7d4607b..1eaa3906552896df0a589b06c545757e2a698f25 100644
--- a/libstdc++-v3/include/c_compatibility/inttypes.h
+++ b/libstdc++-v3/include/c_compatibility/inttypes.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_INTTYPES_H
 #define _GLIBCXX_INTTYPES_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c_compatibility/stdint.h b/libstdc++-v3/include/c_compatibility/stdint.h
index 2d892e7ceb20d43ab9c4bf28112608acfb2e18a6..8923db83edd1f98cd06f11269d3309d6c3bbd392 100644
--- a/libstdc++-v3/include/c_compatibility/stdint.h
+++ b/libstdc++-v3/include/c_compatibility/stdint.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_STDINT_H
 #define _GLIBCXX_STDINT_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // include_next
diff --git a/libstdc++-v3/include/c_global/cassert b/libstdc++-v3/include/c_global/cassert
index 87b61bdb6ad741192a8d9f934d9313a265740f56..ed05d538744006098ffcac536e30ae6ce229228c 100644
--- a/libstdc++-v3/include/c_global/cassert
+++ b/libstdc++-v3/include/c_global/cassert
@@ -38,7 +38,9 @@
 
 // No include guards on this header...
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <assert.h>
diff --git a/libstdc++-v3/include/c_global/ccomplex b/libstdc++-v3/include/c_global/ccomplex
index 899d41cf85603777c36db74d2daee9f21f5eb365..ee1166aaecbea181c5b78e49baddc281fc95c3d1 100644
--- a/libstdc++-v3/include/c_global/ccomplex
+++ b/libstdc++-v3/include/c_global/ccomplex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CCOMPLEX
 #define _GLIBCXX_CCOMPLEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cctype b/libstdc++-v3/include/c_global/cctype
index 0c6d027ed24a8d3a41663f0777721d97bd29bf4c..9eec9cada06213f5e234134e6efe809253534bb6 100644
--- a/libstdc++-v3/include/c_global/cctype
+++ b/libstdc++-v3/include/c_global/cctype
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CCTYPE
 #define _GLIBCXX_CCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <ctype.h>
diff --git a/libstdc++-v3/include/c_global/cerrno b/libstdc++-v3/include/c_global/cerrno
index 5cad0795b278a4247af8744aed374a779d318cad..e11a412bb62181f9678f01b869bda6486c4d36a2 100644
--- a/libstdc++-v3/include/c_global/cerrno
+++ b/libstdc++-v3/include/c_global/cerrno
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CERRNO
 #define _GLIBCXX_CERRNO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <errno.h>
diff --git a/libstdc++-v3/include/c_global/cfenv b/libstdc++-v3/include/c_global/cfenv
index fd32daa8d2dca251a0b6bbcde2e3c71240e039fb..b63f643696bfa57d01038cd9424836cc95165748 100644
--- a/libstdc++-v3/include/c_global/cfenv
+++ b/libstdc++-v3/include/c_global/cfenv
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CFENV
 #define _GLIBCXX_CFENV 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cfloat b/libstdc++-v3/include/c_global/cfloat
index bc90e75ba5721ca704b853fc99a7e8260b3cd4a4..622aba833910390561d0bd31c7d1e70b90c04327 100644
--- a/libstdc++-v3/include/c_global/cfloat
+++ b/libstdc++-v3/include/c_global/cfloat
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CFLOAT
 #define _GLIBCXX_CFLOAT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <float.h>
diff --git a/libstdc++-v3/include/c_global/cinttypes b/libstdc++-v3/include/c_global/cinttypes
index a6f3dad5cccc1562f66190cf4702c4387711f0a9..6ab84e3f58609c7b142a13fd3de6e92d556072c8 100644
--- a/libstdc++-v3/include/c_global/cinttypes
+++ b/libstdc++-v3/include/c_global/cinttypes
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CINTTYPES
 #define _GLIBCXX_CINTTYPES 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/ciso646 b/libstdc++-v3/include/c_global/ciso646
index 5b039930056668a7ceb29a967bf53b86558b3bb6..6e26f9be12eb74880e4758976c23f641b22a7457 100644
--- a/libstdc++-v3/include/c_global/ciso646
+++ b/libstdc++-v3/include/c_global/ciso646
@@ -32,7 +32,10 @@
 #ifndef _GLIBCXX_CISO646
 #define _GLIBCXX_CISO646
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
+
 #endif
diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits
index ae1390bdc1d55a0647240f0cd5cdea08d85de7e8..5970a6cdb3bdaa2be91f0a09b5c12f2bda0c0c69 100644
--- a/libstdc++-v3/include/c_global/climits
+++ b/libstdc++-v3/include/c_global/climits
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CLIMITS
 #define _GLIBCXX_CLIMITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <limits.h>
diff --git a/libstdc++-v3/include/c_global/clocale b/libstdc++-v3/include/c_global/clocale
index b795f5759d117d234030aca25818f47af915629f..c9aeb7441753aa1fcdc7d3adad0ecf231b6752fd 100644
--- a/libstdc++-v3/include/c_global/clocale
+++ b/libstdc++-v3/include/c_global/clocale
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CLOCALE
 #define _GLIBCXX_CLOCALE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <locale.h>
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index 2b7186c8c27f2170a033a7f0b5105ad5f15c57c4..ca84f951400366794582f3de4c78e7a77a3c0b0a 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CMATH
 #define _GLIBCXX_CMATH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h>
 
diff --git a/libstdc++-v3/include/c_global/csetjmp b/libstdc++-v3/include/c_global/csetjmp
index 6b1a484d53935b97da571be043cf15076cd13baf..645d94d8ab1c4b2413708e1122dfcda92d737ca6 100644
--- a/libstdc++-v3/include/c_global/csetjmp
+++ b/libstdc++-v3/include/c_global/csetjmp
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSETJMP
 #define _GLIBCXX_CSETJMP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <setjmp.h>
diff --git a/libstdc++-v3/include/c_global/csignal b/libstdc++-v3/include/c_global/csignal
index dc8a3e00b29bd8d981396bb4f7bb6b911333cc9f..6f6613cbde42afd4815f54a187a45c975186ecd9 100644
--- a/libstdc++-v3/include/c_global/csignal
+++ b/libstdc++-v3/include/c_global/csignal
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSIGNAL
 #define _GLIBCXX_CSIGNAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <signal.h>
diff --git a/libstdc++-v3/include/c_global/cstdalign b/libstdc++-v3/include/c_global/cstdalign
index f7e4191380cc99c8571a60e47237127825a4ebbd..4f6105884258aba88ff567d27d37686a1ded01a5 100644
--- a/libstdc++-v3/include/c_global/cstdalign
+++ b/libstdc++-v3/include/c_global/cstdalign
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDALIGN
 #define _GLIBCXX_CSTDALIGN 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 #  include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cstdarg b/libstdc++-v3/include/c_global/cstdarg
index fd960c8ca4b7d6506ffb49221938ceddc720ec4b..f6c50f78ff105cf260573bddb2594844cdcaf807 100644
--- a/libstdc++-v3/include/c_global/cstdarg
+++ b/libstdc++-v3/include/c_global/cstdarg
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDARG
 #define _GLIBCXX_CSTDARG 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #undef __need___va_list
 #include <bits/c++config.h>
diff --git a/libstdc++-v3/include/c_global/cstdbool b/libstdc++-v3/include/c_global/cstdbool
index 5f4bc41739a4af0ef7f95306750a9b57180f9991..8d2e75df33f07476b105cb78dbe8f923d88f5e13 100644
--- a/libstdc++-v3/include/c_global/cstdbool
+++ b/libstdc++-v3/include/c_global/cstdbool
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDBOOL
 #define _GLIBCXX_CSTDBOOL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 #  include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef
index f49f56ae37296b7fa89d3f9d2baea971c0815359..19611f353994ec0a86539a3d001684591e3e8a02 100644
--- a/libstdc++-v3/include/c_global/cstddef
+++ b/libstdc++-v3/include/c_global/cstddef
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDDEF
 #define _GLIBCXX_CSTDDEF 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #undef __need_wchar_t
 #undef __need_ptrdiff_t
diff --git a/libstdc++-v3/include/c_global/cstdint b/libstdc++-v3/include/c_global/cstdint
index d31dc7550fa553d18b5295cea39105ced240470f..e2030824c410513022c1f23eeb84d0fe26baba1a 100644
--- a/libstdc++-v3/include/c_global/cstdint
+++ b/libstdc++-v3/include/c_global/cstdint
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CSTDINT
 #define _GLIBCXX_CSTDINT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
index 2b1f4fe78cd46a202f87c280ce8a9a00bce8cbbc..859b7a5b6ac791e28ccb03baaf53c00ecf141808 100644
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDIO
 #define _GLIBCXX_CSTDIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <stdio.h>
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 5d83bafc933217f0a7ad044fa5070f8bafd73c79..a5df4cd9cb11e4b287da80f9113871fa39a9ae9d 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDLIB
 #define _GLIBCXX_CSTDLIB 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c_global/cstring b/libstdc++-v3/include/c_global/cstring
index eba409fd6139d78b9fa39bcf924ef14ef6f18484..d679c77165b3b37b1a854428e45729f8bb9effd8 100644
--- a/libstdc++-v3/include/c_global/cstring
+++ b/libstdc++-v3/include/c_global/cstring
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTRING
 #define _GLIBCXX_CSTRING 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_freestanding_cstring
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/c_global/ctgmath b/libstdc++-v3/include/c_global/ctgmath
index 188a3107e40fb9679162fb12c8ca6222fa07aa2f..79c1a029f41d9726916f3f5913f1a6727d25ab86 100644
--- a/libstdc++-v3/include/c_global/ctgmath
+++ b/libstdc++-v3/include/c_global/ctgmath
@@ -26,7 +26,9 @@
  *  This is a Standard C++ Library header.
  */
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #ifndef _GLIBCXX_CTGMATH
 #define _GLIBCXX_CTGMATH 1
diff --git a/libstdc++-v3/include/c_global/ctime b/libstdc++-v3/include/c_global/ctime
index da16ba686db5f982ecc0c3c977b7f53cff238cd9..231de0dcf514f455106b035ba87a13e16b0fcc36 100644
--- a/libstdc++-v3/include/c_global/ctime
+++ b/libstdc++-v3/include/c_global/ctime
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CTIME
 #define _GLIBCXX_CTIME 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <time.h>
diff --git a/libstdc++-v3/include/c_global/cuchar b/libstdc++-v3/include/c_global/cuchar
index ebc3077c4eb6197a4fe12d9db8508bc2ef114e25..0b9f051f15dcc14c516f5c3eb6d5c907673a3203 100644
--- a/libstdc++-v3/include/c_global/cuchar
+++ b/libstdc++-v3/include/c_global/cuchar
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CUCHAR
 #define _GLIBCXX_CUCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
index fabe178429f0eb4a3ab6b52a74881ffc47db79a6..1bdb071002f3f7c86307e7ed125a290e4cba8bc0 100644
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CWCHAR
 #define _GLIBCXX_CWCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c_global/cwctype b/libstdc++-v3/include/c_global/cwctype
index 54c8572426a9510875c5353f40864d8267b97306..c6e8d239944ba24a003aa40e700a083eac1c7b18 100644
--- a/libstdc++-v3/include/c_global/cwctype
+++ b/libstdc++-v3/include/c_global/cwctype
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CWCTYPE
 #define _GLIBCXX_CWCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c_std/cassert b/libstdc++-v3/include/c_std/cassert
index 853cb91a0079cd6f4fc539df165bc5033037c7d0..5bd10ed6575f315ea897654ba9847f59188216a3 100644
--- a/libstdc++-v3/include/c_std/cassert
+++ b/libstdc++-v3/include/c_std/cassert
@@ -38,7 +38,9 @@
 
 // No include guards on this header...
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <assert.h>
diff --git a/libstdc++-v3/include/c_std/cctype b/libstdc++-v3/include/c_std/cctype
index 8ecf782270449f96bfd94cded304d84015c23f4b..aec3dd0e9b9f9bf7299cd3e5cbd6de6ea291bc25 100644
--- a/libstdc++-v3/include/c_std/cctype
+++ b/libstdc++-v3/include/c_std/cctype
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CCTYPE
 #define _GLIBCXX_CCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <ctype.h>
diff --git a/libstdc++-v3/include/c_std/cerrno b/libstdc++-v3/include/c_std/cerrno
index f68f8b3a437949cde1f45e3dc098d1eb2d17fdba..cb2c0f4d955350ac42c161933b50acd9dba76d8a 100644
--- a/libstdc++-v3/include/c_std/cerrno
+++ b/libstdc++-v3/include/c_std/cerrno
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CERRNO
 #define _GLIBCXX_CERRNO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <errno.h>
diff --git a/libstdc++-v3/include/c_std/cfloat b/libstdc++-v3/include/c_std/cfloat
index e7c1596c3ee05c36187910b2970b69a4c7d8b5ad..670bcc1eadaaa3cb507b72aa0aa75ecab0fedaaa 100644
--- a/libstdc++-v3/include/c_std/cfloat
+++ b/libstdc++-v3/include/c_std/cfloat
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CFLOAT
 #define _GLIBCXX_CFLOAT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <float.h>
diff --git a/libstdc++-v3/include/c_std/ciso646 b/libstdc++-v3/include/c_std/ciso646
index d69d4ca15f531cb4c930f856b6228ec1550f043a..7971f0d0c313697112facd0f4f8918bd3b50c29a 100644
--- a/libstdc++-v3/include/c_std/ciso646
+++ b/libstdc++-v3/include/c_std/ciso646
@@ -32,7 +32,9 @@
 #ifndef _GLIBCXX_CISO646
 #define _GLIBCXX_CISO646
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #endif
diff --git a/libstdc++-v3/include/c_std/climits b/libstdc++-v3/include/c_std/climits
index dc38b86950217be4b64af10d95e49cacdb2cef60..0976eb1fc157dc33769f94c7bf8d40a5dc50a608 100644
--- a/libstdc++-v3/include/c_std/climits
+++ b/libstdc++-v3/include/c_std/climits
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CLIMITS
 #define _GLIBCXX_CLIMITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <limits.h>
diff --git a/libstdc++-v3/include/c_std/clocale b/libstdc++-v3/include/c_std/clocale
index d43bddbbf1b25eb576aaf2febd4f363e77172d2e..da1d5bad2ce490004fe085ad851d8ac4ffd167b6 100644
--- a/libstdc++-v3/include/c_std/clocale
+++ b/libstdc++-v3/include/c_std/clocale
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CLOCALE
 #define _GLIBCXX_CLOCALE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <locale.h>
diff --git a/libstdc++-v3/include/c_std/cmath b/libstdc++-v3/include/c_std/cmath
index 76b04bd4a77b45c4bbfde9fef5206adc57dec26c..ff7a11ba9f252f23de17c62eccbd23b570e3e75c 100644
--- a/libstdc++-v3/include/c_std/cmath
+++ b/libstdc++-v3/include/c_std/cmath
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CMATH
 #define _GLIBCXX_CMATH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
diff --git a/libstdc++-v3/include/c_std/csetjmp b/libstdc++-v3/include/c_std/csetjmp
index 49cea5575bc93cf198fb869087be5f8dbcbdb457..bba568ffe84ec444eda39a6213f633d49824360e 100644
--- a/libstdc++-v3/include/c_std/csetjmp
+++ b/libstdc++-v3/include/c_std/csetjmp
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSETJMP
 #define _GLIBCXX_CSETJMP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <setjmp.h>
diff --git a/libstdc++-v3/include/c_std/csignal b/libstdc++-v3/include/c_std/csignal
index 08ce9a1a4f7754d83400da2d33d944b217d9ac01..b19d4b8444ff9ae72490f22fb06d0310cdd849b4 100644
--- a/libstdc++-v3/include/c_std/csignal
+++ b/libstdc++-v3/include/c_std/csignal
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSIGNAL
 #define _GLIBCXX_CSIGNAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <signal.h>
diff --git a/libstdc++-v3/include/c_std/cstdarg b/libstdc++-v3/include/c_std/cstdarg
index 65ddd28b619fa52adf96c72baa686b57839e8ee6..4c086954a863e5fc31d6036b3fe4bf19387dbc30 100644
--- a/libstdc++-v3/include/c_std/cstdarg
+++ b/libstdc++-v3/include/c_std/cstdarg
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDARG
 #define _GLIBCXX_CSTDARG 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <stdarg.h>
diff --git a/libstdc++-v3/include/c_std/cstddef b/libstdc++-v3/include/c_std/cstddef
index 8199fb93df53d3e4c2f2138683651460041b951d..2236d52f936e92aef27a47a37f14fe4b3c54de79 100644
--- a/libstdc++-v3/include/c_std/cstddef
+++ b/libstdc++-v3/include/c_std/cstddef
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDDEF
 #define _GLIBCXX_CSTDDEF 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <stddef.h>
diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio
index ee3ca3940e1a729e68cb1a90e63c41979c242df2..d57f2cfec5ddc8d4ab66c0e1bff562f543d1f244 100644
--- a/libstdc++-v3/include/c_std/cstdio
+++ b/libstdc++-v3/include/c_std/cstdio
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDIO
 #define _GLIBCXX_CSTDIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <stdio.h>
diff --git a/libstdc++-v3/include/c_std/cstdlib b/libstdc++-v3/include/c_std/cstdlib
index db39abf6cc550ae010982587c7926f947286a624..5da1739e07b433404b755e34f890ba2138d81921 100644
--- a/libstdc++-v3/include/c_std/cstdlib
+++ b/libstdc++-v3/include/c_std/cstdlib
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTDLIB
 #define _GLIBCXX_CSTDLIB 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c_std/cstring b/libstdc++-v3/include/c_std/cstring
index 5489dcd5d6e53774a044c98d03c3375a6b71bdb2..c043383fb383cf3bb9cc3281c48d4312718479a7 100644
--- a/libstdc++-v3/include/c_std/cstring
+++ b/libstdc++-v3/include/c_std/cstring
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CSTRING
 #define _GLIBCXX_CSTRING 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <string.h>
diff --git a/libstdc++-v3/include/c_std/ctime b/libstdc++-v3/include/c_std/ctime
index 9500823f178891a8ac6dc6135f264f45140590d0..b2c92ece18a10e72467c63eed138dcc824d3b1cf 100644
--- a/libstdc++-v3/include/c_std/ctime
+++ b/libstdc++-v3/include/c_std/ctime
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CTIME
 #define _GLIBCXX_CTIME 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <time.h>
diff --git a/libstdc++-v3/include/c_std/cuchar b/libstdc++-v3/include/c_std/cuchar
index 8aa0710c8a68850a8e9b14f4265695dd404d1558..7a3efd790b4165df4a0930fbdb9c2bcf82bb2f87 100644
--- a/libstdc++-v3/include/c_std/cuchar
+++ b/libstdc++-v3/include/c_std/cuchar
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CUCHAR
 #define _GLIBCXX_CUCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar
index a16cdf9c01880178f7920be7afbe26e5f8a127d8..6608f40307b87c3fb846ccb50177b458fe54ba2a 100644
--- a/libstdc++-v3/include/c_std/cwchar
+++ b/libstdc++-v3/include/c_std/cwchar
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CWCHAR
 #define _GLIBCXX_CWCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/c_std/cwctype b/libstdc++-v3/include/c_std/cwctype
index ab63bcf0efc953dd660d4534bedc6b68ddb251f2..ae90a340d5481dfa553028fa0b483868b10256a0 100644
--- a/libstdc++-v3/include/c_std/cwctype
+++ b/libstdc++-v3/include/c_std/cwctype
@@ -39,7 +39,9 @@
 #ifndef _GLIBCXX_CWCTYPE
 #define _GLIBCXX_CWCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index 9cb3aca5998dd6447c1dafd0294c1987d3cc1563..8931f0eadf93853504530e79fd4845f923d5ad41 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_ARRAY
 #define _GLIBCXX_DEBUG_ARRAY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <array>
 
diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset
index a0d62f52822c82dc5613ec2136b6bf290bc4b55a..f464a641999406c5d7701d8b26ec61761f9088cc 100644
--- a/libstdc++-v3/include/debug/bitset
+++ b/libstdc++-v3/include/debug/bitset
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_BITSET
 #define _GLIBCXX_DEBUG_BITSET
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bitset>
 #include <debug/safe_sequence.h>
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 3c642152ce8a2bdb322a637c3e3503f23cf907f5..8f15ea5030973b0a8bc9751358d053a628e2c88e 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_DEQUE
 #define _GLIBCXX_DEBUG_DEQUE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list
index ff793f28c21369294108656d0a0ccd2f2e004f16..3f94a9098e86d6e5aeb4b219cd4152bbb74f9974 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_FORWARD_LIST
 #define _GLIBCXX_DEBUG_FORWARD_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index e010a69bf3637057daed522e0b1920b81ada4095..60752b4dc8b1958563d762a19de1c426f40e52ac 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_LIST
 #define _GLIBCXX_DEBUG_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/debug/map b/libstdc++-v3/include/debug/map
index 60ca4bd011ae4dcbfab392acaffe780743673874..3d8406c4b4552ab37dfba2120e0ba8ecaa0c9184 100644
--- a/libstdc++-v3/include/debug/map
+++ b/libstdc++-v3/include/debug/map
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_MAP
 #define _GLIBCXX_DEBUG_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/debug/set b/libstdc++-v3/include/debug/set
index 40e7bc89922dc728d2c7313148c2cfcdefc22038..0eaf54e7ef77f6f15a82c1ca363ba753b20fb4c7 100644
--- a/libstdc++-v3/include/debug/set
+++ b/libstdc++-v3/include/debug/set
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_SET
 #define _GLIBCXX_DEBUG_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 0d39a97a53096302ca9f6623247f6c8e0579817f..1b245dbdfc4ef4bbfb00ad980560161ce4dafffe 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_STRING
 #define _GLIBCXX_DEBUG_STRING 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <string>
 #include <debug/safe_sequence.h>
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 8a969d817402fca90cf8fde43a74e81559ae2420..1acafd8facea6e4f0d674eb9cc2d870c7ba58d9b 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_UNORDERED_MAP
 #define _GLIBCXX_DEBUG_UNORDERED_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index f6a8b66aff93adb214ff47d624914faf25d0ed77..7f199a93d2b4866c1d22d01898f15162a87499c6 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_UNORDERED_SET
 #define _GLIBCXX_DEBUG_UNORDERED_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 216822975a2f95abe5c6085a994ea331281c75af..fe43a372485d63dd832064e08f0d7ae9a4e3144d 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_DEBUG_VECTOR
 #define _GLIBCXX_DEBUG_VECTOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug {
diff --git a/libstdc++-v3/include/decimal/decimal b/libstdc++-v3/include/decimal/decimal
index a64ddde4756d758436c086901be5d3c77c6064dc..1d9e0340d7c291a39761ad329dc5c79a80326931 100644
--- a/libstdc++-v3/include/decimal/decimal
+++ b/libstdc++-v3/include/decimal/decimal
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_DECIMAL
 #define _GLIBCXX_DECIMAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // DF suffix
diff --git a/libstdc++-v3/include/decimal/decimal.h b/libstdc++-v3/include/decimal/decimal.h
index 99376a60cdf6fe4eeb7b983245d24fca7d97c071..36557b22348eba31afb378eb638cd88f35aad5f2 100644
--- a/libstdc++-v3/include/decimal/decimal.h
+++ b/libstdc++-v3/include/decimal/decimal.h
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_DECIMAL_IMPL
 #define _GLIBCXX_DECIMAL_IMPL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/experimental/algorithm b/libstdc++-v3/include/experimental/algorithm
index 1953dabfebaa5c5de85a553df6be9ebd55a68609..49403c907ee5e55a58d439c799d2db3a6094cd9c 100644
--- a/libstdc++-v3/include/experimental/algorithm
+++ b/libstdc++-v3/include/experimental/algorithm
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_ALGORITHM
 #define _GLIBCXX_EXPERIMENTAL_ALGORITHM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 3db30df5c75ef3e9c67b8df3551f915419e23cec..79b626824fe1335837a097dda70a7a364baf5d5e 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_ANY
 #define _GLIBCXX_EXPERIMENTAL_ANY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array
index bb46e0f49a2386a69e4e03a7470e46c1d5a83f2b..14a2e6ee1381673efe95c7e952893d4c15a9afdb 100644
--- a/libstdc++-v3/include/experimental/array
+++ b/libstdc++-v3/include/experimental/array
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_ARRAY
 #define _GLIBCXX_EXPERIMENTAL_ARRAY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/bits/net.h b/libstdc++-v3/include/experimental/bits/net.h
index 9697069bb701fd61e4a7603c0c89e56988ed5e98..d536d865be4db93f543fd2749c61bad7f4ea8b24 100644
--- a/libstdc++-v3/include/experimental/bits/net.h
+++ b/libstdc++-v3/include/experimental/bits/net.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_NET_H
 #define _GLIBCXX_EXPERIMENTAL_NET_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201402L
 
diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h
index f30d9a7400625320b842b924b3c3d706081da879..9a5659c682b89b9ec211aa48ed9f511bcab51abe 100644
--- a/libstdc++-v3/include/experimental/bits/shared_ptr.h
+++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H
 #define _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201402L
 
diff --git a/libstdc++-v3/include/experimental/bits/string_view.tcc b/libstdc++-v3/include/experimental/bits/string_view.tcc
index 80de34d7dd40bd073c30955842829528970c8575..c0e1ab56d5e3ccd6774103ba26cee9cd4af651f3 100644
--- a/libstdc++-v3/include/experimental/bits/string_view.tcc
+++ b/libstdc++-v3/include/experimental/bits/string_view.tcc
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
 #define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201402L
 
diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer
index 054150e202a0a5e4ff7493cde5614a130a48781b..87137dca25c606c139988399de6328c09d752f2d 100644
--- a/libstdc++-v3/include/experimental/buffer
+++ b/libstdc++-v3/include/experimental/buffer
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_BUFFER
 #define _GLIBCXX_EXPERIMENTAL_BUFFER 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/chrono b/libstdc++-v3/include/experimental/chrono
index c5395ca21e9a58d527be26586af9cac805eeb011..61ca839ba79f0d90878412246d969e5eb87544c8 100644
--- a/libstdc++-v3/include/experimental/chrono
+++ b/libstdc++-v3/include/experimental/chrono
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_CHRONO
 #define _GLIBCXX_EXPERIMENTAL_CHRONO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/contract b/libstdc++-v3/include/experimental/contract
index 84f4433231f3615cab28020931339e2fa09f0cec..98d42ba1386de6b6cf78a17e2bc21a8bb25335e9 100644
--- a/libstdc++-v3/include/experimental/contract
+++ b/libstdc++-v3/include/experimental/contract
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CONTRACT
 #define _GLIBCXX_CONTRACT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201703L
 
diff --git a/libstdc++-v3/include/experimental/deque b/libstdc++-v3/include/experimental/deque
index de5d46c1320c40334b8f173c0f907d7555cdf40c..3ee39dea7b830ebe00aaeb35dfb7bb25e65412bb 100644
--- a/libstdc++-v3/include/experimental/deque
+++ b/libstdc++-v3/include/experimental/deque
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_DEQUE
 #define _GLIBCXX_EXPERIMENTAL_DEQUE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
index f64783b44c9ecbdcd81f1f541696c70e8c1c3e6f..cce53478199410eff430de05f02cd33bdd264ea9 100644
--- a/libstdc++-v3/include/experimental/executor
+++ b/libstdc++-v3/include/experimental/executor
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_EXECUTOR
 #define _GLIBCXX_EXPERIMENTAL_EXECUTOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/filesystem b/libstdc++-v3/include/experimental/filesystem
index 82df0759db5b98426c30e73e8a540d8346751bf5..182b148406f6a028d6465ca9f1bde06cffff12c3 100644
--- a/libstdc++-v3/include/experimental/filesystem
+++ b/libstdc++-v3/include/experimental/filesystem
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_FILESYSTEM
 #define _GLIBCXX_EXPERIMENTAL_FILESYSTEM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/forward_list b/libstdc++-v3/include/experimental/forward_list
index 35d50f4982be90f7421ba819016e1af42112d55e..e1e3b03eaead374330b6bfd0692a938be806f3b8 100644
--- a/libstdc++-v3/include/experimental/forward_list
+++ b/libstdc++-v3/include/experimental/forward_list
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_FORWARD_LIST
 #define _GLIBCXX_EXPERIMENTAL_FORWARD_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/functional b/libstdc++-v3/include/experimental/functional
index b14517346311447071de44106c955c056a3f750c..cf420af39ce696e7772b96507463f21487276ba8 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_FUNCTIONAL
 #define _GLIBCXX_EXPERIMENTAL_FUNCTIONAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 3f5090cfa70c4468cb05ea160e07b8c6d5d64652..d6b1319adca68e69f2457da2742240d2ddb35a91 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_INTERNET
 #define _GLIBCXX_EXPERIMENTAL_INTERNET
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/io_context b/libstdc++-v3/include/experimental/io_context
index 8b0dba7d5fa601170e0d775e2a59077b3d2e3785..3bcc145f98a6073e863fe6897d42c20046ad9151 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_IO_SERVICE
 #define _GLIBCXX_EXPERIMENTAL_IO_SERVICE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/iterator b/libstdc++-v3/include/experimental/iterator
index 51ecd29f5a3ba6f4f20a5af76ce776bb5dc64ff9..96dfe84de2ad7989aa500adb74819679a43ae7a5 100644
--- a/libstdc++-v3/include/experimental/iterator
+++ b/libstdc++-v3/include/experimental/iterator
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_ITERATOR
 #define _GLIBCXX_EXPERIMENTAL_ITERATOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/list b/libstdc++-v3/include/experimental/list
index 5bebf3cb0aa6424a37638f49887ec38374f0004a..27c9dfd505137436de8f2e03533686681b7c5ecd 100644
--- a/libstdc++-v3/include/experimental/list
+++ b/libstdc++-v3/include/experimental/list
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_LIST
 #define _GLIBCXX_EXPERIMENTAL_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/map b/libstdc++-v3/include/experimental/map
index 414c02361c98faac6f20fb191ab5a67a26f9f10d..3f0f533f5775d59a6ca2c35308957a31264219db 100644
--- a/libstdc++-v3/include/experimental/map
+++ b/libstdc++-v3/include/experimental/map
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_MAP
 #define _GLIBCXX_EXPERIMENTAL_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index ca6a3648e0d65625e0cd30daab9d60ff5e42e391..0f8f1b8eb0b30705db9905bfc0db2ae1f9967462 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_MEMORY
 #define _GLIBCXX_EXPERIMENTAL_MEMORY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource
index bc2fdbf082ea005966f8d18d05f63cc5a58fca4b..c36bb8884c2bf3dd72dcc0d45d06b5b439955be2 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE
 #define _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/net b/libstdc++-v3/include/experimental/net
index a84fdf4c100ebea4ba3e1f3f569edd6674cfebbe..90c604c7b5e67435b4ee30409a818a0ff19fd6d2 100644
--- a/libstdc++-v3/include/experimental/net
+++ b/libstdc++-v3/include/experimental/net
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_NET
 #define _GLIBCXX_EXPERIMENTAL_NET
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/netfwd b/libstdc++-v3/include/experimental/netfwd
index e27381001890f67722f5ba3f9382a98c8b50d8ac..17f8676c87fdc812db3e03d70617f01d3d080c6e 100644
--- a/libstdc++-v3/include/experimental/netfwd
+++ b/libstdc++-v3/include/experimental/netfwd
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_NETFWD
 #define _GLIBCXX_EXPERIMENTAL_NETFWD 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/numeric b/libstdc++-v3/include/experimental/numeric
index 42580b7d214138f6da5468b2bd2537a0d7a16195..7f06d56f38aec3f616f82c347758466776f098f0 100644
--- a/libstdc++-v3/include/experimental/numeric
+++ b/libstdc++-v3/include/experimental/numeric
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_NUMERIC
 #define _GLIBCXX_EXPERIMENTAL_NUMERIC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const
index a3682aeb6c047d6f20a22046d304b780cb1dd7ea..829a82dd86eb7c9b52781f1eaa77d6c9772897fb 100644
--- a/libstdc++-v3/include/experimental/propagate_const
+++ b/libstdc++-v3/include/experimental/propagate_const
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST
 #define _GLIBCXX_EXPERIMENTAL_PROPAGATE_CONST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/ratio b/libstdc++-v3/include/experimental/ratio
index 5b96e728e11ad47fd88796e59d9cd4862c9f4b60..1325beaf0e270d725071b68cf590d55d51e63c82 100644
--- a/libstdc++-v3/include/experimental/ratio
+++ b/libstdc++-v3/include/experimental/ratio
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_RATIO
 #define _GLIBCXX_EXPERIMENTAL_RATIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/regex b/libstdc++-v3/include/experimental/regex
index d04dc1e954e8c7c6ceb27b4ac8194d0bf799b315..3c7802c6683d277f2f1ea744138c99ed847f46ff 100644
--- a/libstdc++-v3/include/experimental/regex
+++ b/libstdc++-v3/include/experimental/regex
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_REGEX
 #define _GLIBCXX_EXPERIMENTAL_REGEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/scope b/libstdc++-v3/include/experimental/scope
index ea273e8c095f2168544ca7fc22bb0014c27c66b5..6e1d342e1b6486b0d1f32166c7eb91d29ed79f4d 100644
--- a/libstdc++-v3/include/experimental/scope
+++ b/libstdc++-v3/include/experimental/scope
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SCOPE
 #define _GLIBCXX_EXPERIMENTAL_SCOPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/set b/libstdc++-v3/include/experimental/set
index 4ccbf6fdaf06890e17724875c0dcff046cb13b42..6758119acd05247072a7ecb31f8a24aa78140b35 100644
--- a/libstdc++-v3/include/experimental/set
+++ b/libstdc++-v3/include/experimental/set
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SET
 #define _GLIBCXX_EXPERIMENTAL_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index 62beb43d269c9e28de35af845a859c963f1474b8..8fb9c032e6c6646933512cfa28e4e3dc1198f8c2 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SOCKET
 #define _GLIBCXX_EXPERIMENTAL_SOCKET
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/string b/libstdc++-v3/include/experimental/string
index d6b18b99b6f515d485fda5ae9ff8e9e86c4f90c6..8ab604135f9352d752e11c26947464231eb01192 100644
--- a/libstdc++-v3/include/experimental/string
+++ b/libstdc++-v3/include/experimental/string
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_STRING
 #define _GLIBCXX_EXPERIMENTAL_STRING 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view
index 4eb1a84afcec8f6cafcd278352363c55b4d3ce4d..8929748b8a8595aa1788328efbb7559331e8d73b 100644
--- a/libstdc++-v3/include/experimental/string_view
+++ b/libstdc++-v3/include/experimental/string_view
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW
 #define _GLIBCXX_EXPERIMENTAL_STRING_VIEW 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/synchronized_value b/libstdc++-v3/include/experimental/synchronized_value
index 9a91da912ca128857f2d3f1bd319187d3b7bbc7e..93755e7c3f4e8c38b3747c3c867741d6668dc398 100644
--- a/libstdc++-v3/include/experimental/synchronized_value
+++ b/libstdc++-v3/include/experimental/synchronized_value
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SYNCVAL
 #define _GLIBCXX_EXPERIMENTAL_SYNCVAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // for std::mutex
 
diff --git a/libstdc++-v3/include/experimental/system_error b/libstdc++-v3/include/experimental/system_error
index 491b9dcf99d4cb0e48a8d1e9ed2940e6aa61498f..913995a1388d0c9fb0dd078e7c665e35a8d48729 100644
--- a/libstdc++-v3/include/experimental/system_error
+++ b/libstdc++-v3/include/experimental/system_error
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR
 #define _GLIBCXX_EXPERIMENTAL_SYSTEM_ERROR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/timer b/libstdc++-v3/include/experimental/timer
index 8d6e328129467c7c6d63b5057d684f118874b838..1b60f70a38cc61b5a0cd2c1823b1d229f0f7c629 100644
--- a/libstdc++-v3/include/experimental/timer
+++ b/libstdc++-v3/include/experimental/timer
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_TIMER
 #define _GLIBCXX_EXPERIMENTAL_TIMER 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple
index f67f738b0e2dafe178c624c4803238559f1e762f..c38eb4ba56dadcd72f8acc1ca7dec549a9278eff 100644
--- a/libstdc++-v3/include/experimental/tuple
+++ b/libstdc++-v3/include/experimental/tuple
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_TUPLE
 #define _GLIBCXX_EXPERIMENTAL_TUPLE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits
index 3fa88a30997b114001cf0c7d492035ba2671510b..25bb217442072cc9d3090d803b05adf60bc6f3c0 100644
--- a/libstdc++-v3/include/experimental/type_traits
+++ b/libstdc++-v3/include/experimental/type_traits
@@ -41,7 +41,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
 #define _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201402L
 
diff --git a/libstdc++-v3/include/experimental/unordered_map b/libstdc++-v3/include/experimental/unordered_map
index c94bd2cd807ca0ed00d60b22a868fcca7f250bc6..06a439a107870ba3b55abb0c42ab920f50ec0df4 100644
--- a/libstdc++-v3/include/experimental/unordered_map
+++ b/libstdc++-v3/include/experimental/unordered_map
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_UNORDERED_MAP
 #define _GLIBCXX_EXPERIMENTAL_UNORDERED_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/unordered_set b/libstdc++-v3/include/experimental/unordered_set
index 128312c9e95b05c061698dc79c08c2078c5086a8..e752740e2e814f1393ca545cf2f632762a1820ff 100644
--- a/libstdc++-v3/include/experimental/unordered_set
+++ b/libstdc++-v3/include/experimental/unordered_set
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_UNORDERED_SET
 #define _GLIBCXX_EXPERIMENTAL_UNORDERED_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/experimental/vector b/libstdc++-v3/include/experimental/vector
index a51fdca539bf4d548fde844051b4f7a310ac406f..badfe681624efc2590db4a72843737bc462dfff2 100644
--- a/libstdc++-v3/include/experimental/vector
+++ b/libstdc++-v3/include/experimental/vector
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_EXPERIMENTAL_VECTOR
 #define _GLIBCXX_EXPERIMENTAL_VECTOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // experimental is currently omitted
 
diff --git a/libstdc++-v3/include/ext/algorithm b/libstdc++-v3/include/ext/algorithm
index a7324fd85e277cbad9c89257c30b88f814745996..4d70dff69fd384cc0b702faefe323cc6bcc41079 100644
--- a/libstdc++-v3/include/ext/algorithm
+++ b/libstdc++-v3/include/ext/algorithm
@@ -56,7 +56,9 @@
 #ifndef _EXT_ALGORITHM
 #define _EXT_ALGORITHM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/aligned_buffer.h b/libstdc++-v3/include/ext/aligned_buffer.h
index 9c2c628e54a9620176a9aacfe76e80cb38228a8b..25f9b25a17eeea64709e9c4b980404211d9346ac 100644
--- a/libstdc++-v3/include/ext/aligned_buffer.h
+++ b/libstdc++-v3/include/ext/aligned_buffer.h
@@ -29,7 +29,9 @@
 #ifndef _ALIGNED_BUFFER_H
 #define _ALIGNED_BUFFER_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201103L
 # include <type_traits>
diff --git a/libstdc++-v3/include/ext/alloc_traits.h b/libstdc++-v3/include/ext/alloc_traits.h
index f778c4d3ba91eaf42d957180e25f3f9ef5a00827..d2560531bac86e5a5fc01ca554e4aeadba4842c6 100644
--- a/libstdc++-v3/include/ext/alloc_traits.h
+++ b/libstdc++-v3/include/ext/alloc_traits.h
@@ -29,7 +29,9 @@
 #ifndef _EXT_ALLOC_TRAITS_H
 #define _EXT_ALLOC_TRAITS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 # include <bits/alloc_traits.h>
 
diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h
index cc2fe3b28bc5c6bc730625923d8989a9f80fdaef..964a63438d32f2f73c8ed6f29789c30ef0b1fe13 100644
--- a/libstdc++-v3/include/ext/atomicity.h
+++ b/libstdc++-v3/include/ext/atomicity.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_ATOMICITY_H
 #define _GLIBCXX_ATOMICITY_H	1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/gthr.h>
diff --git a/libstdc++-v3/include/ext/cmath b/libstdc++-v3/include/ext/cmath
index a180916c646062758b4c1287d8a427473921d2d2..d4bab41aef029671a7ada5c7c557ff10648488d8 100644
--- a/libstdc++-v3/include/ext/cmath
+++ b/libstdc++-v3/include/ext/cmath
@@ -29,7 +29,9 @@
 #ifndef _EXT_CMATH
 #define _EXT_CMATH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h
index 8188c1366b0b97f81e2c328f9bf8cfa0852a44d0..8191e7abe0466198d8034c65084d0aa2339aa3f5 100644
--- a/libstdc++-v3/include/ext/concurrence.h
+++ b/libstdc++-v3/include/ext/concurrence.h
@@ -29,7 +29,9 @@
 #ifndef _CONCURRENCE_H
 #define _CONCURRENCE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <exception>
 #include <bits/gthr.h> 
diff --git a/libstdc++-v3/include/ext/functional b/libstdc++-v3/include/ext/functional
index bc8312a3370e399b84be1a7375137ffc605f5282..dfc297dc0cfb84f552bd08fdcf1a2e16acd09e36 100644
--- a/libstdc++-v3/include/ext/functional
+++ b/libstdc++-v3/include/ext/functional
@@ -56,7 +56,9 @@
 #ifndef _EXT_FUNCTIONAL
 #define _EXT_FUNCTIONAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/iterator b/libstdc++-v3/include/ext/iterator
index d3e5e7edfabd54a9358d3a71c664cea6d3395f2c..24df891a77312644e85596bf56c7ab166007f56c 100644
--- a/libstdc++-v3/include/ext/iterator
+++ b/libstdc++-v3/include/ext/iterator
@@ -56,7 +56,9 @@
 #ifndef _EXT_ITERATOR
 #define _EXT_ITERATOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/concept_check.h>
 #include <iterator>
diff --git a/libstdc++-v3/include/ext/memory b/libstdc++-v3/include/ext/memory
index ebbebb673be34d5360d146f03e5cb0bf8963ab17..363cf691ff4f9c370b4f2b386f378283b8f8b3fe 100644
--- a/libstdc++-v3/include/ext/memory
+++ b/libstdc++-v3/include/ext/memory
@@ -56,7 +56,9 @@
 #ifndef _EXT_MEMORY
 #define _EXT_MEMORY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/numeric b/libstdc++-v3/include/ext/numeric
index 1123694e6865ddeeb58b64a020b74537d941548c..797341c97612dd55f10bc300cb80c6f3f8c44de8 100644
--- a/libstdc++-v3/include/ext/numeric
+++ b/libstdc++-v3/include/ext/numeric
@@ -56,7 +56,9 @@
 #ifndef _EXT_NUMERIC
 #define _EXT_NUMERIC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/numeric_traits.h b/libstdc++-v3/include/ext/numeric_traits.h
index b2723bfabfa59bceedc58e875070cc422eda5904..91fe18ea548e9448229bedb7ec807eafc404f6d4 100644
--- a/libstdc++-v3/include/ext/numeric_traits.h
+++ b/libstdc++-v3/include/ext/numeric_traits.h
@@ -29,7 +29,9 @@
 #ifndef _EXT_NUMERIC_TRAITS
 #define _EXT_NUMERIC_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
diff --git a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
index 52c83296e62f222c04179457967abcec72303873..8fdec6d575495c2c9df8e2151e7ed34aa942f34e 100644
--- a/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
+++ b/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
@@ -40,7 +40,9 @@
 
 #ifdef PB_DS_CLASS_C_DEC
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace detail
 {
diff --git a/libstdc++-v3/include/ext/pod_char_traits.h b/libstdc++-v3/include/ext/pod_char_traits.h
index 5f60d8a82a9f341bf671d06315c96a8b936fcc3c..83386c85680860bf1a8332cde9975659da9f9ef3 100644
--- a/libstdc++-v3/include/ext/pod_char_traits.h
+++ b/libstdc++-v3/include/ext/pod_char_traits.h
@@ -32,7 +32,9 @@
 #ifndef _POD_CHAR_TRAITS_H
 #define _POD_CHAR_TRAITS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index 0ead6f53d5f56caa9f15c1b5907122c99eb447e4..ab3016e225db41f2398ec74dbed7f20774fa2365 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -36,7 +36,9 @@
 #ifndef _POINTER_H
 #define _POINTER_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if _GLIBCXX_HOSTED
 #  include <iosfwd>
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 01957599f2fb81a24a62083d6530d5d96cf7f59e..d3f0cc11131690bcbf63cae2fc73490c1abd65a0 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -29,7 +29,9 @@
 #ifndef _EXT_RANDOM
 #define _EXT_RANDOM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index c6c3fbeec83f178bb38e2d2925c4373fb9ae7f1b..822b52f5f8afd30f611b1ada3e1904a70e1b3578 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -30,7 +30,9 @@
 #ifndef _EXT_RANDOM_TCC
 #define _EXT_RANDOM_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/rb_tree b/libstdc++-v3/include/ext/rb_tree
index dc1c9f52672be52959b036201424ee4106301cba..308225dddca6dd8a2a4fb52365eb2aacede0435a 100644
--- a/libstdc++-v3/include/ext/rb_tree
+++ b/libstdc++-v3/include/ext/rb_tree
@@ -56,7 +56,9 @@
 #ifndef _RB_TREE
 #define _RB_TREE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index 19199e82806796feed558f41cc1a70754dee201c..fabc0eedfbad55ab752a12a61df6d7935bee1a3a 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -43,7 +43,9 @@
 #ifndef _ROPE
 #define _ROPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/stdio_filebuf.h b/libstdc++-v3/include/ext/stdio_filebuf.h
index 1f9713bcd1565628455b3b998027b363d5de943b..4a09569494296d84cee42e1c9c4c434d9d93e4d0 100644
--- a/libstdc++-v3/include/ext/stdio_filebuf.h
+++ b/libstdc++-v3/include/ext/stdio_filebuf.h
@@ -29,7 +29,9 @@
 #ifndef _STDIO_FILEBUF_H
 #define _STDIO_FILEBUF_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/stdio_sync_filebuf.h b/libstdc++-v3/include/ext/stdio_sync_filebuf.h
index f8993ad521abefdc6125a84c3983e1a5752f2473..0f5381d9cb562629e926410b4831ae6b955eef4d 100644
--- a/libstdc++-v3/include/ext/stdio_sync_filebuf.h
+++ b/libstdc++-v3/include/ext/stdio_sync_filebuf.h
@@ -29,7 +29,9 @@
 #ifndef _STDIO_SYNC_FILEBUF_H
 #define _STDIO_SYNC_FILEBUF_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/string_conversions.h b/libstdc++-v3/include/ext/string_conversions.h
index 2e0755a772e1665af6c68c669d4c6e13d94b1861..acbe11fa37bb716f57b6470c9efd2020086edd93 100644
--- a/libstdc++-v3/include/ext/string_conversions.h
+++ b/libstdc++-v3/include/ext/string_conversions.h
@@ -29,7 +29,9 @@
 #ifndef _STRING_CONVERSIONS_H
 #define _STRING_CONVERSIONS_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/type_traits.h b/libstdc++-v3/include/ext/type_traits.h
index 165e1b43da00b391010fd883c109c494eb092b2e..651dfd62f3beaa1d9473ee3fff6bb5d6ba75b92b 100644
--- a/libstdc++-v3/include/ext/type_traits.h
+++ b/libstdc++-v3/include/ext/type_traits.h
@@ -29,7 +29,9 @@
 #ifndef _EXT_TYPE_TRAITS
 #define _EXT_TYPE_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/cpp_type_traits.h>
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index 25a7d82bf6d86171537e070519efc923f0f349e5..22b9a1db84298ab95b1d4e70829f01b51993ffae 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -29,7 +29,9 @@
 #ifndef _VSTRING_H
 #define _VSTRING_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/vstring.tcc b/libstdc++-v3/include/ext/vstring.tcc
index 86fcfaa5758c9c576089356545fa2b1ecedb9ed3..39837d5cbf8024a7ec8612714d5cdb1bd88018ea 100644
--- a/libstdc++-v3/include/ext/vstring.tcc
+++ b/libstdc++-v3/include/ext/vstring.tcc
@@ -30,7 +30,9 @@
 #ifndef _VSTRING_TCC
 #define _VSTRING_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/vstring_fwd.h b/libstdc++-v3/include/ext/vstring_fwd.h
index f6b6a6f54ca5cc8e7ad9f28536758c4a9e4fc225..8c646045c6b335ea9780af90165752f2cf6232d9 100644
--- a/libstdc++-v3/include/ext/vstring_fwd.h
+++ b/libstdc++-v3/include/ext/vstring_fwd.h
@@ -30,7 +30,9 @@
 #ifndef _VSTRING_FWD_H
 #define _VSTRING_FWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/ext/vstring_util.h b/libstdc++-v3/include/ext/vstring_util.h
index 364814182f8ec021068c05f7c04b7fd4b5ac8801..8c9c5acaaa9e3a01f782e091e233d97ceeeb0d9a 100644
--- a/libstdc++-v3/include/ext/vstring_util.h
+++ b/libstdc++-v3/include/ext/vstring_util.h
@@ -30,7 +30,9 @@
 #ifndef _VSTRING_UTIL_H
 #define _VSTRING_UTIL_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // GNU extensions are currently omitted
 
diff --git a/libstdc++-v3/include/parallel/algorithm b/libstdc++-v3/include/parallel/algorithm
index dc73187c88fa68e175bdd0e53288ac8c92ccca13..b2606fe2914f383e19d731f34b5004cb3d1d5cfb 100644
--- a/libstdc++-v3/include/parallel/algorithm
+++ b/libstdc++-v3/include/parallel/algorithm
@@ -29,7 +29,9 @@
 #ifndef _PARALLEL_ALGORITHM
 #define _PARALLEL_ALGORITHM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <algorithm>
 #include <parallel/algorithmfwd.h>
diff --git a/libstdc++-v3/include/parallel/algorithmfwd.h b/libstdc++-v3/include/parallel/algorithmfwd.h
index d8d5c85413ad72e18657f5f5af19d584c2db207d..476072b860ab0bc0e07183d382f950fe634cd2ea 100644
--- a/libstdc++-v3/include/parallel/algorithmfwd.h
+++ b/libstdc++-v3/include/parallel/algorithmfwd.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_PARALLEL_ALGORITHMFWD_H
 #define _GLIBCXX_PARALLEL_ALGORITHMFWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <parallel/tags.h>
 #include <parallel/settings.h>
diff --git a/libstdc++-v3/include/parallel/numericfwd.h b/libstdc++-v3/include/parallel/numericfwd.h
index 05af27aeedc8dae023096e9e2930409ac494e918..7f264867cbbd6a92a35f2c80765d14206aa12378 100644
--- a/libstdc++-v3/include/parallel/numericfwd.h
+++ b/libstdc++-v3/include/parallel/numericfwd.h
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_PARALLEL_NUMERICFWD_H
 #define _GLIBCXX_PARALLEL_NUMERICFWD_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <parallel/tags.h>
 #include <parallel/settings.h>
diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index b410e7c281b50d0592dc4cc6954d9c433b2283ca..0b1b72b6be223a9707453c0cf02f269f00f62938 100644
--- a/libstdc++-v3/include/std/algorithm
+++ b/libstdc++-v3/include/std/algorithm
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_ALGORITHM
 #define _GLIBCXX_ALGORITHM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/stl_algobase.h>
 #include <bits/stl_algo.h>
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index d24260eaacea4e566f6fbc352c90ef63b82acb4b..812d80110dcdebe6b728a1ba196b78faecbf403c 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_ANY
 #define _GLIBCXX_ANY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_any
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index 8710bf75924bedec88e713dc28e1f6496f98a533..172b3203ccd695873ff374867fef5e0d20d6ba96 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_ARRAY
 #define _GLIBCXX_ARRAY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 36ff89a146c43ee37936b82f1bc22cf6917cefcf..37fd7103bd9d344cccb831c7dc0a490dbe3f8cbb 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -32,7 +32,9 @@
 #ifndef _GLIBCXX_ATOMIC
 #define _GLIBCXX_ATOMIC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/barrier b/libstdc++-v3/include/std/barrier
index ccc89fbd6614d76d5d1613c41906c799f2d964d9..f926651713fdf0c1eeb5b71b660a99a64d04eaaa 100644
--- a/libstdc++-v3/include/std/barrier
+++ b/libstdc++-v3/include/std/barrier
@@ -38,7 +38,9 @@
 #ifndef _GLIBCXX_BARRIER
 #define _GLIBCXX_BARRIER 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // threading primitive
 
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 3e07dd7907f25256b33b8b6a94a7a83fa1756868..a5d50a44e07988989d72322c807f25ab3f27ee18 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_BIT
 #define _GLIBCXX_BIT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus >= 201402L
 
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 2e82a0e289d51739f449116e94e351564aabd930..1d0483fff08644eebc81fe8af29a787d61e3c82b 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -42,7 +42,9 @@
 #ifndef _GLIBCXX_BITSET
 #define _GLIBCXX_BITSET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/functexcept.h>   // For invalid_argument, out_of_range,
                                 // overflow_error
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index de671393b88ec82b0d3f8be4662891393090265e..5a23ab6ca0b695e2e487c5065b7888a138f321ad 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CHARCONV
 #define _GLIBCXX_CHARCONV 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // __int128
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index aa78254dac917827fa511b0623dc12e6e47374ad..013b5f7added5fcf3ce86ab002c17d49c7618f34 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CHRONO
 #define _GLIBCXX_CHRONO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #ifdef _GLIBCXX_NO_FREESTANDING_CHRONO
 # include <bits/requires_hosted.h> // for <ctime> and clocks
diff --git a/libstdc++-v3/include/std/codecvt b/libstdc++-v3/include/std/codecvt
index 311f902efaffca4a17347ae9e47f14e5921c02e6..863bb6ffbcc676e152d1a5b7bd0bd429c01875eb 100644
--- a/libstdc++-v3/include/std/codecvt
+++ b/libstdc++-v3/include/std/codecvt
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_CODECVT
 #define _GLIBCXX_CODECVT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index c688d0cb7284aacf03362ba04af10dcc33b5064f..5bc6618f7de0a4404ba958e24bd8f2461abfdf52 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -36,7 +36,9 @@
 #ifndef _GLIBCXX_COMPLEX
 #define _GLIBCXX_COMPLEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
diff --git a/libstdc++-v3/include/std/concepts b/libstdc++-v3/include/std/concepts
index 4f3e059b051739b85f55c48e7e18535f6dc43576..28ef37eedc6fbc1f55489f7abf92335cec985243 100644
--- a/libstdc++-v3/include/std/concepts
+++ b/libstdc++-v3/include/std/concepts
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_CONCEPTS
 #define _GLIBCXX_CONCEPTS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_concepts
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable
index c8a68d3f83e4f2d26b94a1fa75b73a95da8ab3a3..616f2c36306392bec42b0d07d19757555ec7a497 100644
--- a/libstdc++-v3/include/std/condition_variable
+++ b/libstdc++-v3/include/std/condition_variable
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_CONDITION_VARIABLE
 #define _GLIBCXX_CONDITION_VARIABLE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // threading primitive
 
diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/std/coroutine
index 30b4d33711e597b12f3491b867a02d05d9fb5c28..7ac1c8c985e79948b9dd980137518ca1fa0026d8 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_COROUTINE
 #define _GLIBCXX_COROUTINE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++17-extensions"
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index e45dd069952f6b3d327ece13f01ab5ac9df7bf83..33396d180c8dcee2a655ec5afba0a2190951e516 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_DEQUE
 #define _GLIBCXX_DEQUE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers are hosted only
 
diff --git a/libstdc++-v3/include/std/execution b/libstdc++-v3/include/std/execution
index fc2cb249f111609c365dfd3012eeb8af438dd4e3..7ac0b70a22b8c7c3c35295a3a104a81172719feb 100644
--- a/libstdc++-v3/include/std/execution
+++ b/libstdc++-v3/include/std/execution
@@ -25,7 +25,9 @@
 #ifndef _GLIBCXX_EXECUTION
 #define _GLIBCXX_EXECUTION 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // execution policies are hosted only
 
diff --git a/libstdc++-v3/include/std/expected b/libstdc++-v3/include/std/expected
index b8217e577fa3a14a586749e74df3b675d5af0375..9e92339e4066e5bbc0444c4e94774d3eb90610c8 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_EXPECTED
 #define _GLIBCXX_EXPECTED
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_expected
 #define __glibcxx_want_freestanding_expected
diff --git a/libstdc++-v3/include/std/filesystem b/libstdc++-v3/include/std/filesystem
index acdcddd700b6f3bd5f97ad2e86e2a554da25f590..222b52902b968eb580ac070f72ee23ed4c612bc6 100644
--- a/libstdc++-v3/include/std/filesystem
+++ b/libstdc++-v3/include/std/filesystem
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_FILESYSTEM
 #define _GLIBCXX_FILESYSTEM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h>
 
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 1e9a8374012df6fb563ad3f38227f432422c5c5f..6313d084f45e4411efdaa059bac80117772e17fb 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_FORMAT
 #define _GLIBCXX_FORMAT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // for std::string
 
diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list
index 5341d1a823914ca31db6cfce2807d6fc7af8fc5f..851c253be11b30c1d41a5982af511bc2e6b7c509 100644
--- a/libstdc++-v3/include/std/forward_list
+++ b/libstdc++-v3/include/std/forward_list
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_FORWARD_LIST
 #define _GLIBCXX_FORWARD_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream
index 1008a275540835b4087c3736642fe78910edde4f..665a17afee698b4b81429c370fc097b6aa4b613b 100644
--- a/libstdc++-v3/include/std/fstream
+++ b/libstdc++-v3/include/std/fstream
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_FSTREAM
 #define _GLIBCXX_FSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 7788a9637578d1dc418ca60a23361652ddeb8fe4..743defc3cb8650c47d35f4c2e27f156bdfdf49a7 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -43,7 +43,9 @@
 #ifndef _GLIBCXX_FUNCTIONAL
 #define _GLIBCXX_FUNCTIONAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/stl_function.h> // std::equal_to, std::unary_function etc.
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index 6ce7d89ca3ffe2298951768fd81f1018a8340c9d..b1e6a5354d827eef49dc7c3712542880c03ff8d7 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_FUTURE
 #define _GLIBCXX_FUTURE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/generator b/libstdc++-v3/include/std/generator
index 1d5acc9142038438181b462df4f359b706614e0e..0a14e70064e3b3744d4114a39114465bf5a79a7f 100644
--- a/libstdc++-v3/include/std/generator
+++ b/libstdc++-v3/include/std/generator
@@ -30,7 +30,9 @@
 #define _GLIBCXX_GENERATOR
 
 #include <ranges>
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index 9d8ecea5d65aa3f14a721b4070eeecb48a26bb27..7c0feeef96d3f9c09941e4b0d25c3c8e70109292 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_IOMANIP
 #define _GLIBCXX_IOMANIP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions"
diff --git a/libstdc++-v3/include/std/ios b/libstdc++-v3/include/std/ios
index 1aa98c47797220a52086ab6cfbff5263e0280bbf..ebed2d9627827779b649e968b7d97fd141fdf9da 100644
--- a/libstdc++-v3/include/std/ios
+++ b/libstdc++-v3/include/std/ios
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_IOS
 #define _GLIBCXX_IOS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index 25eae3c6df371e6695b718fe14b1b15570a6566c..9051b226d5cdb8dfdcd49c95813659c65ed016c9 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_IOSFWD
 #define _GLIBCXX_IOSFWD 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/iostream b/libstdc++-v3/include/std/iostream
index 4a6dc584d38a100388120deeb4d71f23d8137f51..25064b322adf4c513e227191b6265c120deb7194 100644
--- a/libstdc++-v3/include/std/iostream
+++ b/libstdc++-v3/include/std/iostream
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_IOSTREAM
 #define _GLIBCXX_IOSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 730e413c290b8ab4f8802d538407b3812255e705..54a130d82f01bd4834c3afffc14457dab9ea9244 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_ISTREAM
 #define _GLIBCXX_ISTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index b3a3c3538d5579f6484c62fb05b6f3ef195f49f8..c98bcf1ac2c4d6500e3fc56764b412ff80960ebf 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_ITERATOR
 #define _GLIBCXX_ITERATOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/stl_iterator_base_types.h>
diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch
index 7a67de60a53974c4cfc9bce35a1190e99e688072..146e1860979acf38889232ea553d6b21ad4ca600 100644
--- a/libstdc++-v3/include/std/latch
+++ b/libstdc++-v3/include/std/latch
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_LATCH
 #define _GLIBCXX_LATCH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index b0ab57c1ad71907189f8b20decc0ccb3ae93f760..7e040bc6341b9a780496af6ea25c2b7dde08d788 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -37,7 +37,9 @@
 #ifndef _GLIBCXX_NUMERIC_LIMITS
 #define _GLIBCXX_NUMERIC_LIMITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wpedantic" // Q suffix
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 7b67cebe74cf6693cdd18b1d0d433657f01f5220..ab5dec8c6e07feee6738ba10d4ab0730921c2ada 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_LIST
 #define _GLIBCXX_LIST 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/locale b/libstdc++-v3/include/std/locale
index a6808ea2dd40549af92427963e55124a23095f60..0de8277cbda297e8b5bccba819414c18c83cac15 100644
--- a/libstdc++-v3/include/std/locale
+++ b/libstdc++-v3/include/std/locale
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_LOCALE
 #define _GLIBCXX_LOCALE	1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // locales
 
diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map
index 6520d9f744fe261078bdf17cd29d6127f024ef92..3e05006c7b9af0e2af4ae89526e4198909190e71 100644
--- a/libstdc++-v3/include/std/map
+++ b/libstdc++-v3/include/std/map
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_MAP
 #define _GLIBCXX_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index c984436f625379e18984ae32009a6e919b4e7dd3..ba8e698f680f94bc6a1c1a1f9179e1e778da2ff6 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -44,7 +44,9 @@
 #ifndef _GLIBCXX_MEMORY
 #define _GLIBCXX_MEMORY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 /**
  * @defgroup memory Memory
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index a2ffd841b155180cfecd63802e259ab415d67723..34a7fb1014bb0cebd5fd6eb68f50a8c49c343ba4 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -32,7 +32,9 @@
 #ifndef _GLIBCXX_MEMORY_RESOURCE
 #define _GLIBCXX_MEMORY_RESOURCE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // polymorphic allocation
 
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 8dd9b23191fd7c17c4e3392a8ef63dec9d063371..e0cedc4398a96e1560b191584773ce5871ff785f 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_MUTEX
 #define _GLIBCXX_MUTEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/numbers b/libstdc++-v3/include/std/numbers
index f04000f1dd90d7a875b88713403d2c114a18ca33..d813d986e18341de5bf67311778913eebcfde4bc 100644
--- a/libstdc++-v3/include/std/numbers
+++ b/libstdc++-v3/include/std/numbers
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_NUMBERS
 #define _GLIBCXX_NUMBERS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_math_constants
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 201bb8e74a121bba239e0799935e9e9467865954..dd98f40c7a833be503104200e0f69c93b5433701 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_NUMERIC
 #define _GLIBCXX_NUMERIC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/stl_iterator_base_types.h>
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 6a8e76f60e3a636918b6c4427ad0d01259507d2a..2e663d13f86a6d0245c46d9c755e445856ddad2f 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_OPTIONAL
 #define _GLIBCXX_OPTIONAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_freestanding_optional
 #define __glibcxx_want_optional
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 12be6c4fd17859ae27ff068efecbb873cfc4a57b..d8462efe764d4ebd432de0032021aed8f8be3fe4 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_OSTREAM
 #define _GLIBCXX_OSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/print b/libstdc++-v3/include/std/print
index 0c259d04de33dbeb6aa13db13bf88b8f45cd1777..ea1aaac438929839b41432c3eaac75a01a4ae7b4 100644
--- a/libstdc++-v3/include/std/print
+++ b/libstdc++-v3/include/std/print
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_PRINT
 #define _GLIBCXX_PRINT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // for std::format
 
diff --git a/libstdc++-v3/include/std/queue b/libstdc++-v3/include/std/queue
index 61ea453008427b057081385976eaa19129046527..e357456ea6bef6e8a2f335833b2788323cee184f 100644
--- a/libstdc++-v3/include/std/queue
+++ b/libstdc++-v3/include/std/queue
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_QUEUE
 #define _GLIBCXX_QUEUE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random
index 717e5bb611ec7ad89b111f130018ad2ad3ecd1ac..907e5bb5f8c7071fa8098645fb92e6d6f7c36ee3 100644
--- a/libstdc++-v3/include/std/random
+++ b/libstdc++-v3/include/std/random
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_RANDOM
 #define _GLIBCXX_RANDOM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // OS-dependent random
 
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 7169c3a92aa5d42fd230480d09ff76554f7c90fa..30f45e0a750d24ea090de2efb5b4009908108a55 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -32,7 +32,9 @@
 
 #if __cplusplus > 201703L
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <concepts>
 
diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio
index d80a9811c274562698782ff55e0faecb02b1c7e1..aeae5b3f18677fbacb3962229829cf21faf5b589 100644
--- a/libstdc++-v3/include/std/ratio
+++ b/libstdc++-v3/include/std/ratio
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_RATIO
 #define _GLIBCXX_RATIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex
index 76da68829cd8b04a970ff0ac145d1b310aba10a9..124eeaa09878e6a8e6fb6363186622785932c49f 100644
--- a/libstdc++-v3/include/std/regex
+++ b/libstdc++-v3/include/std/regex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_REGEX
 #define _GLIBCXX_REGEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // string and container heavy
 
diff --git a/libstdc++-v3/include/std/scoped_allocator b/libstdc++-v3/include/std/scoped_allocator
index 532a44691ba0b1a04e50b1c6278cd037a5376201..11bdcec3b3443fa5a8ebe9fa7808683b0464ded1 100644
--- a/libstdc++-v3/include/std/scoped_allocator
+++ b/libstdc++-v3/include/std/scoped_allocator
@@ -29,7 +29,9 @@
 #ifndef _SCOPED_ALLOCATOR
 #define _SCOPED_ALLOCATOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore
index 75d634d0e20e12fd9b0f3d8c8fb13ff00a7ba10f..fab3cdb49a9c120711af6f17a87b7193b4bf0565 100644
--- a/libstdc++-v3/include/std/semaphore
+++ b/libstdc++-v3/include/std/semaphore
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_SEMAPHORE
 #define _GLIBCXX_SEMAPHORE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set
index 95cc8005a1929dc8f86c627e2a016f7020d87f18..eebea617f6ea099425eeae90f3ec1a00298e1899 100644
--- a/libstdc++-v3/include/std/set
+++ b/libstdc++-v3/include/std/set
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_SET
 #define _GLIBCXX_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 1b6478f30c39e1d526e6c757ea5c7ab33b3a7090..f1bb5d7fe9236b840814014be05213cf818e6483 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_SHARED_MUTEX
 #define _GLIBCXX_SHARED_MUTEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
index b7392a0500e90974d56097b03a8e6cbacdfebaae..f1c19b58737c43baf5b51dda59e958cc681bce51 100644
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -34,7 +34,9 @@
 #ifndef _GLIBCXX_SPAN
 #define _GLIBCXX_SPAN 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_span
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 1f2d78b79d36ba88ccac938a6207b1bc4b539cec..b86bd613489bab819d418d1ab6bdbd2d3fbc0f70 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_SPANSTREAM
 #define _GLIBCXX_SPANSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index dda7096afe407f19c36a20d7d3460309531fe1b7..fd24f65521850100fb9a4e39758f0fbf2afd6101 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_SSTREAM
 #define _GLIBCXX_SSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostream
 
diff --git a/libstdc++-v3/include/std/stack b/libstdc++-v3/include/std/stack
index c5b4a933ea865a8f929f718b0972fc29f65ee3b7..afdcbae0ec9c43e9fd37ff2226297058961f4711 100644
--- a/libstdc++-v3/include/std/stack
+++ b/libstdc++-v3/include/std/stack
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_STACK
 #define _GLIBCXX_STACK 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index cdd1276d2124ec67b3046d69e7cdf1f84a1429a4..de7446064c7429e690e1101c46dd6884520b8ada 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -24,7 +24,9 @@
 #ifndef _GLIBCXX_STACKTRACE
 #define _GLIBCXX_STACKTRACE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // std::string bound
 
diff --git a/libstdc++-v3/include/std/stdexcept b/libstdc++-v3/include/std/stdexcept
index b55c19bbfe2943c43f478ff4c03d9f5b5ecfc6fd..e61a744c06e6caedf19de7fa5b1b235d456a5cea 100644
--- a/libstdc++-v3/include/std/stdexcept
+++ b/libstdc++-v3/include/std/stdexcept
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_STDEXCEPT
 #define _GLIBCXX_STDEXCEPT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <exception>
 #include <string>
diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
index 2387846e9b2ad9807e577a787ffe1249f2ddd705..979308432f6d924ce8c92d43a84ef0283ac483a6 100644
--- a/libstdc++-v3/include/std/streambuf
+++ b/libstdc++-v3/include/std/streambuf
@@ -33,7 +33,9 @@
 #ifndef _GLIBXX_STREAMBUF
 #define _GLIBXX_STREAMBUF 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index 44a39da50663f9ed75ac8f4625e0ef276dbc9865..fd69e9cb7465dfea071d5a0b2ea2117d312084dd 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_STRING
 #define _GLIBCXX_STRING	1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index 740aa9344f0147594559c74d90879a689e45c854..96350f96b3c0deb667ac5bc6e38ba6baf861b03c 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -33,7 +33,9 @@
 #ifndef _GLIBCXX_STRING_VIEW
 #define _GLIBCXX_STRING_VIEW 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_constexpr_char_traits
 #define __glibcxx_want_constexpr_string_view
diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
index 08a901b62fd09ba431100577e288eb71292c0e06..c4123f6bc2155ffa3828a8513427f76ac169ba0c 100644
--- a/libstdc++-v3/include/std/syncstream
+++ b/libstdc++-v3/include/std/syncstream
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_SYNCSTREAM
 #define _GLIBCXX_SYNCSTREAM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // iostreams
 
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 8dce0960e5519f3801b9ccd12fe652dc5d63bf0b..e42cdfc49805637dddbe5fb12493a8923e6f9795 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_SYSTEM_ERROR
 #define _GLIBCXX_SYSTEM_ERROR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // OS-dependent
 
diff --git a/libstdc++-v3/include/std/text_encoding b/libstdc++-v3/include/std/text_encoding
index 49405a214d5fb9f7285ccd36fe46101f8e6c7f80..48742dcb0765cf2eaf0adecfe34a264479c8e45d 100644
--- a/libstdc++-v3/include/std/text_encoding
+++ b/libstdc++-v3/include/std/text_encoding
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TEXT_ENCODING
 #define _GLIBCXX_TEXT_ENCODING
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h>
 
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index e994d683bff921e7767bbbb657cb41204a3ff9ad..d8c541000cabc4365293f3b8c90dd6f56b8d8319 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_THREAD
 #define _GLIBCXX_THREAD 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // concurrency
 
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 70cf4dba7b93a5c142d37a0c82c71c9365cf9ce2..0bd5439ad677fe0c427443ca4933976948ef34ad 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TUPLE
 #define _GLIBCXX_TUPLE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 7415e200e0976227a1880c3f79ccf08eff71b8d7..6e6778078dcf0286822aa78a44f058a333876bbe 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TYPE_TRAITS
 #define _GLIBCXX_TYPE_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/typeindex b/libstdc++-v3/include/std/typeindex
index 894b133f55178dc9429e7c319b9ee271d68fed18..885b33a8dc839a75d248aa96512f60fe1641cbf8 100644
--- a/libstdc++-v3/include/std/typeindex
+++ b/libstdc++-v3/include/std/typeindex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TYPEINDEX
 #define _GLIBCXX_TYPEINDEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map
index f9a948c3873b1fdfd3c04b6b5cd5fda5abf7f340..d201903e12d9456f6f82dc62fdbdbc89eb57b6cd 100644
--- a/libstdc++-v3/include/std/unordered_map
+++ b/libstdc++-v3/include/std/unordered_map
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_UNORDERED_MAP
 #define _GLIBCXX_UNORDERED_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // container
 
diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set
index aa5b702ff4d347a10856f975eabe81357b00ee25..cfcb6f409b76c35857dfecb89c7f61b82360f4a3 100644
--- a/libstdc++-v3/include/std/unordered_set
+++ b/libstdc++-v3/include/std/unordered_set
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_UNORDERED_SET
 #define _GLIBCXX_UNORDERED_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // containers
 
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 56467160a2f4ea9550aada6c8016851af4dfd7dc..877e9a85c7170ccc1fa4cd9a27de7b9e85a6985d 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_UTILITY
 #define _GLIBCXX_UTILITY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 /**
  * @defgroup utilities Utilities
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray
index 46cd57e798210f891022839c65afb50673cfc391..5ff44a3ec1a4e80820be368c993828ba1b00d196 100644
--- a/libstdc++-v3/include/std/valarray
+++ b/libstdc++-v3/include/std/valarray
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_VALARRAY
 #define _GLIBCXX_VALARRAY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // <cmath> dependant
 
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 08c5395b54d97f078c19679990057d41eab2028c..cf532126d798b1fe8e1156ba291a4bb08995e5ef 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_VARIANT
 #define _GLIBCXX_VARIANT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_freestanding_variant
 #define __glibcxx_want_variant
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index a9894d7e8a8dd256704da9813aaef0477852f998..705bcdc9c086fafb9a4120551b93e22dda3412f0 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -55,7 +55,9 @@
 #ifndef _GLIBCXX_VECTOR
 #define _GLIBCXX_VECTOR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // container
 
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index 47c10d60b60e1493a541b20e5ae79b55e6bc583e..3c6e5b16a50a5305ab2eab69dd0e5b910205bead 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_VERSION_INCLUDED
 #define _GLIBCXX_VERSION_INCLUDED
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_all
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/tr1/array b/libstdc++-v3/include/tr1/array
index b16542c2ee9282b9ffb2977f6602f11e70ef5ac2..31ea546d7fa0985fe3da9dd5a1b3363f9bd56591 100644
--- a/libstdc++-v3/include/tr1/array
+++ b/libstdc++-v3/include/tr1/array
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_ARRAY
 #define _GLIBCXX_TR1_ARRAY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cfenv b/libstdc++-v3/include/tr1/cfenv
index 2d161d88f77f1675e85a1ac31210635eceb715e4..1f57a3ac841eaf9ef0d97648982cb6786a925a67 100644
--- a/libstdc++-v3/include/tr1/cfenv
+++ b/libstdc++-v3/include/tr1/cfenv
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CFENV
 #define _GLIBCXX_TR1_CFENV 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cinttypes b/libstdc++-v3/include/tr1/cinttypes
index 3a44937abb499d5ffe6fc699e4f646de896f8312..591f9ec4bed56cc0fe6a87c761eda35fbdf591aa 100644
--- a/libstdc++-v3/include/tr1/cinttypes
+++ b/libstdc++-v3/include/tr1/cinttypes
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CINTTYPES
 #define _GLIBCXX_TR1_CINTTYPES 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath
index 83677a4e7168f1c43544dada95184e8e9ded27ce..bc1e562084aa5aab2f69c85ee82d364fd64a7a81 100644
--- a/libstdc++-v3/include/tr1/cmath
+++ b/libstdc++-v3/include/tr1/cmath
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CMATH
 #define _GLIBCXX_TR1_CMATH 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex
index 31352818fa643ab710b9cb698fbf07aa82d81a89..65ec5ddc56c8b29197841784ed317bf287b499bf 100644
--- a/libstdc++-v3/include/tr1/complex
+++ b/libstdc++-v3/include/tr1/complex
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_COMPLEX
 #define _GLIBCXX_TR1_COMPLEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cstdbool b/libstdc++-v3/include/tr1/cstdbool
index 4fa40b32888a6d8b4056e1006e182e5a872ab105..b0293ceeaac250cb050216b0399949e03efe2f6f 100644
--- a/libstdc++-v3/include/tr1/cstdbool
+++ b/libstdc++-v3/include/tr1/cstdbool
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CSTDBOOL
 #define _GLIBCXX_TR1_CSTDBOOL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cstdint b/libstdc++-v3/include/tr1/cstdint
index eef171314705458db3729ffccaeb4c9532f8f41f..2601105ab8aa1356abd8232935f90419eb0db3e6 100644
--- a/libstdc++-v3/include/tr1/cstdint
+++ b/libstdc++-v3/include/tr1/cstdint
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CSTDINT
 #define _GLIBCXX_TR1_CSTDINT 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cstdio b/libstdc++-v3/include/tr1/cstdio
index 4e1277a66b70dc637cfa04510a88a09150d9728f..7537163ac959f99636e321b1f5c18529a6180245 100644
--- a/libstdc++-v3/include/tr1/cstdio
+++ b/libstdc++-v3/include/tr1/cstdio
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CSTDIO
 #define _GLIBCXX_TR1_CSTDIO 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cstdlib b/libstdc++-v3/include/tr1/cstdlib
index c519f302a49eadcfa4ef289bebb40079a557853a..c9858de68bbb8f0c8cd7b2caff2ace56cf748d01 100644
--- a/libstdc++-v3/include/tr1/cstdlib
+++ b/libstdc++-v3/include/tr1/cstdlib
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CSTDLIB
 #define _GLIBCXX_TR1_CSTDLIB 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cwchar b/libstdc++-v3/include/tr1/cwchar
index ce13fc1acde7fd4e77a095b7e69b5408983da321..3ef3ebb2c412d043303377f24bf9c7d90688a917 100644
--- a/libstdc++-v3/include/tr1/cwchar
+++ b/libstdc++-v3/include/tr1/cwchar
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CWCHAR
 #define _GLIBCXX_TR1_CWCHAR 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/cwctype b/libstdc++-v3/include/tr1/cwctype
index 10403abdedd756e9ad1d13e2713b607102293a72..eca6fbf0f0ec0cb584f6e718f4bbc3368f4479ba 100644
--- a/libstdc++-v3/include/tr1/cwctype
+++ b/libstdc++-v3/include/tr1/cwctype
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_CWCTYPE
 #define _GLIBCXX_TR1_CWCTYPE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index f2cd42bed4ef7e2db4a2e0308d952e6af5cc0afa..9dc67bc82d79031b987b2b75535fc87a88b70b2e 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_FUNCTIONAL
 #define _GLIBCXX_TR1_FUNCTIONAL 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/functional_hash.h b/libstdc++-v3/include/tr1/functional_hash.h
index 57f0eb604ceb54ba40fff5e9f2f9008147aae17d..01ebfc907dbd71e432bf93bf1a2b0ff3d1dafbc1 100644
--- a/libstdc++-v3/include/tr1/functional_hash.h
+++ b/libstdc++-v3/include/tr1/functional_hash.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_TR1_FUNCTIONAL_HASH_H
 #define _GLIBCXX_TR1_FUNCTIONAL_HASH_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/tr1/hashtable.h b/libstdc++-v3/include/tr1/hashtable.h
index bcf178554eb8778d938ec496d390177e65368c76..ebb79eaddb25b193e572f5b02a3e0608c863166a 100644
--- a/libstdc++-v3/include/tr1/hashtable.h
+++ b/libstdc++-v3/include/tr1/hashtable.h
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_TR1_HASHTABLE_H
 #define _GLIBCXX_TR1_HASHTABLE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <tr1/hashtable_policy.h>
 #include <ext/alloc_traits.h>
diff --git a/libstdc++-v3/include/tr1/memory b/libstdc++-v3/include/tr1/memory
index 8862faf45048b53d2aa2648e6eba515de817c4b3..b64a8604f18936bb7630f63cfccc4f5bbd5765a7 100644
--- a/libstdc++-v3/include/tr1/memory
+++ b/libstdc++-v3/include/tr1/memory
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_TR1_MEMORY
 #define _GLIBCXX_TR1_MEMORY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random
index bca650f3ca1f75132ed62bbbd645a67d88338022..7df863c260249fcc6ac82b78f01c8f74ba906238 100644
--- a/libstdc++-v3/include/tr1/random
+++ b/libstdc++-v3/include/tr1/random
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_TR1_RANDOM
 #define _GLIBCXX_TR1_RANDOM 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/random.h b/libstdc++-v3/include/tr1/random.h
index 449b846aac8cbe5d20a687ff6d5767c37c3fb4d3..74950c9c90661851c3203a037ad7d8d5c238762f 100644
--- a/libstdc++-v3/include/tr1/random.h
+++ b/libstdc++-v3/include/tr1/random.h
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_TR1_RANDOM_H
 #define _GLIBCXX_TR1_RANDOM_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/tr1/regex b/libstdc++-v3/include/tr1/regex
index 502bfb0207feb7e05ccbcf4217ff535b16370c53..8f363604d1538b0b05654d4fd9fea41633911bf5 100644
--- a/libstdc++-v3/include/tr1/regex
+++ b/libstdc++-v3/include/tr1/regex
@@ -31,7 +31,9 @@
 #ifndef _GLIBCXX_TR1_REGEX
 #define _GLIBCXX_TR1_REGEX 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple
index 40e2d0915141577db08735f17e5365d05862f5be..e53fca75944d39376c9de120942f0dea93826047 100644
--- a/libstdc++-v3/include/tr1/tuple
+++ b/libstdc++-v3/include/tr1/tuple
@@ -32,7 +32,9 @@
 #ifndef _GLIBCXX_TR1_TUPLE
 #define _GLIBCXX_TR1_TUPLE 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions"
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index 62b30e7d658c3f7f7063d3bf4ecc2b7b42cc56cb..c4ce2d7125c9bbcfb8a0465029727d88fdbf6f58 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_TYPE_TRAITS
 #define _GLIBCXX_TR1_TYPE_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++11-extensions"
diff --git a/libstdc++-v3/include/tr1/unordered_map b/libstdc++-v3/include/tr1/unordered_map
index 5025153c91f9ff975a1f19a4db8903894ce9c841..0df975d44070a9006359b92b3d9efa12ab548977 100644
--- a/libstdc++-v3/include/tr1/unordered_map
+++ b/libstdc++-v3/include/tr1/unordered_map
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_UNORDERED_MAP
 #define _GLIBCXX_TR1_UNORDERED_MAP 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/unordered_set b/libstdc++-v3/include/tr1/unordered_set
index 63c307e012e2bc0945ec1b55e4e7e3ac32d85d67..7fa06a879a5465f5dfc77da8e03586a718d82dce 100644
--- a/libstdc++-v3/include/tr1/unordered_set
+++ b/libstdc++-v3/include/tr1/unordered_set
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_UNORDERED_SET
 #define _GLIBCXX_TR1_UNORDERED_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr1/utility b/libstdc++-v3/include/tr1/utility
index 8a87eec532912e9f94e59b8245cf2d82743f3893..13209c09ef91ae3760aba0d954fe633906bf4540 100644
--- a/libstdc++-v3/include/tr1/utility
+++ b/libstdc++-v3/include/tr1/utility
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR1_UTILITY
 #define _GLIBCXX_TR1_UTILITY 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/requires_hosted.h> // TR1
 
diff --git a/libstdc++-v3/include/tr2/bool_set b/libstdc++-v3/include/tr2/bool_set
index 11d1b24e4e791954b538fa26b32dd72f1a95e294..a1d88ea3b87d2b4301e1be392e12131ea4ccc649 100644
--- a/libstdc++-v3/include/tr2/bool_set
+++ b/libstdc++-v3/include/tr2/bool_set
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR2_BOOL_SET
 #define _GLIBCXX_TR2_BOOL_SET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <typeinfo>
 #include <iostream>
diff --git a/libstdc++-v3/include/tr2/bool_set.tcc b/libstdc++-v3/include/tr2/bool_set.tcc
index 05f16efbcfcce65cd899b78f5b49f195f7bc6581..87fa2ebf83a74199cf0f872cda8074b542f3ff3b 100644
--- a/libstdc++-v3/include/tr2/bool_set.tcc
+++ b/libstdc++-v3/include/tr2/bool_set.tcc
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR2_BOOL_SET_TCC
 #define _GLIBCXX_TR2_BOOL_SET_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/tr2/dynamic_bitset b/libstdc++-v3/include/tr2/dynamic_bitset
index f0878d7429e08352041bba6fe3f69c5b150a923c..9d55f41c6a150c77a1e9802459c6f94c189e36c8 100644
--- a/libstdc++-v3/include/tr2/dynamic_bitset
+++ b/libstdc++-v3/include/tr2/dynamic_bitset
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR2_DYNAMIC_BITSET
 #define _GLIBCXX_TR2_DYNAMIC_BITSET 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <limits>
 #include <vector>
diff --git a/libstdc++-v3/include/tr2/dynamic_bitset.tcc b/libstdc++-v3/include/tr2/dynamic_bitset.tcc
index 5aac7d88ee37482236ceb942f5e83814658a752d..7400b268d3259367cc2b2775418eaf72bbb92188 100644
--- a/libstdc++-v3/include/tr2/dynamic_bitset.tcc
+++ b/libstdc++-v3/include/tr2/dynamic_bitset.tcc
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_TR2_DYNAMIC_BITSET_TCC
 #define _GLIBCXX_TR2_DYNAMIC_BITSET_TCC 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits
index 603039de8947c13a46ad94ed03e76ed6f924ce12..7a94eb8f944283c1cdd1d8a106b9a0425671a801 100644
--- a/libstdc++-v3/include/tr2/type_traits
+++ b/libstdc++-v3/include/tr2/type_traits
@@ -29,7 +29,9 @@
 #ifndef _GLIBCXX_TR2_TYPE_TRAITS
 #define _GLIBCXX_TR2_TYPE_TRAITS 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 #include <type_traits>
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/libsupc++/atomic_lockfree_defines.h b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
index 978aedb392f40ddd0a7b5e30561dc3f93960d941..cbe488e91b59cfea9d3f128c028c8d4d64737304 100644
--- a/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
+++ b/libstdc++-v3/libsupc++/atomic_lockfree_defines.h
@@ -30,7 +30,9 @@
 #ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H
 #define _GLIBCXX_ATOMIC_LOCK_FREE_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 /**
  * @addtogroup atomics
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index ac8ffdb6c5ab4f58292dd8f38eaf54f7112d996d..bf8a20aa6fdb5b069b503ae6ba27cb2c40755760 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -30,7 +30,9 @@
 #ifndef _COMPARE
 #define _COMPARE
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #define __glibcxx_want_three_way_comparison
 #include <bits/version.h>
diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h
index d63eae6ae4cff7dbd629a514f5ac62c95cfbd3ca..f10cb91c329d194a9aefcc898b594e9d29e2d58e 100644
--- a/libstdc++-v3/libsupc++/cxxabi.h
+++ b/libstdc++-v3/libsupc++/cxxabi.h
@@ -41,7 +41,9 @@
 #ifndef _CXXABI_H
 #define _CXXABI_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC visibility push(default)
 
diff --git a/libstdc++-v3/libsupc++/cxxabi_forced.h b/libstdc++-v3/libsupc++/cxxabi_forced.h
index 5759a891770484538008632702c34692643e1145..960900122b7dbdfb8c9719d593936af849022560 100644
--- a/libstdc++-v3/libsupc++/cxxabi_forced.h
+++ b/libstdc++-v3/libsupc++/cxxabi_forced.h
@@ -31,7 +31,9 @@
 #ifndef _CXXABI_FORCED_H
 #define _CXXABI_FORCED_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC visibility push(default)
 
diff --git a/libstdc++-v3/libsupc++/cxxabi_init_exception.h b/libstdc++-v3/libsupc++/cxxabi_init_exception.h
index cbb3ce33d6fbde2461c3a072b4c31b1e060eab7c..815aa427b8a509e68010db11d32785b4144ff8fd 100644
--- a/libstdc++-v3/libsupc++/cxxabi_init_exception.h
+++ b/libstdc++-v3/libsupc++/cxxabi_init_exception.h
@@ -31,7 +31,9 @@
 #ifndef _CXXABI_INIT_EXCEPTION_H
 #define _CXXABI_INIT_EXCEPTION_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #pragma GCC visibility push(default)
 
diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception
index 1b902e99959a1062d76e35cf1e5f24f488b87a27..7ed8ce317d4286f66615db335480ddc6c170ed22 100644
--- a/libstdc++-v3/libsupc++/exception
+++ b/libstdc++-v3/libsupc++/exception
@@ -30,7 +30,9 @@
 #ifndef __EXCEPTION__
 #define __EXCEPTION__
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/exception.h>
diff --git a/libstdc++-v3/libsupc++/exception.h b/libstdc++-v3/libsupc++/exception.h
index dca58825c3c7a1da2d2fdf38b902fd87d6bf48ce..41fae8055ec815f0a3b399ba0accf88a5036438f 100644
--- a/libstdc++-v3/libsupc++/exception.h
+++ b/libstdc++-v3/libsupc++/exception.h
@@ -31,7 +31,9 @@
 #ifndef __EXCEPTION_H
 #define __EXCEPTION_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/libsupc++/hash_bytes.h b/libstdc++-v3/libsupc++/hash_bytes.h
index f3f965c595f48038ba1e1bc4af4fd44dcf8f64a3..f79fca279b52a9969a22e1c648e27629a84ae144 100644
--- a/libstdc++-v3/libsupc++/hash_bytes.h
+++ b/libstdc++-v3/libsupc++/hash_bytes.h
@@ -30,7 +30,9 @@
 #ifndef _HASH_BYTES_H
 #define _HASH_BYTES_H 1
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 
diff --git a/libstdc++-v3/libsupc++/initializer_list b/libstdc++-v3/libsupc++/initializer_list
index 91b609cacffce424ea1aef633563da3465b4a82a..144286bc8c90746b036fbd5fe1fbe985083e7eed 100644
--- a/libstdc++-v3/libsupc++/initializer_list
+++ b/libstdc++-v3/libsupc++/initializer_list
@@ -30,7 +30,9 @@
 #ifndef _INITIALIZER_LIST
 #define _INITIALIZER_LIST
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #if __cplusplus < 201103L
 # include <bits/c++0x_warning.h>
diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new
index e8b00505cf1e560dffbedd3b5a6155d4a94192b9..e9a3d9b49a3e022d29594d1eb239d07812bcc185 100644
--- a/libstdc++-v3/libsupc++/new
+++ b/libstdc++-v3/libsupc++/new
@@ -35,7 +35,9 @@
 #ifndef _NEW
 #define _NEW
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/c++config.h>
 #include <bits/exception.h>
diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo
index 35e72bb18ee52dbcec6b0177c56753f50ca2acea..71066eb1e4650cf607b00e3ae3a509dbc14de77d 100644
--- a/libstdc++-v3/libsupc++/typeinfo
+++ b/libstdc++-v3/libsupc++/typeinfo
@@ -29,7 +29,9 @@
 #ifndef _TYPEINFO
 #define _TYPEINFO
 
+#ifdef _GLIBCXX_SYSHDR
 #pragma GCC system_header
+#endif
 
 #include <bits/exception.h>
 #if __cplusplus >= 201103L
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 33c1f59bb77b59b5c4085da844c742be5598f50a..f54cd310ebcc96c9dda8df67bde5fa5128ca7496 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
@@ -43,10 +43,11 @@ test02()
 // { dg-error "expected initializer" "" { target *-*-* } 35 }
 // { dg-error "expected initializer" "" { target *-*-* } 37 }
 // { dg-error "overflow in addition" "" { target *-*-* } 0 }
-// { dg-error "overflow in multiplication" "" { target *-*-* } 101 }
 // { dg-error "overflow in multiplication" "" { target *-*-* } 103 }
 // { dg-error "overflow in multiplication" "" { target *-*-* } 105 }
+// { dg-error "overflow in multiplication" "" { target *-*-* } 107 }
 // { dg-error "overflow in constant expression" "" { target *-*-* } 0 }
 // { dg-error "narrowing conversion" "" { target *-*-* } 0 }
+// { dg-error "overflow in expression" "" { target *-*-* } 114 }
 // { dg-prune-output "out of range" }
 // { dg-prune-output "not usable in a constant expression" }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
index f74513da65f7ba71a72f99c2b3fcd42882a98240..d901bd9fae2cd2fbdbfd3ea3bf91fc827125f36c 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
@@ -26,6 +26,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 392 }
-// { dg-error "static assertion failed" "" { target *-*-* } 401 }
-// { dg-error "static assertion failed" "" { target *-*-* } 410 }
+// { dg-error "static assertion failed" "" { target *-*-* } 394 }
+// { dg-error "static assertion failed" "" { target *-*-* } 403 }
+// { dg-error "static assertion failed" "" { target *-*-* } 412 }
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc
index f06668cff3771b6d50fec130b820e18a9ab2abaa..adcffb6e6292272d5019794a5ad3fadaff37bf3c 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc
@@ -46,7 +46,7 @@ test02()
 // { dg-error "value type is destructible" "" { target *-*-* } 0 }
 
 // In Debug Mode the "required from here" errors come from <debug/vector>
-// { dg-error "required from here" "" { target *-*-* } 180 }
+// { dg-error "required from here" "" { target *-*-* } 182 }
 
 // Needed because of PR c++/92193
 // { dg-prune-output "deleted function" }
diff --git a/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
index 17242bdf3c7267057ec42d94f907fcb0f52121e6..bf0c5e8b3eef26ba9796287153573fd610cea00a 100644
--- a/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
+++ b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc
@@ -38,5 +38,5 @@ test02()
 {
   const Y array[1] = { };
   (void) std::prev(array + 1);
-  // { dg-error "forward_iterator" "" { target *-*-* } 239 }
+  // { dg-error "forward_iterator" "" { target *-*-* } 241 }
 }
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 458748af28aa620cf7946b90eaed9bfa213c0e04..36562c66b4cf09b21ee03e1a35b34c4d9e0848c8 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 *-*-* } 74 }
+// { dg-error "no type" "" { target *-*-* } 76 }
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 c1dde44e11888d75f366b8a1f33dd7a9279a1281..e297332fee91ff8a94c9d6052a22a818ec688360 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 *-*-* } 103 }
-// { dg-error "declaration of" "" { target *-*-* } 106 }
+// { dg-error "declaration of" "" { target *-*-* } 105 }
+// { dg-error "declaration of" "" { target *-*-* } 108 }
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 5f77c1a652a340dd546ac184b5c9e01c93aac768..2c6c53ba1fcfeb2298556bbc60bda053a6093156 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 *-*-* } 117 }
+// { dg-error "no type" "" { target *-*-* } 119 }
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 7f5a304c5264476f4cec11dea35734ed88f1fd6c..af6ea1c86919435c17dfeca8f00511bbec55b6cd 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 *-*-* } 146 }
-// { dg-error "declaration of" "" { target *-*-* } 149 }
+// { dg-error "declaration of" "" { target *-*-* } 148 }
+// { dg-error "declaration of" "" { target *-*-* } 151 }