gcc/libstdc++-v3/include/c_global
Jonathan Wakely 5c34f02ba7
libstdc++: Deprecate useless <cxxx> compatibility headers for C++17
These headers make no sense for C++ programs, because they either define
different content to the corresponding <xxx.h> C header, or define
nothing at all in namespace std. They were all deprecated in C++17, so
add deprecation warnings to them, which can be disabled with
-Wno-deprecated. For C++20 and later these headers are no longer in the
standard at all, so compiling with _GLIBCXX_USE_DEPRECATED defined to 0
will give an error when they are included.

Because #warning is non-standard before C++23 we need to use pragmas to
ignore -Wc++23-extensions for the -Wsystem-headers -pedantic case.

One g++ test needs adjustment because it includes <ciso646>, but that
can be made conditional on the __cplusplus value without any reduction
in test coverage.

For the library tests, consolidate the std_c++0x_neg.cc XFAIL tests into
the macros.cc test, using dg-error with a { target c++98_only }
selector. This avoids having two separate test files, one for C++98 and
one for everything later. Also add tests for the <xxx.h> headers to
ensure that they behave as expected and don't give deprecated warnings.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document deprecations.
	* doc/html/*: Regenerate.
	* include/c_compatibility/complex.h (_GLIBCXX_COMPLEX_H): Move
	include guard to start of file. Include <complex> directly
	instead of <ccomplex>.
	* include/c_compatibility/tgmath.h: Include <cmath> and
	<complex> directly, instead of <ctgmath>.
	* include/c_global/ccomplex: Add deprecated #warning for C++17
	and #error for C++20 if _GLIBCXX_USE_DEPRECATED == 0.
	* include/c_global/ciso646: Likewise.
	* include/c_global/cstdalign: Likewise.
	* include/c_global/cstdbool: Likewise.
	* include/c_global/ctgmath: Likewise.
	* include/c_std/ciso646: Likewise.
	* include/precompiled/stdc++.h: Do not include ccomplex,
	ciso646, cstdalign, cstdbool, or ctgmath in C++17 and later.
	* testsuite/18_support/headers/cstdalign/macros.cc: Check for
	warnings and errors for unsupported dialects.
	* testsuite/18_support/headers/cstdbool/macros.cc: Likewise.
	* testsuite/26_numerics/headers/ctgmath/complex.cc: Likewise.
	* testsuite/27_io/objects/char/1.cc: Do not include <ciso646>.
	* testsuite/27_io/objects/wchar_t/1.cc: Likewise.
	* testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc: Removed.
	* testsuite/18_support/headers/cstdalign/std_c++0x_neg.cc: Removed.
	* testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc: Removed.
	* testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc: Removed.
	* testsuite/18_support/headers/ciso646/macros.cc: New test.
	* testsuite/18_support/headers/ciso646/macros.h.cc: New test.
	* testsuite/18_support/headers/cstdbool/macros.h.cc: New test.
	* testsuite/26_numerics/headers/ccomplex/complex.cc: New test.
	* testsuite/26_numerics/headers/ccomplex/complex.h.cc: New test.
	* testsuite/26_numerics/headers/ctgmath/complex.h.cc: New test.

gcc/testsuite/ChangeLog:

	* g++.old-deja/g++.other/headers1.C: Do not include ciso646 for
	C++17 and later.
2024-11-06 12:47:19 +00:00
..
cassert
ccomplex libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cctype
cerrno
cfenv
cfloat
cinttypes
ciso646 libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
climits
clocale
cmath libstdc++: Fix up std::{,b}float16_t std::{ilogb,l{,l}r{ound,int}} [PR117406] 2024-11-02 18:48:54 +01:00
csetjmp
csignal
cstdalign libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cstdarg
cstdbool libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cstddef
cstdint
cstdio
cstdlib
cstring
ctgmath libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
ctime
cuchar
cwchar
cwctype