Skip to content

Commit cd7e179

Browse files
[libc++] Deprecate and remove meaningless <cxxx> headers
`<ccomplex>`, `<cstdbool>`, `<ctgmath>`, and `<ciso646>` are deprecated and "removed" by special deprecation warnings. `<cstdalign>` is currently missing.
1 parent 64a22b3 commit cd7e179

File tree

15 files changed

+144
-7
lines changed

15 files changed

+144
-7
lines changed

libcxx/docs/ReleaseNotes/20.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ What's New in Libc++ 20.0.0?
3838
Implemented Papers
3939
------------------
4040

41-
- P2747R2: ``constexpr`` placement new (`Github <https://github.com/llvm/llvm-project/issues/105427>`__)
41+
- P0619R4: Reviewing Deprecated Facilities of C++17 for C++20 (`Github <https://github.com/llvm/llvm-project/issues/99985>`__)
4242
- P2609R3: Relaxing Ranges Just A Smidge (`Github <https://github.com/llvm/llvm-project/issues/105253>`__)
43+
- P2747R2: ``constexpr`` placement new (`Github <https://github.com/llvm/llvm-project/issues/105427>`__)
4344
- P2985R0: A type trait for detecting virtual base classes (`Github <https://github.com/llvm/llvm-project/issues/105432>`__)
4445
- ``std::jthread`` and ``<stop_token>`` are not guarded behind ``-fexperimental-library`` anymore
4546

@@ -77,6 +78,10 @@ Deprecations and Removals
7778
supported as an extension anymore, please migrate any code that uses e.g. ``std::vector<const T>`` to be
7879
standards conforming.
7980

81+
- ``<ccomplex>``, ``<cstdbool>``, and ``<ctgmath>`` are deprecated since C++17 as specified by the standard. They,
82+
together with ``<ciso646>``, are removed in C++20, but libc++ still provides these headers as an extension and only
83+
deprecates them.
84+
8085
Upcoming Deprecations and Removals
8186
----------------------------------
8287

libcxx/docs/Status/Cxx17Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"","","","","",""
4444
"`P0032R3 <https://wg21.link/P0032R3>`__","Homogeneous interface for variant, any and optional","2016-06 (Oulu)","|Complete|","4.0",""
4545
"`P0040R3 <https://wg21.link/P0040R3>`__","Extending memory management tools","2016-06 (Oulu)","|Complete|","4.0",""
46-
"`P0063R3 <https://wg21.link/P0063R3>`__","C++17 should refer to C11 instead of C99","2016-06 (Oulu)","|Complete|","7.0",""
46+
"`P0063R3 <https://wg21.link/P0063R3>`__","C++17 should refer to C11 instead of C99","2016-06 (Oulu)","|Complete|","7.0","``<ccomplex>``, ``<cstdbool>``, and ``<ctgmath>`` are deprecated since LLVM 20."
4747
"`P0067R3 <https://wg21.link/P0067R3>`__","Elementary string conversions","2016-06 (Oulu)","|Nothing To Do|","n/a","Resolved by `P0067R5 <https://wg21.link/P0067R5>`__"
4848
"`P0083R3 <https://wg21.link/P0083R3>`__","Splicing Maps and Sets","2016-06 (Oulu)","|Complete|","8.0",""
4949
"`P0084R2 <https://wg21.link/P0084R2>`__","Emplace Return Type","2016-06 (Oulu)","|Complete|","4.0",""

libcxx/docs/Status/Cxx20Papers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"`P0528R3 <https://wg21.link/P0528R3>`__","The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange","2018-06 (Rapperswil)","","",""
3535
"`P0542R5 <https://wg21.link/P0542R5>`__","Support for contract based programming in C++","2018-06 (Rapperswil)","|Nothing To Do|","n/a","Pulled at the 2019-07 meeting in Cologne"
3636
"`P0556R3 <https://wg21.link/P0556R3>`__","Integral power-of-2 operations","2018-06 (Rapperswil)","|Complete|","9.0",""
37-
"`P0619R4 <https://wg21.link/P0619R4>`__","Reviewing Deprecated Facilities of C++17 for C++20","2018-06 (Rapperswil)","|Partial|","","Only sections D.7, D.8, D.9, D.10, D.11, D.12, and D.13 are implemented. Section D.4 remains undone."
37+
"`P0619R4 <https://wg21.link/P0619R4>`__","Reviewing Deprecated Facilities of C++17 for C++20","2018-06 (Rapperswil)","|Complete|","20.0","Removed headers are still provided as an extension, but with deprecation warnings"
3838
"`P0646R1 <https://wg21.link/P0646R1>`__","Improving the Return Value of Erase-Like Algorithms","2018-06 (Rapperswil)","|Complete|","10.0",""
3939
"`P0722R3 <https://wg21.link/P0722R3>`__","Efficient sized delete for variable sized classes","2018-06 (Rapperswil)","|Complete|","9.0",""
4040
"`P0758R1 <https://wg21.link/P0758R1>`__","Implicit conversion traits and utility functions","2018-06 (Rapperswil)","|Complete|","",""

libcxx/include/ccomplex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,17 @@
2323
# pragma GCC system_header
2424
#endif
2525

