[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
This commit is contained in:
Mark de Wever 2022-02-11 19:34:33 +01:00
parent 1e47888de6
commit 93b333908d
7 changed files with 13 additions and 17 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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 { };

View File

@ -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

View File

@ -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

View File

@ -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