Skip to content

Commit fdf253d

Browse files
[libc++] Deprecate and remove <cstdalign>
1 parent a7fdda0 commit fdf253d

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

libcxx/docs/ReleaseNotes/20.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Deprecations and Removals
7878
supported as an extension anymore, please migrate any code that uses e.g. ``std::vector<const T>`` to be
7979
standards conforming.
8080

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.
81+
- ``<ccomplex>``, ``<cstdalign>`` (previously missing), ``<cstdbool>``, and ``<ctgmath>`` are deprecated since C++17 as
82+
specified by the standard. They, together with ``<ciso646>``, are removed in C++20, but libc++ still provides these
83+
headers as an extension and only deprecates them.
8484

8585
Upcoming Deprecations and Removals
8686
----------------------------------

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","``<ccomplex>``, ``<cstdbool>``, and ``<ctgmath>`` are deprecated since LLVM 20."
46+
"`P0063R3 <https://wg21.link/P0063R3>`__","C++17 should refer to C11 instead of C99","2016-06 (Oulu)","|Complete|","7.0","``<ccomplex>``, ``<cstdalign>``, ``<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/include/cstdalign

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,17 @@ Macros:
3232
#undef __alignof_is_defined
3333
#define __alignof_is_defined 1
3434

35+
#if _LIBCPP_STD_VER >= 17
36+
# if _LIBCPP_STD_VER >= 20
37+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED_("removed in C++20")
38+
# else
39+
# define _DEPRECATION_ANNOTATION _LIBCPP_DEPRECATED
40+
# endif
41+
42+
using __standard_header_cstdalign _DEPRECATION_ANNOTATION = void;
43+
using __use_standard_header_cstdalign = __standard_header_cstdalign;
44+
45+
# undef _DEPRECATION_ANNOTATION
46+
#endif
47+
3548
#endif // _LIBCPP_CSTDALIGN
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+
// <cstdalign>
10+
11+
// check that <cstdalign> 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 <cstdalign> // expected-warning {{'__standard_header_cstdalign' is deprecated: removed in C++20}}
19+
#else
20+
# include <cstdalign> // expected-warning {{'__standard_header_cstdalign' is deprecated}}
21+
#endif

libcxx/test/std/language.support/support.runtime/cstdalign.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 <cstdalign>
9+
// test <cstdalign> // 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 <cstdalign>
1214

0 commit comments

Comments
 (0)