about summary refs log tree commit diff
path: root/absl/base
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2017-10-30T14·44-0700
committermisterg <misterg@google.com>2017-10-30T19·04-0400
commitc8bd28c58ba962abfe1b23633cae649099815a56 (patch)
treefcd29fd162291b36cf96f8fde9a16e3e7ca9084f /absl/base
parent0fece732a21c5ae8fef5fa8b3f0b8487bca68d83 (diff)
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
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/config.h55
-rw-r--r--absl/base/thread_annotations.h6
2 files changed, 35 insertions, 26 deletions
diff --git a/absl/base/config.h b/absl/base/config.h
index 495811bd88c3..8a44c06807f0 100644
--- a/absl/base/config.h
+++ b/absl/base/config.h
@@ -93,28 +93,6 @@
 #define ABSL_HAVE_TLS 1
 #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
 //
 // Checks whether `std::is_trivially_destructible<T>` is supported.
@@ -168,6 +146,30 @@
 #define ABSL_HAVE_THREAD_LOCAL 1
 #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
 //
 // Checks whether the __int128 compiler extension for a 128-bit integral type is
@@ -182,10 +184,17 @@
 #elif (defined(__clang__) && defined(__SIZEOF_INT128__) &&               \
        !defined(__aarch64__)) ||                                         \
     (defined(__CUDACC__) && defined(__SIZEOF_INT128__) &&                \
-     __CUDACC_VER__ >= 70000) ||                                         \
+     __CUDACC_VER_MAJOR__ >= 9) ||                                       \
     (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__) && \
      defined(__SIZEOF_INT128__))
 #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
 
 // ABSL_HAVE_EXCEPTIONS
diff --git a/absl/base/thread_annotations.h b/absl/base/thread_annotations.h
index 025a8548d5d7..53816005588e 100644
--- a/absl/base/thread_annotations.h
+++ b/absl/base/thread_annotations.h
@@ -43,9 +43,9 @@
 
 // GUARDED_BY()
 //
-// Documents if a shared variable/field needs to be protected by a mutex.
-// GUARDED_BY() allows the user to specify a particular mutex that should be
-// held when accessing the annotated variable.
+// Documents if a shared field or global variable needs to be protected by a
+// mutex. GUARDED_BY() allows the user to specify a particular mutex that
+// should be held when accessing the annotated variable.
 //
 // Example:
 //