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 libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
ccomplex libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cctype libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cerrno libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cfenv libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cfloat libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cinttypes libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
ciso646 libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
climits libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
clocale libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
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 libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
csignal libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cstdalign libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cstdarg libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cstdbool libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
cstddef libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cstdint libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cstdio libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cstdlib libstdc++: Fix more pedwarns in headers for C++98 2024-09-27 23:55:11 +01:00
cstring libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
ctgmath libstdc++: Deprecate useless <cxxx> compatibility headers for C++17 2024-11-06 12:47:19 +00:00
ctime libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cuchar libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cwchar libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00
cwctype libstdc++: #ifdef out #pragma GCC system_header 2024-09-25 08:20:45 -04:00