libstdc++: add #pragma diagnostic

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

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

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

The change to acinclude.m4 changes -Wabi to warn only in comparison to ABI
19, to avoid lots of warnings that we now mangle concept requirements, which
are in any case still experimental.  I checked for any other changes against
ABI v15, and found only the <format> lambda mangling, which we can ignore.

This also enables -Wsystem-headers while building the library, so we see any
warnings not silenced by these #pragmas.

libstdc++-v3/ChangeLog:

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

gcc/ChangeLog:

	* ginclude/stdint-wrap.h: Add #pragma GCC diagnostic to suppress
	undesired warnings.
	* gsyslimits.h: Likewise.
This commit is contained in:
Jason Merrill 2023-12-22 13:20:35 -05:00
parent 605d05b948
commit d3a7302ec5
72 changed files with 320 additions and 7 deletions

View file

@ -6,7 +6,10 @@
# undef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
# endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
# include_next <stdint.h>
#pragma GCC diagnostic pop
#else
# include "stdint-gcc.h"
#endif

View file

@ -4,5 +4,8 @@
instead of this text. */
#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <limits.h>
#pragma GCC diagnostic pop
#undef _GCC_NEXT_LIMITS_H

View file

@ -707,7 +707,7 @@ AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
AC_SUBST(OPTIMIZE_CXXFLAGS)
WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2"
WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19 -Wsystem-headers"
AC_SUBST(WARN_FLAGS)
])

View file

@ -55720,7 +55720,7 @@ $as_echo "$gxx_include_dir" >&6; }
# OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2"
WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=19 -Wsystem-headers"

View file

@ -39,6 +39,9 @@
#include <initializer_list>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -962,6 +965,8 @@ _GLIBCXX_END_NAMESPACE_ALGO
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#ifdef _GLIBCXX_PARALLEL
# include <parallel/algorithmfwd.h>
#endif

View file

@ -49,6 +49,9 @@
#include <type_traits>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -292,4 +295,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -32,6 +32,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -181,4 +184,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -41,6 +41,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#include <bits/cxxabi_forced.h>
namespace std _GLIBCXX_VISIBILITY(default)
@ -1031,4 +1034,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -32,6 +32,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#pragma GCC diagnostic ignored "-Wc++23-extensions" // bf16
// The major release number for the GCC release the C++ library belongs to.
#define _GLIBCXX_RELEASE
@ -910,4 +915,6 @@ namespace __gnu_cxx
#endif // __has_include
#endif // C++17
#pragma GCC diagnostic pop
// End of prewritten config; the settings discovered at configure time follow.

View file

@ -41,6 +41,9 @@
#include <bits/c++config.h>
#include <bits/locale_classes.h> // locale::facet
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -840,4 +843,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif // _CODECVT_H

View file

@ -34,6 +34,9 @@
#include <bits/c++config.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
// All places in libstdc++-v3 where these are used, or /might/ be used, or
// don't need to be used, or perhaps /should/ be used, are commented with
// "concept requirements" (and maybe some more text). So grep like crazy
@ -78,4 +81,5 @@
#endif // enable/disable
#pragma GCC diagnostic pop
#endif // _GLIBCXX_CONCEPT_CHECK

View file

@ -40,6 +40,9 @@
# include <type_traits> // is_same_v, is_integral_v
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long"
//
// This file provides some compile-time information about various types.
// These representations were designed, on purpose, to be constant-expressions
@ -582,4 +585,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // extern "C++"
#pragma GCC diagnostic pop
#endif //_CPP_TYPE_TRAITS_H

View file

@ -36,6 +36,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
#include <bits/cxxabi_forced.h>
#include <bits/move.h> // for swap
#include <cerrno>
@ -1094,4 +1097,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -40,6 +40,9 @@
# include <bits/node_handle.h>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -2758,4 +2761,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif // _HASHTABLE_H

View file

@ -36,6 +36,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
#include <bits/cxxabi_forced.h>
namespace std _GLIBCXX_VISIBILITY(default)
@ -1166,4 +1169,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -37,6 +37,9 @@
#include <bits/ptr_traits.h> // to_address
#include <bits/ranges_cmp.h> // identity, ranges::less
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -1044,5 +1047,6 @@ namespace ranges
#endif // C++20 library concepts
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif // C++20
#endif // _ITERATOR_CONCEPTS_H

