[libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE

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
This commit is contained in:
Louis Dionne 2021-08-10 12:44:20 -04:00
parent 89a7bdb1f3
commit 7be03cc782
8 changed files with 33 additions and 110 deletions

View File

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

View File

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

View File

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

View File

@ -1,29 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
// <type_traits>
// template <class T> struct is_aggregate;
// template <class T> constexpr bool is_aggregate_v = is_aggregate<T>::value;
#include <type_traits>
int main(int, char**)
{
#ifdef _LIBCPP_HAS_NO_IS_AGGREGATE
// This should not compile when _LIBCPP_HAS_NO_IS_AGGREGATE is defined.
bool b = __is_aggregate(void);
((void)b);
#else
#error Forcing failure...
#endif
return 0;
}

View File

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

View File

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

View File

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

View File

@ -363,8 +363,6 @@ feature_test_macros = [ add_version_header(x) for x in [
"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 },