[libc++] [P1612] Add missing feature-test macro __cpp_lib_endian.
Thanks to Marek Kurdej for the patch.
Differential Revision: https://reviews.llvm.org/D70221
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 8b77a3a0f4ef8c2cda3a0437fe54e2c2ecef1b17
diff --git a/docs/FeatureTestMacroTable.rst b/docs/FeatureTestMacroTable.rst
index 2200a99..3dd00fa 100644
--- a/docs/FeatureTestMacroTable.rst
+++ b/docs/FeatureTestMacroTable.rst
@@ -20,7 +20,7 @@
.. table:: Current Status
:name: feature-status-table
:widths: auto
-
+
================================================= =================
Macro Name Value
================================================= =================
@@ -184,6 +184,8 @@
------------------------------------------------- -----------------
``__cpp_lib_destroying_delete`` ``201806L``
------------------------------------------------- -----------------
+ ``__cpp_lib_endian`` ``201907L``
+ ------------------------------------------------- -----------------
``__cpp_lib_erase_if`` ``201811L``
------------------------------------------------- -----------------
``__cpp_lib_generic_unordered_lookup`` *unimplemented*
diff --git a/include/version b/include/version
index fe9cfed..2abc71e 100644
--- a/include/version
+++ b/include/version
@@ -43,6 +43,7 @@
__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
__cpp_lib_destroying_delete 201806L <new>
__cpp_lib_enable_shared_from_this 201603L <memory>
+__cpp_lib_endian 201907L <bit>
__cpp_lib_erase_if 201811L <string> <deque> <forward_list>
<list> <vector> <map>
<set> <unordered_map> <unordered_set>
@@ -223,6 +224,7 @@
# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
# define __cpp_lib_destroying_delete 201806L
# endif
+# define __cpp_lib_endian 201907L
# define __cpp_lib_erase_if 201811L
// # define __cpp_lib_generic_unordered_lookup 201811L
# define __cpp_lib_interpolate 201902L
diff --git a/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
index 3e42d06..4f99d8d 100644
--- a/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
+++ b/test/std/language.support/support.limits/support.limits.general/bit.version.pass.cpp
@@ -15,6 +15,7 @@
/* Constant Value
__cpp_lib_bit_cast 201806L [C++2a]
+ __cpp_lib_endian 201907L [C++2a]
*/
#include <bit>
@@ -26,18 +27,30 @@
# error "__cpp_lib_bit_cast should not be defined before c++2a"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
#elif TEST_STD_VER == 14
# ifdef __cpp_lib_bit_cast
# error "__cpp_lib_bit_cast should not be defined before c++2a"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
#elif TEST_STD_VER == 17
# ifdef __cpp_lib_bit_cast
# error "__cpp_lib_bit_cast should not be defined before c++2a"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
#elif TEST_STD_VER > 17
# if !defined(_LIBCPP_VERSION)
@@ -53,6 +66,13 @@
# endif
# endif
+# ifndef __cpp_lib_endian
+# error "__cpp_lib_endian should be defined in c++2a"
+# endif
+# if __cpp_lib_endian != 201907L
+# error "__cpp_lib_endian should have the value 201907L in c++2a"
+# endif
+
#endif // TEST_STD_VER > 17
int main(int, char**) { return 0; }
diff --git a/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
index 3503051..e721b73 100644
--- a/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ b/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -37,6 +37,7 @@
__cpp_lib_constexpr_swap_algorithms 201806L [C++2a]
__cpp_lib_destroying_delete 201806L [C++2a]
__cpp_lib_enable_shared_from_this 201603L [C++17]
+ __cpp_lib_endian 201907L [C++2a]
__cpp_lib_erase_if 201811L [C++2a]
__cpp_lib_exchange_function 201304L [C++14]
__cpp_lib_execution 201603L [C++17]
@@ -197,6 +198,10 @@
# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
# ifdef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should not be defined before c++2a"
# endif
@@ -537,6 +542,10 @@
# error "__cpp_lib_enable_shared_from_this should not be defined before c++17"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
# ifdef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should not be defined before c++2a"
# endif
@@ -994,6 +1003,10 @@
# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++17"
# endif
+# ifdef __cpp_lib_endian
+# error "__cpp_lib_endian should not be defined before c++2a"
+# endif
+
# ifdef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should not be defined before c++2a"
# endif
@@ -1682,6 +1695,13 @@
# error "__cpp_lib_enable_shared_from_this should have the value 201603L in c++2a"
# endif
+# ifndef __cpp_lib_endian
+# error "__cpp_lib_endian should be defined in c++2a"
+# endif
+# if __cpp_lib_endian != 201907L
+# error "__cpp_lib_endian should have the value 201907L in c++2a"
+# endif
+
# ifndef __cpp_lib_erase_if
# error "__cpp_lib_erase_if should be defined in c++2a"
# endif
diff --git a/utils/generate_feature_test_macro_components.py b/utils/generate_feature_test_macro_components.py
index b172193..a6191a5 100755
--- a/utils/generate_feature_test_macro_components.py
+++ b/utils/generate_feature_test_macro_components.py
@@ -580,6 +580,12 @@
},
"headers": ["numeric"],
},
+ {"name": "__cpp_lib_endian",
+ "values": {
+ "c++2a": int(201907),
+ },
+ "headers": ["bit"],
+ },
]], key=lambda tc: tc["name"])
def get_std_dialects():
diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html
index 995e161..cf2e397 100644
--- a/www/cxx2a_status.html
+++ b/www/cxx2a_status.html
@@ -181,7 +181,7 @@
<tr><td><a href="https://wg21.link/P1502">P1502</a></td><td>LWG</td><td>Standard library header units for C++20</td><td>Cologne</td><td></td><td></td></tr>
<tr><td><a href="https://wg21.link/P1522">P1522</a></td><td>LWG</td><td>Iterator Difference Type and Integer Overflow</td><td>Cologne</td><td></td><td></td></tr>
<tr><td><a href="https://wg21.link/P1523">P1523</a></td><td>LWG</td><td>Views and Size Types</td><td>Cologne</td><td></td><td></td></tr>
- <tr><td><a href="https://wg21.link/P1612">P1612</a></td><td>LWG</td><td>Relocate Endian’s Specification</td><td>Cologne</td><td></td><td></td></tr>
+ <tr><td><a href="https://wg21.link/P1612">P1612</a></td><td>LWG</td><td>Relocate Endian’s Specification</td><td>Cologne</td><td>Complete</td><td>10.0</td></tr>
<tr><td><a href="https://wg21.link/P1614">P1614</a></td><td>LWG</td><td>The Mothership has Landed</td><td>Cologne</td><td></td><td></td></tr>
<tr><td><a href="https://wg21.link/P1638">P1638</a></td><td>LWG</td><td>basic_istream_view::iterator should not be copyable</td><td>Cologne</td><td></td><td></td></tr>
<tr><td><a href="https://wg21.link/P1643">P1643</a></td><td>LWG</td><td>Add wait/notify to atomic_ref</td><td>Cologne</td><td></td><td></td></tr>