View file

@ -36,6 +36,10 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
#pragma GCC diagnostic ignored "-Wvariadic-macros"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -384,4 +388,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -32,6 +32,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -1433,4 +1436,5 @@ _GLIBCXX_END_NAMESPACE_LDBL
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#pragma GCC diagnostic pop
#endif

View file

@ -36,6 +36,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
#include <bits/cxxabi_forced.h>
namespace std _GLIBCXX_VISIBILITY(default)
@ -390,4 +393,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -36,6 +36,9 @@
#include <bits/cxxabi_forced.h>
#include <bits/exception_defines.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -131,4 +134,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif /* _OSTREAM_INSERT_H */

View file

@ -39,6 +39,9 @@
#include <bits/max_size_type.h>
#include <bits/version.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
#ifdef __cpp_lib_concepts
namespace std _GLIBCXX_VISIBILITY(default)
{
@ -1073,5 +1076,6 @@ namespace ranges
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // library concepts
#pragma GCC diagnostic pop
#endif // C++20
#endif // _GLIBCXX_RANGES_BASE_H

View file

@ -33,6 +33,9 @@
#define _GLIBCXX_REGEX_STATE_LIMIT 100000
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // anon struct
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -397,4 +400,6 @@ namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#include <bits/regex_automaton.tcc>

View file

@ -55,6 +55,9 @@
// All dummy nodes will be eliminated at the end of compilation.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++20-extensions" // variadic macro with 0 args
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -621,4 +624,6 @@ namespace __detail
} // namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // namespace std
#pragma GCC diagnostic pop

View file

@ -36,6 +36,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -304,4 +307,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -34,6 +34,10 @@
#include <bits/c++config.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#pragma GCC diagnostic ignored "-Wlong-long"
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
#ifdef __CORRECT_ISO_CPP_MATH_H_PROTO
@ -151,4 +155,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // extern "C++"
#pragma GCC diagnostic pop
#endif // _GLIBCXX_BITS_STD_ABS_H

View file

@ -72,6 +72,9 @@
# endif
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // inline namespace
// See concept_check.h for the __glibcxx_*_requires macros.
namespace std _GLIBCXX_VISIBILITY(default)
@ -5901,4 +5904,6 @@ _GLIBCXX_END_NAMESPACE_ALGO
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif /* _STL_ALGO_H */

View file

@ -36,6 +36,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -166,4 +169,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif

View file

@ -30,5 +30,10 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#include_next <assert.h>
#pragma GCC diagnostic pop

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <ctype.h>
#pragma GCC diagnostic pop
#endif

View file

@ -40,9 +40,14 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#include_next <errno.h>
#pragma GCC diagnostic pop
// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
#ifndef errno
#define errno errno

View file

@ -31,7 +31,12 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#include_next <float.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,7 +31,12 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#include_next <limits.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <locale.h>
#pragma GCC diagnostic pop
#endif

View file

@ -33,8 +33,13 @@
#include <bits/c++config.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <math.h>
#pragma GCC diagnostic pop
// Get rid of those macros defined in <math.h> in lieu of real functions.
#undef abs
#undef div

View file

@ -31,8 +31,13 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <setjmp.h>
#pragma GCC diagnostic pop
// Get rid of those macros defined in <setjmp.h> in lieu of real functions.
#undef longjmp

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <signal.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,7 +31,12 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#undef __need___va_list
#include_next <stdarg.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,10 +31,15 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#define __need_size_t
#define __need_ptrdiff_t
#define __need_NULL
#define __need_offsetof
#include_next <stddef.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,8 +31,13 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <stdio.h>
#pragma GCC diagnostic pop
// Get rid of those macros defined in <stdio.h> in lieu of real functions.
#undef clearerr
#undef fclose

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <stdlib.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <string.h>
#pragma GCC diagnostic pop
#endif

View file

@ -31,6 +31,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include_next <time.h>
#pragma GCC diagnostic pop
#endif

View file

@ -35,10 +35,15 @@
#include <cstddef>
#include <ctime>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#if _GLIBCXX_HAVE_WCHAR_H
#include_next <wchar.h>
#endif
#pragma GCC diagnostic pop
// Need to do a bit of trickery here with mbstate_t as char_traits
// assumes it is in wchar.h, regardless of wchar_t specializations.
#ifndef _GLIBCXX_HAVE_MBSTATE_T

