From cfe27e79cfcbefb2b4479e04f80cbb299bc46965 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 5 Aug 2022 06:56:05 -0700 Subject: Map the absl::is_trivially_* functions to their std impl There's no point redefining these functions if they are supported by the compiler and the version of libstdc++. Also, some of the builtins used by the absl implementation of these functions (e.g. __has_trivial_destructor) have been deprecated in Clang 15. PiperOrigin-RevId: 465554125 Change-Id: I8674c3a5270ce3c654cdf58ae7dbd9d2bda8faa5 --- absl/base/config.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'absl/base') diff --git a/absl/base/config.h b/absl/base/config.h index 94f7fcb5..2faed85a 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -273,6 +273,17 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 #endif +// ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE +// +// Checks whether `std::is_trivially_copyable` is supported. +// +// Notes: Clang 15+ with libc++ supports these features, GCC hasn't been tested. +#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE) +#error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set +#elif defined(__clang__) && (__clang_major__ >= 15) +#define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1 +#endif + // ABSL_HAVE_THREAD_LOCAL // // Checks whether C++11's `thread_local` storage duration specifier is -- cgit v1.2.3