Go to the documentation of this file.
15 #ifndef ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
16 #define ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
18 #include <type_traits>
20 #include "absl/base/internal/identity.h"
56 #ifdef __cpp_inline_variables
69 #if defined(__clang__)
70 #define ABSL_INTERNAL_EXTERN_DECL(type, name) \
71 extern const ::absl::internal::identity_t<type> name;
72 #else // Otherwise, just define the macro to do nothing.
73 #define ABSL_INTERNAL_EXTERN_DECL(type, name)
74 #endif // defined(__clang__)
77 #define ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \
78 ABSL_INTERNAL_EXTERN_DECL(type, name) \
79 inline constexpr ::absl::internal::identity_t<type> name = init
89 #define ABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
90 template <class = void> \
91 struct AbslInternalInlineVariableHolder##name { \
92 static constexpr ::absl::internal::identity_t<var_type> kInstance = init; \
95 template <class AbslInternalDummy> \
96 constexpr ::absl::internal::identity_t<var_type> \
97 AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
99 static constexpr const ::absl::internal::identity_t<var_type>& \
101 AbslInternalInlineVariableHolder##name<>::kInstance; \
102 static_assert(sizeof(void (*)(decltype(name))) != 0, \
103 "Silence unused variable warnings.")
105 #endif // __cpp_inline_variables
107 #endif // ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:03