View file

@ -31,10 +31,15 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_WCTYPE_H
#include_next <wctype.h>
#endif
#pragma GCC diagnostic pop
#endif

View file

@ -31,11 +31,16 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_FENV_H
# include_next <fenv.h>
#endif
#pragma GCC diagnostic pop
#if __cplusplus >= 201103L
#if _GLIBCXX_USE_C99_FENV

View file

@ -31,6 +31,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#if __cplusplus >= 201103L
@ -88,4 +91,6 @@ namespace std
#endif // C++11
#pragma GCC diagnostic pop
#endif // _GLIBCXX_INTTYPES_H

View file

@ -31,6 +31,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#include <bits/c++config.h>
#if __cplusplus >= 201103L
@ -107,4 +110,6 @@ namespace std
#endif // C++11
#pragma GCC diagnostic pop
#endif // _GLIBCXX_STDINT_H

View file

@ -44,6 +44,9 @@
#ifndef _GLIBCXX_CLIMITS
#define _GLIBCXX_CLIMITS 1
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long"
#ifndef LLONG_MIN
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif
@ -56,4 +59,6 @@
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif
#pragma GCC diagnostic pop
#endif

View file

@ -43,9 +43,14 @@
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <math.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#pragma GCC diagnostic pop
#include <bits/std_abs.h>
#ifndef _GLIBCXX_CMATH

View file

@ -52,6 +52,9 @@
#define __glibcxx_want_byte
#include <bits/version.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
extern "C++"
{
#if __cplusplus >= 201103L
@ -189,4 +192,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif // __cpp_lib_byte
} // extern "C++"
#pragma GCC diagnostic pop
#endif // _GLIBCXX_CSTDDEF

View file

@ -75,9 +75,13 @@ namespace std
// Need to ensure this finds the C library's <stdlib.h> not a libstdc++
// wrapper that might already be installed later in the include search path.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // include_next
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <stdlib.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#pragma GCC diagnostic pop
#include <bits/std_abs.h>
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.

View file

@ -33,6 +33,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // DF suffix
#include <bits/c++config.h>
#ifndef _GLIBCXX_USE_DECIMAL_FLOAT
@ -491,4 +494,5 @@ _GLIBCXX_END_NAMESPACE_VERSION
#include <decimal/decimal.h>
#pragma GCC diagnostic pop
#endif /* _GLIBCXX_DECIMAL */

View file

@ -37,6 +37,9 @@
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -312,4 +315,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#pragma GCC diagnostic pop
#endif

View file

@ -66,6 +66,10 @@
#include <ext/memory> // For uninitialized_copy_n
// Ignore warnings about default member initializers.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -3009,6 +3013,8 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
# include <ext/ropeimpl.h>
#endif

View file

@ -34,6 +34,9 @@
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlong-long"
extern "C++" {
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
@ -270,4 +273,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
} // extern "C++"
#pragma GCC diagnostic pop
#endif

View file

@ -42,6 +42,9 @@
#include <type_traits>
#include <bits/utility.h> // in_place_type_t
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // aligned_storage
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -661,5 +664,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif // __cpp_lib_any
#endif // _GLIBCXX_ANY

View file

@ -31,6 +31,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
#include <bits/requires_hosted.h> // for error codes
// As an extension we support <charconv> in C++14, but this header should not
@ -932,4 +935,5 @@ namespace __detail
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++14
#pragma GCC diagnostic pop
#endif // _GLIBCXX_CHARCONV

View file

@ -38,6 +38,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template
#include <bits/c++config.h>
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
@ -2650,4 +2653,5 @@ _GLIBCXX_END_NAMESPACE_VERSION
#pragma clang diagnostic pop
#endif
#pragma GCC diagnostic pop
#endif /* _GLIBCXX_COMPLEX */

View file

@ -31,6 +31,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++17-extensions"
#define __glibcxx_want_coroutine
#include <bits/version.h>
@ -358,4 +361,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // __cpp_lib_coroutine
#pragma GCC diagnostic pop
#endif // _GLIBCXX_COROUTINE

View file

