aboutsummaryrefslogtreecommitdiff
path: root/absl/base/internal/inline_variable.h
diff options
context:
space:
mode:
authorBenjamin Barenblat <bbaren@google.com>2024-05-08 10:59:21 -0400
committerBenjamin Barenblat <bbaren@google.com>2024-05-08 10:59:21 -0400
commitd8e2b896d5e3c1ebf2d6d0d37bd9e7a1b59e0b99 (patch)
tree33d0793fcdd3615f21e5b4f0e50ae20811a5bde5 /absl/base/internal/inline_variable.h
parent57fc09f12cfb9642e7ebd4ca3c64d07154d2de9a (diff)
parentd7aaad83b488fd62bd51c81ecf16cd938532cc0a (diff)
downloadabseil-d8e2b896d5e3c1ebf2d6d0d37bd9e7a1b59e0b99.tar.gz
abseil-d8e2b896d5e3c1ebf2d6d0d37bd9e7a1b59e0b99.tar.bz2
abseil-d8e2b896d5e3c1ebf2d6d0d37bd9e7a1b59e0b99.zip
Merge new upstream LTS 20240116.2
Diffstat (limited to 'absl/base/internal/inline_variable.h')
-rw-r--r--absl/base/internal/inline_variable.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/absl/base/internal/inline_variable.h b/absl/base/internal/inline_variable.h
index df933faf..09daf0f5 100644
--- a/absl/base/internal/inline_variable.h
+++ b/absl/base/internal/inline_variable.h
@@ -63,12 +63,12 @@
// Bug: https://bugs.llvm.org/show_bug.cgi?id=35862
//
// Note:
-// identity_t is used here so that the const and name are in the
+// type_identity_t is used here so that the const and name are in the
// appropriate place for pointer types, reference types, function pointer
// types, etc..
#if defined(__clang__)
#define ABSL_INTERNAL_EXTERN_DECL(type, name) \
- extern const ::absl::internal::identity_t<type> name;
+ extern const ::absl::internal::type_identity_t<type> name;
#else // Otherwise, just define the macro to do nothing.
#define ABSL_INTERNAL_EXTERN_DECL(type, name)
#endif // defined(__clang__)
@@ -76,30 +76,31 @@
// See above comment at top of file for details.
#define ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \
ABSL_INTERNAL_EXTERN_DECL(type, name) \
- inline constexpr ::absl::internal::identity_t<type> name = init
+ inline constexpr ::absl::internal::type_identity_t<type> name = init
#else
// See above comment at top of file for details.
//
// Note:
-// identity_t is used here so that the const and name are in the
+// type_identity_t is used here so that the const and name are in the
// appropriate place for pointer types, reference types, function pointer
// types, etc..
-#define ABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
- template <class /*AbslInternalDummy*/ = void> \
- struct AbslInternalInlineVariableHolder##name { \
- static constexpr ::absl::internal::identity_t<var_type> kInstance = init; \
- }; \
- \
- template <class AbslInternalDummy> \
- constexpr ::absl::internal::identity_t<var_type> \
- AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
- \
- static constexpr const ::absl::internal::identity_t<var_type>& \
- name = /* NOLINT */ \
- AbslInternalInlineVariableHolder##name<>::kInstance; \
- static_assert(sizeof(void (*)(decltype(name))) != 0, \
+#define ABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
+ template <class /*AbslInternalDummy*/ = void> \
+ struct AbslInternalInlineVariableHolder##name { \
+ static constexpr ::absl::internal::type_identity_t<var_type> kInstance = \
+ init; \
+ }; \
+ \
+ template <class AbslInternalDummy> \
+ constexpr ::absl::internal::type_identity_t<var_type> \
+ AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
+ \
+ static constexpr const ::absl::internal::type_identity_t<var_type>& \
+ name = /* NOLINT */ \
+ AbslInternalInlineVariableHolder##name<>::kInstance; \
+ static_assert(sizeof(void (*)(decltype(name))) != 0, \
"Silence unused variable warnings.")
#endif // __cpp_inline_variables