1 // 2 // Copyright 2017 The Abseil Authors. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // https://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 // ----------------------------------------------------------------------------- 17 // File: config.h 18 // ----------------------------------------------------------------------------- 19 // 20 // This header file defines a set of macros for checking the presence of 21 // important compiler and platform features. Such macros can be used to 22 // produce portable code by parameterizing compilation based on the presence or 23 // lack of a given feature. 24 // 25 // We define a "feature" as some interface we wish to program to: for example, 26 // a library function or system call. A value of `1` indicates support for 27 // that feature; any other value indicates the feature support is undefined. 28 // 29 // Example: 30 // 31 // Suppose a programmer wants to write a program that uses the 'mmap()' system 32 // call. The Abseil macro for that feature (`ABSL_HAVE_MMAP`) allows you to 33 // selectively include the `mmap.h` header and bracket code using that feature 34 // in the macro: 35 // 36 // #include "absl/base/config.h" 37 // 38 // #ifdef ABSL_HAVE_MMAP 39 // #include "sys/mman.h" 40 // #endif //ABSL_HAVE_MMAP 41 // 42 // ... 43 // #ifdef ABSL_HAVE_MMAP 44 // void *ptr = mmap(...); 45 // ... 46 // #endif // ABSL_HAVE_MMAP 47 48 #ifndef ABSL_BASE_CONFIG_H_ 49 #define ABSL_BASE_CONFIG_H_ 50 51 // Included for the __GLIBC__ macro (or similar macros on other systems). 52 #include <limits.h> 53 54 #ifdef __cplusplus 55 // Included for __GLIBCXX__, _LIBCPP_VERSION 56 #include <cstddef> 57 #endif // __cplusplus 58 59 // ABSL_INTERNAL_CPLUSPLUS_LANG 60 // 61 // MSVC does not set the value of __cplusplus correctly, but instead uses 62 // _MSVC_LANG as a stand-in. 63 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros 64 // 65 // However, there are reports that MSVC even sets _MSVC_LANG incorrectly at 66 // times, for example: 67 // https://github.com/microsoft/vscode-cpptools/issues/1770 68 // https://reviews.llvm.org/D70996 69 // 70 // For this reason, this symbol is considered INTERNAL and code outside of 71 // Abseil must not use it. 72 #if defined(_MSVC_LANG) 73 #define ABSL_INTERNAL_CPLUSPLUS_LANG _MSVC_LANG 74 #elif defined(__cplusplus) 75 #define ABSL_INTERNAL_CPLUSPLUS_LANG __cplusplus 76 #endif 77 78 #if defined(__APPLE__) 79 // Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED, 80 // __IPHONE_8_0. 81 #include <Availability.h> 82 #include <TargetConditionals.h> 83 #endif 84 85 #include "absl/base/options.h" 86 #include "absl/base/policy_checks.h" 87 88 // Abseil long-term support (LTS) releases will define 89 // `ABSL_LTS_RELEASE_VERSION` to the integer representing the date string of the 90 // LTS release version, and will define `ABSL_LTS_RELEASE_PATCH_LEVEL` to the 91 // integer representing the patch-level for that release. 92 // 93 // For example, for LTS release version "20300401.2", this would give us 94 // ABSL_LTS_RELEASE_VERSION == 20300401 && ABSL_LTS_RELEASE_PATCH_LEVEL == 2 95 // 96 // These symbols will not be defined in non-LTS code. 97 // 98 // Abseil recommends that clients live-at-head. Therefore, if you are using 99 // these symbols to assert a minimum version requirement, we recommend you do it 100 // as 101 // 102 // #if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20300401 103 // #error Project foo requires Abseil LTS version >= 20300401 104 // #endif 105 // 106 // The `defined(ABSL_LTS_RELEASE_VERSION)` part of the check excludes 107 // live-at-head clients from the minimum version assertion. 108 // 109 // See https://abseil.io/about/releases for more information on Abseil release 110 // management. 111 // 112 // LTS releases can be obtained from 113 // https://github.com/abseil/abseil-cpp/releases. 114 #undef ABSL_LTS_RELEASE_VERSION 115 #undef ABSL_LTS_RELEASE_PATCH_LEVEL 116 117 // Helper macro to convert a CPP variable to a string literal. 118 #define ABSL_INTERNAL_DO_TOKEN_STR(x) #x 119 #define ABSL_INTERNAL_TOKEN_STR(x) ABSL_INTERNAL_DO_TOKEN_STR(x) 120 121 // ----------------------------------------------------------------------------- 122 // Abseil namespace annotations 123 // ----------------------------------------------------------------------------- 124 125 // ABSL_NAMESPACE_BEGIN/ABSL_NAMESPACE_END 126 // 127 // An annotation placed at the beginning/end of each `namespace absl` scope. 128 // This is used to inject an inline namespace. 129 // 130 // The proper way to write Abseil code in the `absl` namespace is: 131 // 132 // namespace absl { 133 // ABSL_NAMESPACE_BEGIN 134 // 135 // void Foo(); // absl::Foo(). 136 // 137 // ABSL_NAMESPACE_END 138 // } // namespace absl 139 // 140 // Users of Abseil should not use these macros, because users of Abseil should 141 // not write `namespace absl {` in their own code for any reason. (Abseil does 142 // not support forward declarations of its own types, nor does it support 143 // user-provided specialization of Abseil templates. Code that violates these 144 // rules may be broken without warning.) 145 #if !defined(ABSL_OPTION_USE_INLINE_NAMESPACE) || \ 146 !defined(ABSL_OPTION_INLINE_NAMESPACE_NAME) 147 #error options.h is misconfigured. 148 #endif 149 150 // Check that ABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor "" 151 #if defined(__cplusplus) && ABSL_OPTION_USE_INLINE_NAMESPACE == 1 152 153 #define ABSL_INTERNAL_INLINE_NAMESPACE_STR \ 154 ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) 155 156 static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0', 157 "options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must " 158 "not be empty."); 159 static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || 160 ABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' || 161 ABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' || 162 ABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' || 163 ABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0', 164 "options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must " 165 "be changed to a new, unique identifier name."); 166 167 #endif 168 169 #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0 170 #define ABSL_NAMESPACE_BEGIN 171 #define ABSL_NAMESPACE_END 172 #define ABSL_INTERNAL_C_SYMBOL(x) x 173 #elif ABSL_OPTION_USE_INLINE_NAMESPACE == 1 174 #define ABSL_NAMESPACE_BEGIN \ 175 inline namespace ABSL_OPTION_INLINE_NAMESPACE_NAME { 176 #define ABSL_NAMESPACE_END } 177 #define ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v) x##_##v 178 #define ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, v) \ 179 ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v) 180 #define ABSL_INTERNAL_C_SYMBOL(x) \ 181 ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, ABSL_OPTION_INLINE_NAMESPACE_NAME) 182 #else 183 #error options.h is misconfigured. 184 #endif 185 186 // ----------------------------------------------------------------------------- 187 // Compiler Feature Checks 188 // ----------------------------------------------------------------------------- 189 190 // ABSL_HAVE_BUILTIN() 191 // 192 // Checks whether the compiler supports a Clang Feature Checking Macro, and if 193 // so, checks whether it supports the provided builtin function "x" where x 194 // is one of the functions noted in 195 // https://clang.llvm.org/docs/LanguageExtensions.html 196 // 197 // Note: Use this macro to avoid an extra level of #ifdef __has_builtin check. 198 // http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html 199 #ifdef __has_builtin 200 #define ABSL_HAVE_BUILTIN(x) __has_builtin(x) 201 #else 202 #define ABSL_HAVE_BUILTIN(x) 0 203 #endif 204 205 #ifdef __has_feature 206 #define ABSL_HAVE_FEATURE(f) __has_feature(f) 207 #else 208 #define ABSL_HAVE_FEATURE(f) 0 209 #endif 210 211 // Portable check for GCC minimum version: 212 // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html 213 #if defined(__GNUC__) && defined(__GNUC_MINOR__) 214 #define ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) \ 215 (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) 216 #else 217 #define ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) 0 218 #endif 219 220 #if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__) 221 #define ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) \ 222 (__clang_major__ > (x) || __clang_major__ == (x) && __clang_minor__ >= (y)) 223 #else 224 #define ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) 0 225 #endif 226 227 // ABSL_HAVE_TLS is defined to 1 when __thread should be supported. 228 // We assume __thread is supported on Linux or Asylo when compiled with Clang or 229 // compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined. 230 #ifdef ABSL_HAVE_TLS 231 #error ABSL_HAVE_TLS cannot be directly set 232 #elif (defined(__linux__) || defined(__ASYLO__)) && \ 233 (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS)) 234 #define ABSL_HAVE_TLS 1 235 #endif 236 237 // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 238 // 239 // Checks whether `std::is_trivially_destructible<T>` is supported. 240 // 241 // Notes: All supported compilers using libc++ support this feature, as does 242 // gcc >= 4.8.1 using libstdc++, and Visual Studio. 243 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 244 #error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set 245 #elif defined(_LIBCPP_VERSION) || defined(_MSC_VER) || \ 246 (defined(__clang__) && __clang_major__ >= 15) || \ 247 (!defined(__clang__) && defined(__GLIBCXX__) && \ 248 ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(4, 8)) 249 #define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1 250 #endif 251 252 // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 253 // 254 // Checks whether `std::is_trivially_default_constructible<T>` and 255 // `std::is_trivially_copy_constructible<T>` are supported. 256 257 // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 258 // 259 // Checks whether `std::is_trivially_copy_assignable<T>` is supported. 260 261 // Notes: Clang with libc++ supports these features, as does gcc >= 7.4 with 262 // libstdc++, or gcc >= 8.2 with libc++, and Visual Studio (but not NVCC). 263 #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE) 264 #error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set 265 #elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE) 266 #error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set 267 #elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \ 268 (defined(__clang__) && __clang_major__ >= 15) || \ 269 (!defined(__clang__) && \ 270 ((ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(7, 4) && defined(__GLIBCXX__)) || \ 271 (ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(8, 2) && \ 272 defined(_LIBCPP_VERSION)))) || \ 273 (defined(_MSC_VER) && !defined(__NVCC__) && !defined(__clang__)) 274 #define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1 275 #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1 276 #endif 277 278 // ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 279 // 280 // Checks whether `std::is_trivially_copyable<T>` is supported. 281 // 282 // Notes: Clang 15+ with libc++ supports these features, GCC hasn't been tested. 283 #if defined(ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE) 284 #error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set 285 #elif defined(__clang__) && (__clang_major__ >= 15) 286 #define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1 287 #endif 288 289 // ABSL_HAVE_THREAD_LOCAL 290 // 291 // Checks whether C++11's `thread_local` storage duration specifier is 292 // supported. 293 #ifdef ABSL_HAVE_THREAD_LOCAL 294 #error ABSL_HAVE_THREAD_LOCAL cannot be directly set 295 #elif defined(__APPLE__) 296 // Notes: 297 // * Xcode's clang did not support `thread_local` until version 8, and 298 // even then not for all iOS < 9.0. 299 // * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator 300 // targeting iOS 9.x. 301 // * Xcode 10 moves the deployment target check for iOS < 9.0 to link time 302 // making ABSL_HAVE_FEATURE unreliable there. 303 // 304 #if ABSL_HAVE_FEATURE(cxx_thread_local) && \ 305 !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0) 306 #define ABSL_HAVE_THREAD_LOCAL 1 307 #endif 308 #else // !defined(__APPLE__) 309 #define ABSL_HAVE_THREAD_LOCAL 1 310 #endif 311 312 // There are platforms for which TLS should not be used even though the compiler 313 // makes it seem like it's supported (Android NDK < r12b for example). 314 // This is primarily because of linker problems and toolchain misconfiguration: 315 // Abseil does not intend to support this indefinitely. Currently, the newest 316 // toolchain that we intend to support that requires this behavior is the 317 // r11 NDK - allowing for a 5 year support window on that means this option 318 // is likely to be removed around June of 2021. 319 // TLS isn't supported until NDK r12b per 320 // https://developer.android.com/ndk/downloads/revision_history.html 321 // Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in 322 // <android/ndk-version.h>. For NDK < r16, users should define these macros, 323 // e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. 324 #if defined(__ANDROID__) && defined(__clang__) 325 #if __has_include(<android/ndk-version.h>) 326 #include <android/ndk-version.h> 327 #endif // __has_include(<android/ndk-version.h>) 328 #if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \ 329 defined(__NDK_MINOR__) && \ 330 ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1))) 331 #undef ABSL_HAVE_TLS 332 #undef ABSL_HAVE_THREAD_LOCAL 333 #endif 334 #endif // defined(__ANDROID__) && defined(__clang__) 335 336 // ABSL_HAVE_INTRINSIC_INT128 337 // 338 // Checks whether the __int128 compiler extension for a 128-bit integral type is 339 // supported. 340 // 341 // Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is 342 // supported, but we avoid using it in certain cases: 343 // * On Clang: 344 // * Building using Clang for Windows, where the Clang runtime library has 345 // 128-bit support only on LP64 architectures, but Windows is LLP64. 346 // * On Nvidia's nvcc: 347 // * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions 348 // actually support __int128. 349 #ifdef ABSL_HAVE_INTRINSIC_INT128 350 #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set 351 #elif defined(__SIZEOF_INT128__) 352 #if (defined(__clang__) && !defined(_WIN32)) || \ 353 (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \ 354 (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__)) 355 #define ABSL_HAVE_INTRINSIC_INT128 1 356 #elif defined(__CUDACC__) 357 // __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a 358 // string explaining that it has been removed starting with CUDA 9. We use 359 // nested #ifs because there is no short-circuiting in the preprocessor. 360 // NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined. 361 #if __CUDACC_VER__ >= 70000 362 #define ABSL_HAVE_INTRINSIC_INT128 1 363 #endif // __CUDACC_VER__ >= 70000 364 #endif // defined(__CUDACC__) 365 #endif // ABSL_HAVE_INTRINSIC_INT128 366 367 // ABSL_HAVE_EXCEPTIONS 368 // 369 // Checks whether the compiler both supports and enables exceptions. Many 370 // compilers support a "no exceptions" mode that disables exceptions. 371 // 372 // Generally, when ABSL_HAVE_EXCEPTIONS is not defined: 373 // 374 // * Code using `throw` and `try` may not compile. 375 // * The `noexcept` specifier will still compile and behave as normal. 376 // * The `noexcept` operator may still return `false`. 377 // 378 // For further details, consult the compiler's documentation. 379 #ifdef ABSL_HAVE_EXCEPTIONS 380 #error ABSL_HAVE_EXCEPTIONS cannot be directly set. 381 #elif ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(3, 6) 382 // Clang >= 3.6 383 #if ABSL_HAVE_FEATURE(cxx_exceptions) 384 #define ABSL_HAVE_EXCEPTIONS 1 385 #endif // ABSL_HAVE_FEATURE(cxx_exceptions) 386 #elif defined(__clang__) 387 // Clang < 3.6 388 // http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro 389 #if defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions) 390 #define ABSL_HAVE_EXCEPTIONS 1 391 #endif // defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions) 392 // Handle remaining special cases and default to exceptions being supported. 393 #elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \ 394 !(ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0) && \ 395 !defined(__cpp_exceptions)) && \ 396 !(defined(_MSC_VER) && !defined(_CPPUNWIND)) 397 #define ABSL_HAVE_EXCEPTIONS 1 398 #endif 399 400 // ----------------------------------------------------------------------------- 401 // Platform Feature Checks 402 // ----------------------------------------------------------------------------- 403 404 // Currently supported operating systems and associated preprocessor 405 // symbols: 406 // 407 // Linux and Linux-derived __linux__ 408 // Android __ANDROID__ (implies __linux__) 409 // Linux (non-Android) __linux__ && !__ANDROID__ 410 // Darwin (macOS and iOS) __APPLE__ 411 // Akaros (http://akaros.org) __ros__ 412 // Windows _WIN32 413 // NaCL __native_client__ 414 // AsmJS __asmjs__ 415 // WebAssembly __wasm__ 416 // Fuchsia __Fuchsia__ 417 // 418 // Note that since Android defines both __ANDROID__ and __linux__, one 419 // may probe for either Linux or Android by simply testing for __linux__. 420 421 // ABSL_HAVE_MMAP 422 // 423 // Checks whether the platform has an mmap(2) implementation as defined in 424 // POSIX.1-2001. 425 #ifdef ABSL_HAVE_MMAP 426 #error ABSL_HAVE_MMAP cannot be directly set 427 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ 428 defined(_AIX) || defined(__ros__) || defined(__native_client__) || \ 429 defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) || \ 430 defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) || \ 431 defined(__HAIKU__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ 432 defined(__QNX__) 433 #define ABSL_HAVE_MMAP 1 434 #endif 435 436 // ABSL_HAVE_PTHREAD_GETSCHEDPARAM 437 // 438 // Checks whether the platform implements the pthread_(get|set)schedparam(3) 439 // functions as defined in POSIX.1-2001. 440 #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM 441 #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set 442 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ 443 defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) || \ 444 defined(__NetBSD__) 445 #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 446 #endif 447 448 // ABSL_HAVE_SCHED_GETCPU 449 // 450 // Checks whether sched_getcpu is available. 451 #ifdef ABSL_HAVE_SCHED_GETCPU 452 #error ABSL_HAVE_SCHED_GETCPU cannot be directly set 453 #elif defined(__linux__) 454 #define ABSL_HAVE_SCHED_GETCPU 1 455 #endif 456 457 // ABSL_HAVE_SCHED_YIELD 458 // 459 // Checks whether the platform implements sched_yield(2) as defined in 460 // POSIX.1-2001. 461 #ifdef ABSL_HAVE_SCHED_YIELD 462 #error ABSL_HAVE_SCHED_YIELD cannot be directly set 463 #elif defined(__linux__) || defined(__ros__) || defined(__native_client__) 464 #define ABSL_HAVE_SCHED_YIELD 1 465 #endif 466 467 // ABSL_HAVE_SEMAPHORE_H 468 // 469 // Checks whether the platform supports the <semaphore.h> header and sem_init(3) 470 // family of functions as standardized in POSIX.1-2001. 471 // 472 // Note: While Apple provides <semaphore.h> for both iOS and macOS, it is 473 // explicitly deprecated and will cause build failures if enabled for those 474 // platforms. We side-step the issue by not defining it here for Apple 475 // platforms. 476 #ifdef ABSL_HAVE_SEMAPHORE_H 477 #error ABSL_HAVE_SEMAPHORE_H cannot be directly set 478 #elif defined(__linux__) || defined(__ros__) 479 #define ABSL_HAVE_SEMAPHORE_H 1 480 #endif 481 482 // ABSL_HAVE_ALARM 483 // 484 // Checks whether the platform supports the <signal.h> header and alarm(2) 485 // function as standardized in POSIX.1-2001. 486 #ifdef ABSL_HAVE_ALARM 487 #error ABSL_HAVE_ALARM cannot be directly set 488 #elif defined(__GOOGLE_GRTE_VERSION__) 489 // feature tests for Google's GRTE 490 #define ABSL_HAVE_ALARM 1 491 #elif defined(__GLIBC__) 492 // feature test for glibc 493 #define ABSL_HAVE_ALARM 1 494 #elif defined(_MSC_VER) 495 // feature tests for Microsoft's library 496 #elif defined(__MINGW32__) 497 // mingw32 doesn't provide alarm(2): 498 // https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.2-trunk/mingwrt/include/unistd.h 499 // mingw-w64 provides a no-op implementation: 500 // https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/misc/alarm.c 501 #elif defined(__EMSCRIPTEN__) 502 // emscripten doesn't support signals 503 #elif defined(__Fuchsia__) 504 // Signals don't exist on fuchsia. 505 #elif defined(__native_client__) 506 #else 507 // other standard libraries 508 #define ABSL_HAVE_ALARM 1 509 #endif 510 511 // ABSL_IS_LITTLE_ENDIAN 512 // ABSL_IS_BIG_ENDIAN 513 // 514 // Checks the endianness of the platform. 515 // 516 // Notes: uses the built in endian macros provided by GCC (since 4.6) and 517 // Clang (since 3.2); see 518 // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html. 519 // Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error. 520 #if defined(ABSL_IS_BIG_ENDIAN) 521 #error "ABSL_IS_BIG_ENDIAN cannot be directly set." 522 #endif 523 #if defined(ABSL_IS_LITTLE_ENDIAN) 524 #error "ABSL_IS_LITTLE_ENDIAN cannot be directly set." 525 #endif 526 527 #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ 528 __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 529 #define ABSL_IS_LITTLE_ENDIAN 1 530 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \ 531 __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 532 #define ABSL_IS_BIG_ENDIAN 1 533 #elif defined(_WIN32) 534 #define ABSL_IS_LITTLE_ENDIAN 1 535 #else 536 #error "absl endian detection needs to be set up for your compiler" 537 #endif 538 539 // macOS < 10.13 and iOS < 11 don't let you use <any>, <optional>, or <variant> 540 // even though the headers exist and are publicly noted to work, because the 541 // libc++ shared library shipped on the system doesn't have the requisite 542 // exported symbols. See https://github.com/abseil/abseil-cpp/issues/207 and 543 // https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes 544 // 545 // libc++ spells out the availability requirements in the file 546 // llvm-project/libcxx/include/__config via the #define 547 // _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS. 548 // 549 // Unfortunately, Apple initially mis-stated the requirements as macOS < 10.14 550 // and iOS < 12 in the libc++ headers. This was corrected by 551 // https://github.com/llvm/llvm-project/commit/7fb40e1569dd66292b647f4501b85517e9247953 552 // which subsequently made it into the XCode 12.5 release. We need to match the 553 // old (incorrect) conditions when built with old XCode, but can use the 554 // corrected earlier versions with new XCode. 555 #if defined(__APPLE__) && defined(_LIBCPP_VERSION) && \ 556 ((_LIBCPP_VERSION >= 11000 && /* XCode 12.5 or later: */ \ 557 ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ 558 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) || \ 559 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ 560 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 110000) || \ 561 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \ 562 __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 40000) || \ 563 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && \ 564 __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 110000))) || \ 565 (_LIBCPP_VERSION < 11000 && /* Pre-XCode 12.5: */ \ 566 ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ 567 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101400) || \ 568 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ 569 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \ 570 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && \ 571 __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) || \ 572 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && \ 573 __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000)))) 574 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 1 575 #else 576 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 0 577 #endif 578 579 // ABSL_HAVE_STD_ANY 580 // 581 // Checks whether C++17 std::any is available by checking whether <any> exists. 582 #ifdef ABSL_HAVE_STD_ANY 583 #error "ABSL_HAVE_STD_ANY cannot be directly set." 584 #endif 585 586 #ifdef __has_include 587 #if __has_include(<any>) && defined(__cplusplus) && __cplusplus >= 201703L && \ 588 !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 589 #define ABSL_HAVE_STD_ANY 1 590 #endif 591 #endif 592 593 // ABSL_HAVE_STD_OPTIONAL 594 // 595 // Checks whether C++17 std::optional is available. 596 #ifdef ABSL_HAVE_STD_OPTIONAL 597 #error "ABSL_HAVE_STD_OPTIONAL cannot be directly set." 598 #endif 599 600 #ifdef __has_include 601 #if __has_include(<optional>) && defined(__cplusplus) && \ 602 __cplusplus >= 201703L && !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 603 #define ABSL_HAVE_STD_OPTIONAL 1 604 #endif 605 #endif 606 607 // ABSL_HAVE_STD_VARIANT 608 // 609 // Checks whether C++17 std::variant is available. 610 #ifdef ABSL_HAVE_STD_VARIANT 611 #error "ABSL_HAVE_STD_VARIANT cannot be directly set." 612 #endif 613 614 #ifdef __has_include 615 #if __has_include(<variant>) && defined(__cplusplus) && \ 616 __cplusplus >= 201703L && !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 617 #define ABSL_HAVE_STD_VARIANT 1 618 #endif 619 #endif 620 621 // ABSL_HAVE_STD_STRING_VIEW 622 // 623 // Checks whether C++17 std::string_view is available. 624 #ifdef ABSL_HAVE_STD_STRING_VIEW 625 #error "ABSL_HAVE_STD_STRING_VIEW cannot be directly set." 626 #endif 627 628 #ifdef __has_include 629 #if __has_include(<string_view>) && defined(__cplusplus) && \ 630 __cplusplus >= 201703L 631 #define ABSL_HAVE_STD_STRING_VIEW 1 632 #endif 633 #endif 634 635 // For MSVC, `__has_include` is supported in VS 2017 15.3, which is later than 636 // the support for <optional>, <any>, <string_view>, <variant>. So we use 637 // _MSC_VER to check whether we have VS 2017 RTM (when <optional>, <any>, 638 // <string_view>, <variant> is implemented) or higher. Also, `__cplusplus` is 639 // not correctly set by MSVC, so we use `_MSVC_LANG` to check the language 640 // version. 641 // TODO(zhangxy): fix tests before enabling aliasing for `std::any`. 642 #if defined(_MSC_VER) && _MSC_VER >= 1910 && \ 643 ((defined(_MSVC_LANG) && _MSVC_LANG > 201402) || \ 644 (defined(__cplusplus) && __cplusplus > 201402)) 645 // #define ABSL_HAVE_STD_ANY 1 646 #define ABSL_HAVE_STD_OPTIONAL 1 647 #define ABSL_HAVE_STD_VARIANT 1 648 #define ABSL_HAVE_STD_STRING_VIEW 1 649 #endif 650 651 // ABSL_USES_STD_ANY 652 // 653 // Indicates whether absl::any is an alias for std::any. 654 #if !defined(ABSL_OPTION_USE_STD_ANY) 655 #error options.h is misconfigured. 656 #elif ABSL_OPTION_USE_STD_ANY == 0 || \ 657 (ABSL_OPTION_USE_STD_ANY == 2 && !defined(ABSL_HAVE_STD_ANY)) 658 #undef ABSL_USES_STD_ANY 659 #elif ABSL_OPTION_USE_STD_ANY == 1 || \ 660 (ABSL_OPTION_USE_STD_ANY == 2 && defined(ABSL_HAVE_STD_ANY)) 661 #define ABSL_USES_STD_ANY 1 662 #else 663 #error options.h is misconfigured. 664 #endif 665 666 // ABSL_USES_STD_OPTIONAL 667 // 668 // Indicates whether absl::optional is an alias for std::optional. 669 #if !defined(ABSL_OPTION_USE_STD_OPTIONAL) 670 #error options.h is misconfigured. 671 #elif ABSL_OPTION_USE_STD_OPTIONAL == 0 || \ 672 (ABSL_OPTION_USE_STD_OPTIONAL == 2 && !defined(ABSL_HAVE_STD_OPTIONAL)) 673 #undef ABSL_USES_STD_OPTIONAL 674 #elif ABSL_OPTION_USE_STD_OPTIONAL == 1 || \ 675 (ABSL_OPTION_USE_STD_OPTIONAL == 2 && defined(ABSL_HAVE_STD_OPTIONAL)) 676 #define ABSL_USES_STD_OPTIONAL 1 677 #else 678 #error options.h is misconfigured. 679 #endif 680 681 // ABSL_USES_STD_VARIANT 682 // 683 // Indicates whether absl::variant is an alias for std::variant. 684 #if !defined(ABSL_OPTION_USE_STD_VARIANT) 685 #error options.h is misconfigured. 686 #elif ABSL_OPTION_USE_STD_VARIANT == 0 || \ 687 (ABSL_OPTION_USE_STD_VARIANT == 2 && !defined(ABSL_HAVE_STD_VARIANT)) 688 #undef ABSL_USES_STD_VARIANT 689 #elif ABSL_OPTION_USE_STD_VARIANT == 1 || \ 690 (ABSL_OPTION_USE_STD_VARIANT == 2 && defined(ABSL_HAVE_STD_VARIANT)) 691 #define ABSL_USES_STD_VARIANT 1 692 #else 693 #error options.h is misconfigured. 694 #endif 695 696 // ABSL_USES_STD_STRING_VIEW 697 // 698 // Indicates whether absl::string_view is an alias for std::string_view. 699 #if !defined(ABSL_OPTION_USE_STD_STRING_VIEW) 700 #error options.h is misconfigured. 701 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 0 || \ 702 (ABSL_OPTION_USE_STD_STRING_VIEW == 2 && \ 703 !defined(ABSL_HAVE_STD_STRING_VIEW)) 704 #undef ABSL_USES_STD_STRING_VIEW 705 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 1 || \ 706 (ABSL_OPTION_USE_STD_STRING_VIEW == 2 && \ 707 defined(ABSL_HAVE_STD_STRING_VIEW)) 708 #define ABSL_USES_STD_STRING_VIEW 1 709 #else 710 #error options.h is misconfigured. 711 #endif 712 713 // In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION 714 // SEH exception from emplace for variant<SomeStruct> when constructing the 715 // struct can throw. This defeats some of variant_test and 716 // variant_exception_safety_test. 717 #if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG) 718 #define ABSL_INTERNAL_MSVC_2017_DBG_MODE 719 #endif 720 721 // ABSL_INTERNAL_MANGLED_NS 722 // ABSL_INTERNAL_MANGLED_BACKREFERENCE 723 // 724 // Internal macros for building up mangled names in our internal fork of CCTZ. 725 // This implementation detail is only needed and provided for the MSVC build. 726 // 727 // These macros both expand to string literals. ABSL_INTERNAL_MANGLED_NS is 728 // the mangled spelling of the `absl` namespace, and 729 // ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing 730 // the proper count to skip past the CCTZ fork namespace names. (This number 731 // is one larger when there is an inline namespace name to skip.) 732 #if defined(_MSC_VER) 733 #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0 734 #define ABSL_INTERNAL_MANGLED_NS "absl" 735 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "5" 736 #else 737 #define ABSL_INTERNAL_MANGLED_NS \ 738 ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl" 739 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "6" 740 #endif 741 #endif 742 743 // ABSL_DLL 744 // 745 // When building Abseil as a DLL, this macro expands to `__declspec(dllexport)` 746 // so we can annotate symbols appropriately as being exported. When used in 747 // headers consuming a DLL, this macro expands to `__declspec(dllimport)` so 748 // that consumers know the symbol is defined inside the DLL. In all other cases, 749 // the macro expands to nothing. 750 #if defined(_MSC_VER) 751 #if defined(ABSL_BUILD_DLL) 752 #define ABSL_DLL __declspec(dllexport) 753 #elif defined(ABSL_CONSUME_DLL) 754 #define ABSL_DLL __declspec(dllimport) 755 #else 756 #define ABSL_DLL 757 #endif 758 #else 759 #define ABSL_DLL 760 #endif // defined(_MSC_VER) 761 762 // ABSL_HAVE_MEMORY_SANITIZER 763 // 764 // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of 765 // a compiler instrumentation module and a run-time library. 766 #ifdef ABSL_HAVE_MEMORY_SANITIZER 767 #error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set." 768 #elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer) 769 #define ABSL_HAVE_MEMORY_SANITIZER 1 770 #endif 771 772 // ABSL_HAVE_THREAD_SANITIZER 773 // 774 // ThreadSanitizer (TSan) is a fast data race detector. 775 #ifdef ABSL_HAVE_THREAD_SANITIZER 776 #error "ABSL_HAVE_THREAD_SANITIZER cannot be directly set." 777 #elif defined(__SANITIZE_THREAD__) 778 #define ABSL_HAVE_THREAD_SANITIZER 1 779 #elif ABSL_HAVE_FEATURE(thread_sanitizer) 780 #define ABSL_HAVE_THREAD_SANITIZER 1 781 #endif 782 783 // ABSL_HAVE_ADDRESS_SANITIZER 784 // 785 // AddressSanitizer (ASan) is a fast memory error detector. 786 #ifdef ABSL_HAVE_ADDRESS_SANITIZER 787 #error "ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set." 788 #elif defined(__SANITIZE_ADDRESS__) 789 #define ABSL_HAVE_ADDRESS_SANITIZER 1 790 #elif ABSL_HAVE_FEATURE(address_sanitizer) 791 #define ABSL_HAVE_ADDRESS_SANITIZER 1 792 #endif 793 794 // ABSL_HAVE_HWADDRESS_SANITIZER 795 // 796 // Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan 797 // memory error detector which can use CPU features like ARM TBI, Intel LAM or 798 // AMD UAI. 799 #ifdef ABSL_HAVE_HWADDRESS_SANITIZER 800 #error "ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set." 801 #elif defined(__SANITIZE_HWADDRESS__) 802 #define ABSL_HAVE_HWADDRESS_SANITIZER 1 803 #elif ABSL_HAVE_FEATURE(hwaddress_sanitizer) 804 #define ABSL_HAVE_HWADDRESS_SANITIZER 1 805 #endif 806 807 // ABSL_HAVE_LEAK_SANITIZER 808 // 809 // LeakSanitizer (or lsan) is a detector of memory leaks. 810 // https://clang.llvm.org/docs/LeakSanitizer.html 811 // https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer 812 // 813 // The macro ABSL_HAVE_LEAK_SANITIZER can be used to detect at compile-time 814 // whether the LeakSanitizer is potentially available. However, just because the 815 // LeakSanitizer is available does not mean it is active. Use the 816 // always-available run-time interface in //absl/debugging/leak_check.h for 817 // interacting with LeakSanitizer. 818 #ifdef ABSL_HAVE_LEAK_SANITIZER 819 #error "ABSL_HAVE_LEAK_SANITIZER cannot be directly set." 820 #elif defined(LEAK_SANITIZER) 821 // GCC provides no method for detecting the presense of the standalone 822 // LeakSanitizer (-fsanitize=leak), so GCC users of -fsanitize=leak should also 823 // use -DLEAK_SANITIZER. 824 #define ABSL_HAVE_LEAK_SANITIZER 1 825 // Clang standalone LeakSanitizer (-fsanitize=leak) 826 #elif ABSL_HAVE_FEATURE(leak_sanitizer) 827 #define ABSL_HAVE_LEAK_SANITIZER 1 828 #elif defined(ABSL_HAVE_ADDRESS_SANITIZER) 829 // GCC or Clang using the LeakSanitizer integrated into AddressSanitizer. 830 #define ABSL_HAVE_LEAK_SANITIZER 1 831 #endif 832 833 // ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 834 // 835 // Class template argument deduction is a language feature added in C++17. 836 #ifdef ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 837 #error "ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION cannot be directly set." 838 #elif defined(__cpp_deduction_guides) 839 #define ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1 840 #endif 841 842 // ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 843 // 844 // Prior to C++17, static constexpr variables defined in classes required a 845 // separate definition outside of the class body, for example: 846 // 847 // class Foo { 848 // static constexpr int kBar = 0; 849 // }; 850 // constexpr int Foo::kBar; 851 // 852 // In C++17, these variables defined in classes are considered inline variables, 853 // and the extra declaration is redundant. Since some compilers warn on the 854 // extra declarations, ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL can be used 855 // conditionally ignore them: 856 // 857 // #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 858 // constexpr int Foo::kBar; 859 // #endif 860 #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \ 861 ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L 862 #define ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1 863 #endif 864 865 // `ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with 866 // RTTI support. 867 #ifdef ABSL_INTERNAL_HAS_RTTI 868 #error ABSL_INTERNAL_HAS_RTTI cannot be directly set 869 #elif !defined(__GNUC__) || defined(__GXX_RTTI) 870 #define ABSL_INTERNAL_HAS_RTTI 1 871 #endif // !defined(__GNUC__) || defined(__GXX_RTTI) 872 873 // ABSL_INTERNAL_HAVE_SSE is used for compile-time detection of SSE support. 874 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of 875 // which architectures support the various x86 instruction sets. 876 #ifdef ABSL_INTERNAL_HAVE_SSE 877 #error ABSL_INTERNAL_HAVE_SSE cannot be directly set 878 #elif defined(__SSE__) 879 #define ABSL_INTERNAL_HAVE_SSE 1 880 #elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1) 881 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 1 882 // indicates that at least SSE was targeted with the /arch:SSE option. 883 // All x86-64 processors support SSE, so support can be assumed. 884 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros 885 #define ABSL_INTERNAL_HAVE_SSE 1 886 #endif 887 888 // ABSL_INTERNAL_HAVE_SSE2 is used for compile-time detection of SSE2 support. 889 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of 890 // which architectures support the various x86 instruction sets. 891 #ifdef ABSL_INTERNAL_HAVE_SSE2 892 #error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set 893 #elif defined(__SSE2__) 894 #define ABSL_INTERNAL_HAVE_SSE2 1 895 #elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) 896 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2 897 // indicates that at least SSE2 was targeted with the /arch:SSE2 option. 898 // All x86-64 processors support SSE2, so support can be assumed. 899 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros 900 #define ABSL_INTERNAL_HAVE_SSE2 1 901 #endif 902 903 // ABSL_INTERNAL_HAVE_SSSE3 is used for compile-time detection of SSSE3 support. 904 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of 905 // which architectures support the various x86 instruction sets. 906 // 907 // MSVC does not have a mode that targets SSSE3 at compile-time. To use SSSE3 908 // with MSVC requires either assuming that the code will only every run on CPUs 909 // that support SSSE3, otherwise __cpuid() can be used to detect support at 910 // runtime and fallback to a non-SSSE3 implementation when SSSE3 is unsupported 911 // by the CPU. 912 #ifdef ABSL_INTERNAL_HAVE_SSSE3 913 #error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set 914 #elif defined(__SSSE3__) 915 #define ABSL_INTERNAL_HAVE_SSSE3 1 916 #endif 917 918 // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM 919 // SIMD). 920 // 921 // If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode. 922 // In device mode, NEON intrinsics are not available, regardless of host 923 // platform. 924 // https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code 925 #ifdef ABSL_INTERNAL_HAVE_ARM_NEON 926 #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set 927 #elif defined(__ARM_NEON) && !defined(__CUDA_ARCH__) 928 #define ABSL_INTERNAL_HAVE_ARM_NEON 1 929 #endif 930 931 #endif // ABSL_BASE_CONFIG_H_ 932