@ -63,6 +63,10 @@
# include <cctype>
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
#pragma GCC diagnostic ignored "-Wc++23-extensions" // bf16
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -1674,6 +1678,10 @@ namespace __format
do
{
// Mangling of this lambda, and thus resize_and_overwrite
// instantiated with it, was fixed in ABI 18 (G++ 13). Since
// <format> was new in G++ 13, and is experimental, that
// isn't a problem.
auto __overwrite = [&__to_chars, &__res] (char* __p, size_t __n)
{
__res = __to_chars(__p + 1, __p + __n - 1);
@ -4737,4 +4745,5 @@ namespace __format
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cpp_lib_format
#pragma GCC diagnostic pop
#endif // _GLIBCXX_FORMAT

View file

@ -35,6 +35,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#include <bits/requires_hosted.h> // iostreams
#include <bits/c++config.h>
@ -543,4 +546,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#pragma GCC diagnostic pop
#endif /* _GLIBCXX_IOMANIP */

View file

@ -39,6 +39,11 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // Q suffix
#pragma GCC diagnostic ignored "-Wlong-long"
#pragma GCC diagnostic ignored "-Wc++23-extensions"
#include <bits/c++config.h>
//
@ -2229,4 +2234,5 @@ _GLIBCXX_END_NAMESPACE_VERSION
#undef __glibcxx_digits10
#undef __glibcxx_max_digits10
#pragma GCC diagnostic pop
#endif // _GLIBCXX_NUMERIC_LIMITS

View file

@ -38,6 +38,9 @@
#include <type_traits>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // Q extension
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -232,5 +235,7 @@ __glibcxx_numbers (__float128, Q);
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#pragma GCC diagnostic pop
#endif // __cpp_lib_math_constants
#endif // _GLIBCXX_NUMBERS

View file

@ -44,6 +44,10 @@
#include <ext/type_traits.h>
#include <bits/move.h> // for std::__addressof
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvolatile" // volatile parm/return
#pragma GCC diagnostic ignored "-Wc++11-extensions"
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@ -2282,4 +2286,5 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
}
#pragma GCC diagnostic pop
#endif // _GLIBCXX_TR1_FUNCTIONAL

View file

@ -34,6 +34,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#include <bits/requires_hosted.h> // TR1
#include <utility>
@ -425,4 +428,5 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
}
#pragma GCC diagnostic pop
#endif // _GLIBCXX_TR1_TUPLE

View file

@ -31,6 +31,9 @@
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#include <bits/requires_hosted.h> // TR1
#include <bits/c++config.h>
@ -684,4 +687,5 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
}
#pragma GCC diagnostic pop
#endif // _GLIBCXX_TR1_TYPE_TRAITS

View file

@ -39,6 +39,10 @@
#include <concepts>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic" // __int128
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
namespace std _GLIBCXX_VISIBILITY(default)
{
// [cmp.categories], comparison category types
@ -1258,6 +1262,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
#endif // __cpp_lib_three_way_comparison >= 201907L
} // namespace std
#pragma GCC diagnostic pop
#endif // C++20
#endif // _COMPARE

View file

@ -46,6 +46,9 @@
#define __glibcxx_want_constexpr_new
#include <bits/version.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions" // scoped enum
#pragma GCC visibility push(default)
extern "C++" {
@ -239,5 +242,6 @@ namespace std
}
#pragma GCC visibility pop
#pragma GCC diagnostic pop
#endif

View file

@ -35,4 +35,4 @@ int main()
}
// { dg-error "required from" "" { target *-*-* } 28 }
// { dg-error "no type" "" { target *-*-* } 71 }
// { dg-error "no type" "" { target *-*-* } 74 }

View file

@ -36,5 +36,5 @@ int main()
}
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 }
// { dg-error "declaration of" "" { target *-*-* } 100 }
// { dg-error "declaration of" "" { target *-*-* } 103 }
// { dg-error "declaration of" "" { target *-*-* } 106 }

View file

@ -35,4 +35,4 @@ int main()
}
// { dg-error "required from" "" { target *-*-* } 28 }
// { dg-error "no type" "" { target *-*-* } 114 }
// { dg-error "no type" "" { target *-*-* } 117 }

View file

@ -36,5 +36,5 @@ int main()
}
// { dg-error "invalid use of incomplete" "" { target *-*-* } 28 }
// { dg-error "declaration of" "" { target *-*-* } 143 }
// { dg-error "declaration of" "" { target *-*-* } 146 }
// { dg-error "declaration of" "" { target *-*-* } 149 }