[libcxx-commits] [libcxx] 7be03cc - [libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 11 07:11:08 PDT 2021


Author: Louis Dionne
Date: 2021-08-11T10:10:53-04:00
New Revision: 7be03cc782d090b960f3f9ed9fe4aa6f3b47e5f5

URL: https://github.com/llvm/llvm-project/commit/7be03cc782d090b960f3f9ed9fe4aa6f3b47e5f5
DIFF: https://github.com/llvm/llvm-project/commit/7be03cc782d090b960f3f9ed9fe4aa6f3b47e5f5.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/include/type_traits
    libcxx/include/version
    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/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
    libcxx/utils/generate_feature_test_macro_components.py

Removed: 
    libcxx/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.compile.fail.cpp


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index f9c65cbbaff59..a0b645c891fa7 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -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

diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 04132e3dd577c..0d060b6578dab 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -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
 

diff  --git a/libcxx/include/version b/libcxx/include/version
index 6adea75405be4..ce094f88b1cd7 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -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

diff  --git a/libcxx/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.compile.fail.cpp b/libcxx/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.compile.fail.cpp
deleted file mode 100644
index 183019cf7b383..0000000000000
--- a/libcxx/test/libcxx/utilities/meta/meta.unary/meta.unary.prop/missing_is_aggregate_trait.compile.fail.cpp
+++ /dev/null
@@ -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;
-}

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 c97a48b7b30c7..1e270d3739fdc 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
@@ -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

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 82b8d845757ba..2c01e79f4bd0f 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
@@ -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

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
index 100c5271a6cda..277e154712f35 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_aggregate.pass.cpp
@@ -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 {};

diff  --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 0d2a77da289cc..577faa3bbd190 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -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 },


        


More information about the libcxx-commits mailing list