diff options
author | Abseil Team <absl-team@google.com> | 2018-01-31 20:34:59 -0800 |
---|---|---|
committer | jueminyang <jueminyang@google.com> | 2018-02-01 10:36:37 -0500 |
commit | 0ec11bad6fc18822e851b25344f027491cc85746 (patch) | |
tree | 7122b7b3409bd457bc1edb1f1b61cd3a892feeb5 /absl/base/internal/inline_variable.h | |
parent | 8a401394b8f71da745b3ad6e7c783d7f13ef5428 (diff) |
Changes imported from Abseil "staging" branch:
- 06abebb2bdb201c572da209fc7f781d6bd774d6b Documentation fixes for `absl::optional`. by Abseil Team <absl-team@google.com>
- 42adc4c4daade2e070dc337e94d8851a1fd4bead Rolling back the previous change because `__has_warning`... by Xiaoyi Zhang <zhangxy@google.com>
- 02a42cbaa97d82ee7942bc498538359185d75087 Remove literal UTF8 strings in abseil code to avoid file ... by Jon Cohen <cohenjon@google.com>
GitOrigin-RevId: 06abebb2bdb201c572da209fc7f781d6bd774d6b
Change-Id: I4f4659c2e7ca6fc585b6c089bcf20ca61aced75d
Diffstat (limited to 'absl/base/internal/inline_variable.h')
-rw-r--r-- | absl/base/internal/inline_variable.h | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/absl/base/internal/inline_variable.h b/absl/base/internal/inline_variable.h index a65fe893..f7bb8c56 100644 --- a/absl/base/internal/inline_variable.h +++ b/absl/base/internal/inline_variable.h @@ -53,24 +53,7 @@ // it will likely be a reference type). //////////////////////////////////////////////////////////////////////////////// -// ABSL_INTERNAL_HAS_WARNING() -// -// If the compiler supports the `__has_warning` extension for detecting -// warnings, then this macro is defined to be `__has_warning`. -// -// If the compiler does not support `__has_warning`, invocations expand to 0. -// -// For clang's documentation of `__has_warning`, see -// https://clang.llvm.org/docs/LanguageExtensions.html#has-warning -#if defined(__has_warning) -#define ABSL_INTERNAL_HAS_WARNING __has_warning -#else // Otherwise, be optimistic and assume the warning is not enabled. -#define ABSL_INTERNAL_HAS_WARNING(warning) 0 -#endif // defined(__has_warning) - -// If the compiler supports inline variables and does not warn when used... -#if defined(__cpp_inline_variables) && \ - !ABSL_INTERNAL_HAS_WARNING("-Wc++98-c++11-c++14-compat") +#ifdef __cpp_inline_variables // Clang's -Wmissing-variable-declarations option erroneously warned that // inline constexpr objects need to be pre-declared. This has now been fixed, @@ -83,21 +66,19 @@ // 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__) && \ - ABSL_INTERNAL_HAS_WARNING("-Wmissing-variable-declarations") +#if defined(__clang__) #define ABSL_INTERNAL_EXTERN_DECL(type, name) \ extern const ::absl::internal::identity_t<type> name; #else // Otherwise, just define the macro to do nothing. #define ABSL_INTERNAL_EXTERN_DECL(type, name) -#endif // defined(__clang__) && - // ABSL_INTERNAL_HAS_WARNING("-Wmissing-variable-declarations") +#endif // defined(__clang__) // 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 -#else // Otherwise, we need to emulate inline variables... +#else // See above comment at top of file for details. // @@ -121,7 +102,6 @@ static_assert(sizeof(void (*)(decltype(name))) != 0, \ "Silence unused variable warnings.") -#endif // defined(__cpp_inline_variables) && - // !ABSL_INTERNAL_HAS_WARNING("-Wc++98-c++11-c++14-compat") +#endif // __cpp_inline_variables #endif // ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_ |