26+
#if _LIBCPP_STD_VER >= 17
27+
# if _LIBCPP_STD_VER >= 20
28+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED_("removed in C++20")
29+
# else
30+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED
31+
# endif
32+
33+
using __standard_header_ccomplex _DEPRECATION_ANNOTATION = void;
34+
using __use_standard_header_ccomplex = __standard_header_ccomplex;
35+
36+
# undef _DEPRECATION_ANNOTATION
37+
#endif
38+
2639
#endif // _LIBCPP_CCOMPLEX

libcxx/include/ciso646

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@
2121
# pragma GCC system_header
2222
#endif
2323

24+
#if _LIBCPP_STD_VER >= 20
25+
using __standard_header_ciso646 _LIBCPP_DEPRECATED_("removed in C++20") = void;
26+
using __use_standard_header_ciso646 = __standard_header_ciso646;
27+
#endif
28+
2429
#endif // _LIBCPP_CISO646

libcxx/include/cstdbool

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,17 @@ Macros:
2828
#undef __bool_true_false_are_defined
2929
#define __bool_true_false_are_defined 1
3030

31+
#if _LIBCPP_STD_VER >= 17
32+
# if _LIBCPP_STD_VER >= 20
33+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED_("removed in C++20")
34+
# else
35+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED
36+
# endif
37+
38+
using __standard_header_cstdbool _DEPRECATION_ANNOTATION = void;
39+
using __use_standard_header_cstdbool = __standard_header_cstdbool;
40+
41+
# undef _DEPRECATION_ANNOTATION
42+
#endif
43+
3144
#endif // _LIBCPP_CSTDBOOL

libcxx/include/ctgmath

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@
2525
# pragma GCC system_header
2626
#endif
2727

28+
#if _LIBCPP_STD_VER >= 17
29+
# if _LIBCPP_STD_VER >= 20
30+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED_("removed in C++20")
31+
# else
32+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED
33+
# endif
34+
35+
using __standard_header_ctgmath _DEPRECATION_ANNOTATION = void;
36+
using __use_standard_header_ctgmath = __standard_header_ctgmath;
37+
38+
# undef _DEPRECATION_ANNOTATION
39+
#endif
40+
2841
#endif // _LIBCPP_CTGMATH

libcxx/test/std/depr/depr.c.headers/ciso646.compile.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// <ciso646>
9+
// <ciso646> // removed in C++20, but still provided by libc++ as an extension
10+
11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1012

1113
#include <ciso646>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <ccomplex>
10+
11+
// check that <ccomplex> is deprecated in C++17 and removed in C++20
12+
13+
// UNSUPPORTED: c++03, c++11, c++14
14+
15+
#include "test_macros.h"
16+
17+
#if TEST_STD_VER >= 20
18+
# include <ccomplex> // expected-warning {{'__standard_header_ccomplex' is deprecated: removed in C++20}}
19+
#else
20+
# include <ccomplex> // expected-warning {{'__standard_header_ccomplex' is deprecated}}
21+
#endif
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <ciso646>
10+
11+
// check that <ciso646> is removed in C++20
12+
13+
// UNSUPPORTED: c++03, c++11, c++14, c++17
14+
15+
#include "test_macros.h"
16+
17+
#include <ciso646> // expected-warning {{'__standard_header_ciso646' is deprecated: removed in C++20}}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <cstdbool>
10+
11+
// check that <cstdbool> is deprecated in C++17 and removed in C++20
12+
13+
// UNSUPPORTED: c++03, c++11, c++14
14+
15+
#include "test_macros.h"
16+
17+
#if TEST_STD_VER >= 20
18+
# include <cstdbool> // expected-warning {{'__standard_header_cstdbool' is deprecated: removed in C++20}}
19+
#else
20+
# include <cstdbool> // expected-warning {{'__standard_header_cstdbool' is deprecated}}
21+
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// <ctgmath>
10+
11+
// check that <ctgmath> is deprecated in C++17 and removed in C++20
12+
13+
// UNSUPPORTED: c++03, c++11, c++14
14+
15+
#include "test_macros.h"
16+
17+
#if TEST_STD_VER >= 20
18+
# include <ctgmath> // expected-warning {{'__standard_header_ctgmath' is deprecated: removed in C++20}}
19+
#else
20+
# include <ctgmath> // expected-warning {{'__standard_header_ctgmath' is deprecated}}
21+
#endif

libcxx/test/std/language.support/support.runtime/cstdbool.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// test <cstdbool>
9+
// test <cstdbool> // deprecated in C++17, removed in C++20, but still provided by libc++ as an extension
10+
11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1012

1113
#include <cstdbool>
1214

libcxx/test/std/numerics/c.math/ctgmath.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// <ctgmath>
9+
// <ctgmath> // deprecated in C++17, removed in C++20, but still provided by libc++ as an extension
10+
11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1012

1113
#include <ctgmath>
1214

libcxx/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// <ccomplex>
9+
// <ccomplex> // deprecated in C++17, removed in C++20, but still provided by libc++ as an extension
10+
11+
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
1012

1113
#include <ccomplex>
1214

0 commit comments

Comments
 (0)