Changes imported from Abseil "staging" branch:

- 0726b35bb91aa98b87b340db9019fe7bdb19fe52 Fixing typo when checking CUDA compiler version, and use ... by Abseil Team <absl-team@google.com>
  - 3c94139e0e2ca6387c0498f24c9e44172208fffc Update comment of GUARDED_BY to match feedback provided b... by Abseil Team <absl-team@google.com>
  - 116d0427b845613213e26afc1203621ac7bd6910 Turn off ABSL TLS support for buggy versions of the Andro... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 0726b35bb91aa98b87b340db9019fe7bdb19fe52
Change-Id: I861e4fb27d77904e705ccbcb4054f10c3f43e158
This commit is contained in:
Abseil Team 2017-10-30 07:44:54 -07:00 committed by misterg
parent 0fece732a2
commit c8bd28c58b
2 changed files with 35 additions and 26 deletions

View file

@ -93,28 +93,6 @@
#define ABSL_HAVE_TLS 1 #define ABSL_HAVE_TLS 1
#endif #endif
// There are platforms for which TLS should not be used even though the compiler
// makes it seem like it's supported (Android NDK < r12b for example).
// This is primarily because of linker problems and toolchain misconfiguration:
// Abseil does not intend to support this indefinitely. Currently, the newest
// toolchain that we intend to support that requires this behavior is the
// r11 NDK - allowing for a 5 year support window on that means this option
// is likely to be removed around June of 2021.
#if defined(__ANDROID__) && defined(__clang__)
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif
// TLS isn't supported until NDK r12b per
// https://developer.android.com/ndk/downloads/revision_history.html
// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
// <android/ndk-version.h>. For NDK < r16, users should define these macros,
// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
#if defined(__NDK_MAJOR__) && defined(__NDK_MINOR__) && \
((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
#undef ABSL_HAVE_TLS
#endif
#endif // defined(__ANDROID__) && defined(__clang__)
// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
// //
// Checks whether `std::is_trivially_destructible<T>` is supported. // Checks whether `std::is_trivially_destructible<T>` is supported.
@ -168,6 +146,30 @@
#define ABSL_HAVE_THREAD_LOCAL 1 #define ABSL_HAVE_THREAD_LOCAL 1
#endif #endif
// There are platforms for which TLS should not be used even though the compiler
// makes it seem like it's supported (Android NDK < r12b for example).
// This is primarily because of linker problems and toolchain misconfiguration:
// Abseil does not intend to support this indefinitely. Currently, the newest
// toolchain that we intend to support that requires this behavior is the
// r11 NDK - allowing for a 5 year support window on that means this option
// is likely to be removed around June of 2021.
// TLS isn't supported until NDK r12b per
// https://developer.android.com/ndk/downloads/revision_history.html
// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
// <android/ndk-version.h>. For NDK < r16, users should define these macros,
// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
#if defined(__ANDROID__) && defined(__clang__)
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif // __has_include(<android/ndk-version.h>)
#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
defined(__NDK_MINOR__) && \
((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
#undef ABSL_HAVE_TLS
#undef ABSL_HAVE_THREAD_LOCAL
#endif
#endif // defined(__ANDROID__) && defined(__clang__)
// ABSL_HAVE_INTRINSIC_INT128 // ABSL_HAVE_INTRINSIC_INT128
// //
// Checks whether the __int128 compiler extension for a 128-bit integral type is // Checks whether the __int128 compiler extension for a 128-bit integral type is
@ -182,10 +184,17 @@
#elif (defined(__clang__) && defined(__SIZEOF_INT128__) && \ #elif (defined(__clang__) && defined(__SIZEOF_INT128__) && \
!defined(__aarch64__)) || \ !defined(__aarch64__)) || \
(defined(__CUDACC__) && defined(__SIZEOF_INT128__) && \ (defined(__CUDACC__) && defined(__SIZEOF_INT128__) && \
__CUDACC_VER__ >= 70000) || \ __CUDACC_VER_MAJOR__ >= 9) || \
(!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \ (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \
defined(__SIZEOF_INT128__)) defined(__SIZEOF_INT128__))
#define ABSL_HAVE_INTRINSIC_INT128 1 #define ABSL_HAVE_INTRINSIC_INT128 1
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
// std::string explaining that it has been removed starting with CUDA 9. We can't
// compare both variants in a single boolean expression because there is no
// short-circuiting in the preprocessor.
#elif defined(__CUDACC__) && defined(__SIZEOF_INT128__) && \
__CUDACC_VER__ >= 7000
#define ABSL_HAVE_INTRINSIC_INT128 1
#endif #endif
// ABSL_HAVE_EXCEPTIONS // ABSL_HAVE_EXCEPTIONS

View file

@ -43,9 +43,9 @@
// GUARDED_BY() // GUARDED_BY()
// //
// Documents if a shared variable/field needs to be protected by a mutex. // Documents if a shared field or global variable needs to be protected by a
// GUARDED_BY() allows the user to specify a particular mutex that should be // mutex. GUARDED_BY() allows the user to specify a particular mutex that
// held when accessing the annotated variable. // should be held when accessing the annotated variable.
// //
// Example: // Example:
// //