[libcxx-commits] [libcxx] 1123100 - [libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 10 09:59:59 PDT 2021
Author: Mark de Wever
Date: 2021-08-10T18:59:55+02:00
New Revision: 1123100a16a321d70508e2508ebc5d57ce7163dc
URL: https://github.com/llvm/llvm-project/commit/1123100a16a321d70508e2508ebc5d57ce7163dc
DIFF: https://github.com/llvm/llvm-project/commit/1123100a16a321d70508e2508ebc5d57ce7163dc.diff
LOG: [libcxx] Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
All supported compilers should support
_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED so this can be removed.
Reviewed By: ldionne, #libc, Quuxplusone
Differential Revision: https://reviews.llvm.org/D107239
Added:
Modified:
libcxx/include/__config
libcxx/include/__format/format_parse_context.h
libcxx/include/type_traits
libcxx/include/version
libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 59974203ad113..f9c65cbbaff59 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1292,10 +1292,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
#endif
-#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900
-#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
-#endif
-
#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
# define _LIBCPP_DIAGNOSE_WARNING(...) \
__attribute__((diagnose_if(__VA_ARGS__, "warning")))
diff --git a/libcxx/include/__format/format_parse_context.h b/libcxx/include/__format/format_parse_context.h
index db39c1b548307..7635db0a1a83f 100644
--- a/libcxx/include/__format/format_parse_context.h
+++ b/libcxx/include/__format/format_parse_context.h
@@ -29,8 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// If the compiler has no concepts support, the format header will be disabled.
// Without concepts support enable_if needs to be used and that too much effort
// to support compilers with partial C++20 support.
-#if !defined(_LIBCPP_HAS_NO_CONCEPTS) && \
- !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
+#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
template <class _CharT>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_context {
@@ -102,7 +101,7 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_contex
using format_parse_context = basic_format_parse_context<char>;
using wformat_parse_context = basic_format_parse_context<wchar_t>;
-#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
+#endif // !defined(_LIBCPP_HAS_NO_CONCEPTS)
#endif //_LIBCPP_STD_VER > 17
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index b15c7a2a5f352..04132e3dd577c 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -4453,7 +4453,6 @@ template <class _ValTy, class _Key, class _RawValTy>
struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
: false_type {};
-#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
#if _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
inline constexpr bool is_constant_evaluated() noexcept {
@@ -4463,10 +4462,6 @@ inline constexpr bool is_constant_evaluated() noexcept {
inline _LIBCPP_CONSTEXPR
bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
-#else
-inline _LIBCPP_CONSTEXPR
-bool __libcpp_is_constant_evaluated() _NOEXCEPT { return false; }
-#endif
template <class _CharT>
using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT> >;
diff --git a/libcxx/include/version b/libcxx/include/version
index a0ec730a8ea10..6adea75405be4 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -328,9 +328,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_integer_comparison_functions 202002L
# endif
# define __cpp_lib_interpolate 201902L
-# if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
-# define __cpp_lib_is_constant_evaluated 201811L
-# endif
+# define __cpp_lib_is_constant_evaluated 201811L
// # define __cpp_lib_is_layout_compatible 201907L
# define __cpp_lib_is_nothrow_convertible 201806L
// # define __cpp_lib_is_pointer_interconvertible 201907L
diff --git a/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp b/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp
index 157d913ccfe60..55398f8ad64ba 100644
--- a/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp
+++ b/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp
@@ -23,7 +23,7 @@ int main (int, char**) {
ASSERT_SAME_TYPE(decltype(std::__libcpp_is_constant_evaluated()), bool);
ASSERT_NOEXCEPT(std::__libcpp_is_constant_evaluated());
-#if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) && !defined(_LIBCPP_CXX03_LANG)
+#if !defined(_LIBCPP_CXX03_LANG)
static_assert(std::__libcpp_is_constant_evaluated(), "");
#endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
index 368c3811532c8..c97a48b7b30c7 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.pass.cpp
@@ -402,17 +402,11 @@
# endif
# endif
-# if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900
-# ifndef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should be defined in c++20"
-# endif
-# if __cpp_lib_is_constant_evaluated != 201811L
-# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++20"
-# endif
-# else
-# ifdef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should not be defined when TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 is not defined!"
-# endif
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++20"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++20"
# endif
# ifndef __cpp_lib_is_final
@@ -571,17 +565,11 @@
# endif
# endif
-# if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900
-# ifndef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should be defined in c++2b"
-# endif
-# if __cpp_lib_is_constant_evaluated != 201811L
-# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2b"
-# endif
-# else
-# ifdef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should not be defined when TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 is not defined!"
-# endif
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2b"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2b"
# endif
# ifndef __cpp_lib_is_final
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
index f2125064bfa40..82b8d845757ba 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -2707,17 +2707,11 @@
# endif
# endif
-# if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900
-# ifndef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should be defined in c++20"
-# endif
-# if __cpp_lib_is_constant_evaluated != 201811L
-# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++20"
-# endif
-# else
-# ifdef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should not be defined when TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 is not defined!"
-# endif
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++20"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++20"
# endif
# ifndef __cpp_lib_is_final
@@ -3888,17 +3882,11 @@
# endif
# endif
-# if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900
-# ifndef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should be defined in c++2b"
-# endif
-# if __cpp_lib_is_constant_evaluated != 201811L
-# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2b"
-# endif
-# else
-# ifdef __cpp_lib_is_constant_evaluated
-# error "__cpp_lib_is_constant_evaluated should not be defined when TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900 is not defined!"
-# endif
+# ifndef __cpp_lib_is_constant_evaluated
+# error "__cpp_lib_is_constant_evaluated should be defined in c++2b"
+# endif
+# if __cpp_lib_is_constant_evaluated != 201811L
+# error "__cpp_lib_is_constant_evaluated should have the value 201811L in c++2b"
# endif
# ifndef __cpp_lib_is_final
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 9fb740f363906..0d2a77da289cc 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -369,8 +369,6 @@ def add_version_header(tc):
"name": "__cpp_lib_is_constant_evaluated",
"values": { "c++20": 201811 },
"headers": ["type_traits"],
- "test_suite_guard": "TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) || TEST_GCC_VER >= 900",
- "libcxx_guard": "!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)",
}, {
"name": "__cpp_lib_is_final",
"values": { "c++14": 201402 },
More information about the libcxx-commits
mailing list