forked from OSchip/llvm-project
[libc++] Implement P0154R1 (Hardware inference size)
`__GCC_CONSTRUCTIVE_SIZE` and `__GCC_DESTRUCTIVE_SIZE` are available since GCC 12. I'm assuming clang will also implement these for compatability with libstdc++. Reviewed By: ldionne, #libc Spies: h-vetinari, libcxx-commits, arichardson Differential Revision: https://reviews.llvm.org/D122276
This commit is contained in:
parent
758504b8ab
commit
56a33ba3dd
|
@ -100,7 +100,7 @@ Status
|
|||
------------------------------------------------- -----------------
|
||||
``__cpp_lib_gcd_lcm`` ``201606L``
|
||||
------------------------------------------------- -----------------
|
||||
``__cpp_lib_hardware_interference_size`` *unimplemented*
|
||||
``__cpp_lib_hardware_interference_size`` ``201703L``
|
||||
------------------------------------------------- -----------------
|
||||
``__cpp_lib_has_unique_object_representations`` ``201606L``
|
||||
------------------------------------------------- -----------------
|
||||
|
|
|
@ -45,6 +45,7 @@ Implemented Papers
|
|||
- P2216R3 (std::format improvements)
|
||||
- P0174R2 (Deprecating Vestigial Library Parts in C++17)
|
||||
- N4190 (Removing auto_ptr, random_shuffle(), And Old <functional> Stuff)
|
||||
- P0154R1 (Hardware inference size)
|
||||
|
||||
- Marked the following papers as "Complete" (note that some of those might have
|
||||
been implemented in a previous release but not marked as such):
|
||||
|
|
|
@ -42,7 +42,7 @@ Paper Status
|
|||
|
||||
.. [#note-P0067] P0067: ``std::(to|from)_chars`` for integrals has been available since version 7.0. ``std::to_chars`` for ``float`` and ``double`` since version 14.0 ``std::to_chars`` for ``long double`` uses the implementation for ``double``.
|
||||
.. [#note-P0607] P0607: The parts of P0607 that are not done are the ``<regex>`` bits.
|
||||
|
||||
.. [#note-P0154] P0154: This is currently not implemented for clang because clang does not implement the required macros.
|
||||
|
||||
.. _issues-status-cxx17:
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"`P0185R1 <https://wg21.link/P0185R1>`__","LWG","Adding [nothrow-]swappable traits","Jacksonville","|Complete|","3.9"
|
||||
"`P0253R1 <https://wg21.link/P0253R1>`__","LWG","Fixing a design mistake in the searchers interface","Jacksonville","|Complete|","3.9"
|
||||
"`P0025R0 <https://wg21.link/P0025R0>`__","LWG","An algorithm to ""clamp"" a value between a pair of boundary values","Jacksonville","|Complete|","3.9"
|
||||
"`P0154R1 <https://wg21.link/P0154R1>`__","LWG","constexpr std::hardware_{constructive,destructive}_interference_size","Jacksonville","",""
|
||||
"`P0154R1 <https://wg21.link/P0154R1>`__","LWG","constexpr std::hardware_{constructive,destructive}_interference_size","Jacksonville","|Partial| [#note-P0154]_","15.0"
|
||||
"`P0030R1 <https://wg21.link/P0030R1>`__","LWG","Proposal to Introduce a 3-Argument Overload to std::hypot","Jacksonville","|Complete|","3.9"
|
||||
"`P0031R0 <https://wg21.link/P0031R0>`__","LWG","A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access","Jacksonville","|Complete|","4.0"
|
||||
"`P0272R1 <https://wg21.link/P0272R1>`__","LWG","Give ``std::string``\ a non-const ``.data()``\ member function","Jacksonville","|Complete|","3.9"
|
||||
|
|
|
|
@ -360,6 +360,17 @@ constexpr _Tp* launder(_Tp* __p) noexcept
|
|||
}
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
#if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
|
||||
inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE;
|
||||
inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE;
|
||||
|
||||
#endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_NEW
|
||||
|
|
|
@ -247,7 +247,9 @@ __cpp_lib_void_t 201411L <type_traits>
|
|||
# define __cpp_lib_filesystem 201703L
|
||||
# endif
|
||||
# define __cpp_lib_gcd_lcm 201606L
|
||||
// # define __cpp_lib_hardware_interference_size 201703L
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# define __cpp_lib_hardware_interference_size 201703L
|
||||
# endif
|
||||
# define __cpp_lib_has_unique_object_representations 201606L
|
||||
# define __cpp_lib_hypot 201603L
|
||||
# define __cpp_lib_incomplete_container_elements 201505L
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14
|
||||
// XFAIL: (clang || apple-clang) && stdlib=libc++
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
ASSERT_SAME_TYPE(decltype(std::hardware_destructive_interference_size), const std::size_t);
|
||||
ASSERT_SAME_TYPE(decltype(std::hardware_constructive_interference_size), const std::size_t);
|
|
@ -58,16 +58,16 @@
|
|||
# error "__cpp_lib_destroying_delete should not be defined before c++20"
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++17"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
@ -93,16 +93,16 @@
|
|||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++20"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++20"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
@ -128,16 +128,16 @@
|
|||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++2b"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2b"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
|
|
@ -1806,16 +1806,16 @@
|
|||
# error "__cpp_lib_generic_unordered_lookup should not be defined before c++20"
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++17"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
@ -2851,16 +2851,16 @@
|
|||
# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++20"
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++20"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++20"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
@ -4088,16 +4088,16 @@
|
|||
# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2b"
|
||||
# endif
|
||||
|
||||
# if !defined(_LIBCPP_VERSION)
|
||||
# if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)
|
||||
# ifndef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should be defined in c++2b"
|
||||
# endif
|
||||
# if __cpp_lib_hardware_interference_size != 201703L
|
||||
# error "__cpp_lib_hardware_interference_size should have the value 201703L in c++2b"
|
||||
# endif
|
||||
# else // _LIBCPP_VERSION
|
||||
# else
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined because it is unimplemented in libc++!"
|
||||
# error "__cpp_lib_hardware_interference_size should not be defined when defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) is not defined!"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
|
|
@ -329,8 +329,9 @@ feature_test_macros = [ add_version_header(x) for x in [
|
|||
}, {
|
||||
"name": "__cpp_lib_hardware_interference_size",
|
||||
"values": { "c++17": 201703 },
|
||||
"test_suite_guard": "defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)",
|
||||
"libcxx_guard": "defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)",
|
||||
"headers": ["new"],
|
||||
"unimplemented": True,
|
||||
}, {
|
||||
"name": "__cpp_lib_has_unique_object_representations",
|
||||
"values": { "c++17": 201606 },
|
||||
|
|
Loading…
Reference in New Issue