Skip to content

Commit

Permalink
[libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE
Browse files Browse the repository at this point in the history
All supported compilers have been supporting __is_aggregate for a long
time now, so it's reasonable to remove this workaround.

Differential Revision: https://reviews.llvm.org/D107833
  • Loading branch information
ldionne committed Aug 11, 2021
1 parent 89a7bdb commit 7be03cc
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 110 deletions.
4 changes: 0 additions & 4 deletions libcxx/include/__config
Expand Up @@ -1363,10 +1363,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
#endif

#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
#define _LIBCPP_HAS_NO_IS_AGGREGATE
#endif

#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
#define _LIBCPP_HAS_NO_COROUTINES
#endif
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/type_traits
Expand Up @@ -1681,7 +1681,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_final_v
#endif

// is_aggregate
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
#if _LIBCPP_STD_VER > 14

template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
Expand All @@ -1692,7 +1692,7 @@ _LIBCPP_INLINE_VAR constexpr bool is_aggregate_v
= is_aggregate<_Tp>::value;
#endif

#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
#endif // _LIBCPP_STD_VER > 14

// is_base_of

Expand Down
4 changes: 1 addition & 3 deletions libcxx/include/version
Expand Up @@ -228,9 +228,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_hypot 201603L
# define __cpp_lib_incomplete_container_elements 201505L
# define __cpp_lib_invoke 201411L
# if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
# define __cpp_lib_is_aggregate 201703L
# endif
# define __cpp_lib_is_aggregate 201703L
# define __cpp_lib_is_invocable 201703L
# define __cpp_lib_is_swappable 201603L
# define __cpp_lib_launder 201606L
Expand Down

This file was deleted.

Expand Up @@ -253,17 +253,11 @@
# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++17"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++17"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++17"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
# endif

# ifdef __cpp_lib_is_constant_evaluated
Expand Down Expand Up @@ -389,17 +383,11 @@
# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++20"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++20"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++20"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++20"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++20"
# endif

# ifndef __cpp_lib_is_constant_evaluated
Expand Down Expand Up @@ -552,17 +540,11 @@
# error "__cpp_lib_integral_constant_callable should have the value 201304L in c++2b"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++2b"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++2b"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++2b"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++2b"
# endif

# ifndef __cpp_lib_is_constant_evaluated
Expand Down
Expand Up @@ -1660,17 +1660,11 @@
# error "__cpp_lib_invoke should have the value 201411L in c++17"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++17"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++17"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++17"
# endif

# ifdef __cpp_lib_is_constant_evaluated
Expand Down Expand Up @@ -2694,17 +2688,11 @@
# error "__cpp_lib_invoke should have the value 201411L in c++20"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++20"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++20"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++20"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++20"
# endif

# ifndef __cpp_lib_is_constant_evaluated
Expand Down Expand Up @@ -3869,17 +3857,11 @@
# error "__cpp_lib_invoke should have the value 201411L in c++2b"
# endif

# if TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++2b"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++2b"
# endif
# else
# ifdef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should not be defined when TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001 is not defined!"
# endif
# ifndef __cpp_lib_is_aggregate
# error "__cpp_lib_is_aggregate should be defined in c++2b"
# endif
# if __cpp_lib_is_aggregate != 201703L
# error "__cpp_lib_is_aggregate should have the value 201703L in c++2b"
# endif

# ifndef __cpp_lib_is_constant_evaluated
Expand Down
Expand Up @@ -19,7 +19,6 @@
template <class T>
void test_true()
{
#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
static_assert( std::is_aggregate<T>::value, "");
static_assert( std::is_aggregate<const T>::value, "");
static_assert( std::is_aggregate<volatile T>::value, "");
Expand All @@ -28,13 +27,11 @@ void test_true()
static_assert( std::is_aggregate_v<const T>, "");
static_assert( std::is_aggregate_v<volatile T>, "");
static_assert( std::is_aggregate_v<const volatile T>, "");
#endif
}

template <class T>
void test_false()
{
#if !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
static_assert(!std::is_aggregate<T>::value, "");
static_assert(!std::is_aggregate<const T>::value, "");
static_assert(!std::is_aggregate<volatile T>::value, "");
Expand All @@ -43,7 +40,6 @@ void test_false()
static_assert(!std::is_aggregate_v<const T>, "");
static_assert(!std::is_aggregate_v<volatile T>, "");
static_assert(!std::is_aggregate_v<const volatile T>, "");
#endif
}

struct Aggregate {};
Expand Down
2 changes: 0 additions & 2 deletions libcxx/utils/generate_feature_test_macro_components.py
Expand Up @@ -363,8 +363,6 @@ def add_version_header(tc):
"name": "__cpp_lib_is_aggregate",
"values": { "c++17": 201703 },
"headers": ["type_traits"],
"test_suite_guard": "TEST_HAS_BUILTIN_IDENTIFIER(__is_aggregate) || TEST_GCC_VER_NEW >= 7001",
"libcxx_guard": "!defined(_LIBCPP_HAS_NO_IS_AGGREGATE)",
}, {
"name": "__cpp_lib_is_constant_evaluated",
"values": { "c++20": 201811 },
Expand Down

0 comments on commit 7be03cc

Please sign in to comment.