diff options
Diffstat (limited to 'absl/base')
-rw-r--r-- | absl/base/config.h | 20 | ||||
-rw-r--r-- | absl/base/internal/sysinfo.cc | 12 |
2 files changed, 25 insertions, 7 deletions
diff --git a/absl/base/config.h b/absl/base/config.h index 6703d0eac715..a387041df673 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -176,16 +176,22 @@ // Checks whether the __int128 compiler extension for a 128-bit integral type is // supported. // -// Notes: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is -// supported, except on ppc64 and aarch64 where __int128 exists but has exhibits -// a sporadic compiler crashing bug. Nvidia's nvcc also defines __GNUC__ and -// __SIZEOF_INT128__ but not all versions actually support __int128. +// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is +// supported, but we avoid using it in certain cases: +// * On Clang: +// * Building using Clang for Windows, where the Clang runtime library has +// 128-bit support only on LP64 architectures, but Windows is LLP64. +// * Building for aarch64, where __int128 exists but has exhibits a sporadic +// compiler crashing bug. +// * On Nvidia's nvcc: +// * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions +// actually support __int128. #ifdef ABSL_HAVE_INTRINSIC_INT128 #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set #elif defined(__SIZEOF_INT128__) -#if (defined(__clang__) && !defined(__aarch64__)) || \ - (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \ - (!defined(__clang__) && !defined(__CUDACC__) && defined(__GNUC__)) +#if (defined(__clang__) && !defined(_WIN32) && !defined(__aarch64__)) || \ + (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \ + (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__)) #define ABSL_HAVE_INTRINSIC_INT128 1 #elif defined(__CUDACC__) // __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a diff --git a/absl/base/internal/sysinfo.cc b/absl/base/internal/sysinfo.cc index dca7d8fdc020..db41bacc844c 100644 --- a/absl/base/internal/sysinfo.cc +++ b/absl/base/internal/sysinfo.cc @@ -35,6 +35,10 @@ #include <sys/sysctl.h> #endif +#if defined(__myriad2__) +#include <rtems.h> +#endif + #include <string.h> #include <cassert> #include <cstdint> @@ -310,6 +314,14 @@ pid_t GetTID() { return reinterpret_cast<struct pthread_tcb *>(current_uthread)->id; } +#elif defined(__myriad2__) + +pid_t GetTID() { + uint32_t tid; + rtems_task_ident(RTEMS_SELF, 0, &tid); + return tid; +} + #else // Fallback implementation of GetTID using pthread_getspecific. |