[libcxx-commits] [libcxx] 93b3339 - [libc++] Remove _LIBCPP_HAS_NO_STRONG_ENUMS.
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 1 11:27:25 PST 2022
Author: Mark de Wever
Date: 2022-03-01T20:27:20+01:00
New Revision: 93b333908d0ddeb637d78ab4e84acfa4699a7da5
URL: https://github.com/llvm/llvm-project/commit/93b333908d0ddeb637d78ab4e84acfa4699a7da5
DIFF: https://github.com/llvm/llvm-project/commit/93b333908d0ddeb637d78ab4e84acfa4699a7da5.diff
LOG: [libc++] Remove _LIBCPP_HAS_NO_STRONG_ENUMS.
All supported compilers have implemented this feature.
Therefore use the language version instead of the feature macro.
Reviewed By: #libc, philnik, ldionne, Quuxplusone
Differential Revision: https://reviews.llvm.org/D119865
Added:
Modified:
libcxx/include/__config
libcxx/include/future
libcxx/include/ios
libcxx/include/system_error
libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp
libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index aba04f84d64b8..3e86b17eb5d5c 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -495,10 +495,6 @@ typedef __char32_t char32_t;
# define _LIBCPP_NO_EXCEPTIONS
#endif
-#if !(__has_feature(cxx_strong_enums))
-#define _LIBCPP_HAS_NO_STRONG_ENUMS
-#endif
-
#if __has_feature(cxx_attributes)
# define _LIBCPP_NORETURN [[noreturn]]
#else
@@ -862,7 +858,7 @@ typedef unsigned int char32_t;
# define _LIBCPP_USING_IF_EXISTS
#endif
-#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifdef _LIBCPP_CXX03_LANG
# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
__lx __v_; \
@@ -870,10 +866,10 @@ typedef unsigned int char32_t;
_LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \
};
-#else // _LIBCPP_HAS_NO_STRONG_ENUMS
+#else // _LIBCPP_CXX03_LANG
# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
-#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif // _LIBCPP_CXX03_LANG
// _LIBCPP_DEBUG potential values:
// - undefined: No assertions. This is the default.
diff --git a/libcxx/include/future b/libcxx/include/future
index 7ef62dbdea9d2..a4c8ccc6d61e0 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -400,7 +400,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
template <>
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc> : public true_type {};
-#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifdef _LIBCPP_CXX03_LANG
template <>
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<future_errc::__lx> : public true_type { };
#endif
@@ -414,7 +414,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(launch)
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
-#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifndef _LIBCPP_CXX03_LANG
typedef underlying_type<launch>::type __launch_underlying_type;
@@ -474,7 +474,7 @@ operator^=(launch& __x, launch __y)
__x = __x ^ __y; return __x;
}
-#endif // !_LIBCPP_HAS_NO_STRONG_ENUMS
+#endif // !_LIBCPP_CXX03_LANG
//enum class future_status
_LIBCPP_DECLARE_STRONG_ENUM(future_status)
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 6c8267a39c765..d179f0c242000 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -403,7 +403,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
template <>
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type { };
-#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifdef _LIBCPP_CXX03_LANG
template <>
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };
#endif
diff --git a/libcxx/include/system_error b/libcxx/include/system_error
index 66a3f3c1e0b7f..48a6b2e503f1d 100644
--- a/libcxx/include/system_error
+++ b/libcxx/include/system_error
@@ -183,7 +183,7 @@ template <>
struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc>
: true_type { };
-#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#ifdef _LIBCPP_CXX03_LANG
template <>
struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc::__lx>
: true_type { };
diff --git a/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp b/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp
index 6d405b508eddf..590ddd05b9e7e 100644
--- a/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp
+++ b/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp
@@ -24,7 +24,7 @@
int main(int, char**)
{
-#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#if TEST_STD_VER < 11
LIBCPP_STATIC_ASSERT(static_cast<int>(std::launch::any) ==
(static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), "");
#else
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
index bf43d6d690c36..705c8748d24ed 100644
--- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_signed.pass.cpp
@@ -26,7 +26,7 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL
};
-#if !defined(TEST_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
+#if !defined(TEST_HAS_NO_INT128) && TEST_STD_VER >= 11
enum HugeEnum : __uint128_t
{
hugezero
@@ -62,7 +62,7 @@ int main(int, char**)
#ifndef TEST_HAS_NO_INT128
test_make_signed< __int128_t, __int128_t >();
test_make_signed< __uint128_t, __int128_t >();
-# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
+# if TEST_STD_VER >= 11
test_make_signed< HugeEnum, __int128_t >();
# endif
#endif
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
index e513997158211..c2b96c0a611b9 100644
--- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.sign/make_unsigned.pass.cpp
@@ -26,7 +26,7 @@ enum BigEnum
big = 0xFFFFFFFFFFFFFFFFULL
};
-#if !defined(TEST_HAS_NO_INT128) && !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)
+#if !defined(TEST_HAS_NO_INT128) && TEST_STD_VER >= 11
enum HugeEnum : __int128_t
{
hugezero
@@ -63,7 +63,7 @@ int main(int, char**)
#ifndef TEST_HAS_NO_INT128
test_make_unsigned<__int128_t, __uint128_t>();
test_make_unsigned<__uint128_t, __uint128_t>();
-# ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
+# if TEST_STD_VER >= 11
test_make_unsigned<HugeEnum, __uint128_t>();
# endif
#endif
More information about the libcxx-commits
mailing list