xref: /aosp_15_r20/external/angle/third_party/abseil-cpp/absl/base/config.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
79     ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
80 // Include library feature test macros.
81 #include <version>
82 #endif
83 
84 #if defined(__APPLE__)
85 // Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED,
86 // __IPHONE_8_0.
87 #include <Availability.h>
88 #include <TargetConditionals.h>
89 #endif
90 
91 #include "absl/base/options.h"
92 #include "absl/base/policy_checks.h"
93 
94 // Abseil long-term support (LTS) releases will define
95 // `ABSL_LTS_RELEASE_VERSION` to the integer representing the date string of the
96 // LTS release version, and will define `ABSL_LTS_RELEASE_PATCH_LEVEL` to the
97 // integer representing the patch-level for that release.
98 //
99 // For example, for LTS release version "20300401.2", this would give us
100 // ABSL_LTS_RELEASE_VERSION == 20300401 && ABSL_LTS_RELEASE_PATCH_LEVEL == 2
101 //
102 // These symbols will not be defined in non-LTS code.
103 //
104 // Abseil recommends that clients live-at-head. Therefore, if you are using
105 // these symbols to assert a minimum version requirement, we recommend you do it
106 // as
107 //
108 // #if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20300401
109 // #error Project foo requires Abseil LTS version >= 20300401
110 // #endif
111 //
112 // The `defined(ABSL_LTS_RELEASE_VERSION)` part of the check excludes
113 // live-at-head clients from the minimum version assertion.
114 //
115 // See https://abseil.io/about/releases for more information on Abseil release
116 // management.
117 //
118 // LTS releases can be obtained from
119 // https://github.com/abseil/abseil-cpp/releases.
120 #undef ABSL_LTS_RELEASE_VERSION
121 #undef ABSL_LTS_RELEASE_PATCH_LEVEL
122 
123 // Helper macro to convert a CPP variable to a string literal.
124 #define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
125 #define ABSL_INTERNAL_TOKEN_STR(x) ABSL_INTERNAL_DO_TOKEN_STR(x)
126 
127 // -----------------------------------------------------------------------------
128 // Abseil namespace annotations
129 // -----------------------------------------------------------------------------
130 
131 // ABSL_NAMESPACE_BEGIN/ABSL_NAMESPACE_END
132 //
133 // An annotation placed at the beginning/end of each `namespace absl` scope.
134 // This is used to inject an inline namespace.
135 //
136 // The proper way to write Abseil code in the `absl` namespace is:
137 //
138 // namespace absl {
139 // ABSL_NAMESPACE_BEGIN
140 //
141 // void Foo();  // absl::Foo().
142 //
143 // ABSL_NAMESPACE_END
144 // }  // namespace absl
145 //
146 // Users of Abseil should not use these macros, because users of Abseil should
147 // not write `namespace absl {` in their own code for any reason.  (Abseil does
148 // not support forward declarations of its own types, nor does it support
149 // user-provided specialization of Abseil templates.  Code that violates these
150 // rules may be broken without warning.)
151 #if !defined(ABSL_OPTION_USE_INLINE_NAMESPACE) || \
152     !defined(ABSL_OPTION_INLINE_NAMESPACE_NAME)
153 #error options.h is misconfigured.
154 #endif
155 
156 // Check that ABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
157 #if defined(__cplusplus) && ABSL_OPTION_USE_INLINE_NAMESPACE == 1
158 
159 #define ABSL_INTERNAL_INLINE_NAMESPACE_STR \
160   ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME)
161 
162 static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0',
163               "options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must "
164               "not be empty.");
165 static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
166                   ABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' ||
167                   ABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' ||
168                   ABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' ||
169                   ABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0',
170               "options.h misconfigured: ABSL_OPTION_INLINE_NAMESPACE_NAME must "
171               "be changed to a new, unique identifier name.");
172 
173 #endif
174 
175 #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
176 #define ABSL_NAMESPACE_BEGIN
177 #define ABSL_NAMESPACE_END
178 #define ABSL_INTERNAL_C_SYMBOL(x) x
179 #elif ABSL_OPTION_USE_INLINE_NAMESPACE == 1
180 #define ABSL_NAMESPACE_BEGIN \
181   inline namespace ABSL_OPTION_INLINE_NAMESPACE_NAME {
182 #define ABSL_NAMESPACE_END }
183 #define ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v) x##_##v
184 #define ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, v) \
185   ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v)
186 #define ABSL_INTERNAL_C_SYMBOL(x) \
187   ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, ABSL_OPTION_INLINE_NAMESPACE_NAME)
188 #else
189 #error options.h is misconfigured.
190 #endif
191 
192 // -----------------------------------------------------------------------------
193 // Compiler Feature Checks
194 // -----------------------------------------------------------------------------
195 
196 // ABSL_HAVE_BUILTIN()
197 //
198 // Checks whether the compiler supports a Clang Feature Checking Macro, and if
199 // so, checks whether it supports the provided builtin function "x" where x
200 // is one of the functions noted in
201 // https://clang.llvm.org/docs/LanguageExtensions.html
202 //
203 // Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
204 // http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
205 #ifdef __has_builtin
206 #define ABSL_HAVE_BUILTIN(x) __has_builtin(x)
207 #else
208 #define ABSL_HAVE_BUILTIN(x) 0
209 #endif
210 
211 #ifdef __has_feature
212 #define ABSL_HAVE_FEATURE(f) __has_feature(f)
213 #else
214 #define ABSL_HAVE_FEATURE(f) 0
215 #endif
216 
217 // Portable check for GCC minimum version:
218 // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
219 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
220 #define ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) \
221   (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
222 #else
223 #define ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) 0
224 #endif
225 
226 #if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
227 #define ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) \
228   (__clang_major__ > (x) || __clang_major__ == (x) && __clang_minor__ >= (y))
229 #else
230 #define ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) 0
231 #endif
232 
233 // ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
234 // We assume __thread is supported on Linux when compiled with Clang or
235 // compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined.
236 #ifdef ABSL_HAVE_TLS
237 #error ABSL_HAVE_TLS cannot be directly set
238 #elif (defined(__linux__)) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
239 #define ABSL_HAVE_TLS 1
240 #endif
241 
242 // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
243 //
244 // Checks whether `std::is_trivially_destructible<T>` is supported.
245 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
246 #error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
247 #define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
248 #endif
249 
250 // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
251 //
252 // Checks whether `std::is_trivially_default_constructible<T>` and
253 // `std::is_trivially_copy_constructible<T>` are supported.
254 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
255 #error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
256 #else
257 #define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
258 #endif
259 
260 // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
261 //
262 // Checks whether `std::is_trivially_copy_assignable<T>` is supported.
263 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
264 #error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot be directly set
265 #else
266 #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
267 #endif
268 
269 // ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
270 //
271 // Checks whether `std::is_trivially_copyable<T>` is supported.
272 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
273 #error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set
274 #define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
275 #endif
276 
277 
278 // ABSL_HAVE_THREAD_LOCAL
279 //
280 // DEPRECATED - `thread_local` is available on all supported platforms.
281 // Checks whether C++11's `thread_local` storage duration specifier is
282 // supported.
283 #ifdef ABSL_HAVE_THREAD_LOCAL
284 #error ABSL_HAVE_THREAD_LOCAL cannot be directly set
285 #else
286 #define ABSL_HAVE_THREAD_LOCAL 1
287 #endif
288 
289 // ABSL_HAVE_INTRINSIC_INT128
290 //
291 // Checks whether the __int128 compiler extension for a 128-bit integral type is
292 // supported.
293 //
294 // Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
295 // supported, but we avoid using it in certain cases:
296 // * On Clang:
297 //   * Building using Clang for Windows, where the Clang runtime library has
298 //     128-bit support only on LP64 architectures, but Windows is LLP64.
299 // * On Nvidia's nvcc:
300 //   * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
301 //     actually support __int128.
302 #ifdef ABSL_HAVE_INTRINSIC_INT128
303 #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
304 #elif defined(__SIZEOF_INT128__)
305 #if (defined(__clang__) && !defined(_WIN32)) ||           \
306     (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
307     (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
308 #define ABSL_HAVE_INTRINSIC_INT128 1
309 #elif defined(__CUDACC__)
310 // __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
311 // string explaining that it has been removed starting with CUDA 9. We use
312 // nested #ifs because there is no short-circuiting in the preprocessor.
313 // NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
314 #if __CUDACC_VER__ >= 70000
315 #define ABSL_HAVE_INTRINSIC_INT128 1
316 #endif  // __CUDACC_VER__ >= 70000
317 #endif  // defined(__CUDACC__)
318 #endif  // ABSL_HAVE_INTRINSIC_INT128
319 
320 // ABSL_HAVE_EXCEPTIONS
321 //
322 // Checks whether the compiler both supports and enables exceptions. Many
323 // compilers support a "no exceptions" mode that disables exceptions.
324 //
325 // Generally, when ABSL_HAVE_EXCEPTIONS is not defined:
326 //
327 // * Code using `throw` and `try` may not compile.
328 // * The `noexcept` specifier will still compile and behave as normal.
329 // * The `noexcept` operator may still return `false`.
330 //
331 // For further details, consult the compiler's documentation.
332 #ifdef ABSL_HAVE_EXCEPTIONS
333 #error ABSL_HAVE_EXCEPTIONS cannot be directly set.
334 #elif ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(3, 6)
335 // Clang >= 3.6
336 #if ABSL_HAVE_FEATURE(cxx_exceptions)
337 #define ABSL_HAVE_EXCEPTIONS 1
338 #endif  // ABSL_HAVE_FEATURE(cxx_exceptions)
339 #elif defined(__clang__)
340 // Clang < 3.6
341 // http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
342 #if defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
343 #define ABSL_HAVE_EXCEPTIONS 1
344 #endif  // defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
345 // Handle remaining special cases and default to exceptions being supported.
346 #elif !(defined(__GNUC__) && !defined(__cpp_exceptions)) && \
347     !(defined(_MSC_VER) && !defined(_CPPUNWIND))
348 #define ABSL_HAVE_EXCEPTIONS 1
349 #endif
350 
351 // -----------------------------------------------------------------------------
352 // Platform Feature Checks
353 // -----------------------------------------------------------------------------
354 
355 // Currently supported operating systems and associated preprocessor
356 // symbols:
357 //
358 //   Linux and Linux-derived           __linux__
359 //   Android                           __ANDROID__ (implies __linux__)
360 //   Linux (non-Android)               __linux__ && !__ANDROID__
361 //   Darwin (macOS and iOS)            __APPLE__
362 //   Akaros (http://akaros.org)        __ros__
363 //   Windows                           _WIN32
364 //   NaCL                              __native_client__
365 //   AsmJS                             __asmjs__
366 //   WebAssembly (Emscripten)          __EMSCRIPTEN__
367 //   Fuchsia                           __Fuchsia__
368 //
369 // Note that since Android defines both __ANDROID__ and __linux__, one
370 // may probe for either Linux or Android by simply testing for __linux__.
371 
372 // ABSL_HAVE_MMAP
373 //
374 // Checks whether the platform has an mmap(2) implementation as defined in
375 // POSIX.1-2001.
376 #ifdef ABSL_HAVE_MMAP
377 #error ABSL_HAVE_MMAP cannot be directly set
378 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||    \
379     defined(_AIX) || defined(__ros__) || defined(__native_client__) ||       \
380     defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \
381     defined(__sun) || defined(__myriad2__) || defined(__HAIKU__) ||          \
382     defined(__OpenBSD__) || defined(__NetBSD__) || defined(__QNX__) ||       \
383     defined(__VXWORKS__) || defined(__hexagon__) || defined(__XTENSA__)
384 #define ABSL_HAVE_MMAP 1
385 #endif
386 
387 // ABSL_HAVE_PTHREAD_GETSCHEDPARAM
388 //
389 // Checks whether the platform implements the pthread_(get|set)schedparam(3)
390 // functions as defined in POSIX.1-2001.
391 #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
392 #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
393 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
394     defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) ||          \
395     defined(__NetBSD__) || defined(__VXWORKS__)
396 #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
397 #endif
398 
399 // ABSL_HAVE_SCHED_GETCPU
400 //
401 // Checks whether sched_getcpu is available.
402 #ifdef ABSL_HAVE_SCHED_GETCPU
403 #error ABSL_HAVE_SCHED_GETCPU cannot be directly set
404 #elif defined(__linux__)
405 #define ABSL_HAVE_SCHED_GETCPU 1
406 #endif
407 
408 // ABSL_HAVE_SCHED_YIELD
409 //
410 // Checks whether the platform implements sched_yield(2) as defined in
411 // POSIX.1-2001.
412 #ifdef ABSL_HAVE_SCHED_YIELD
413 #error ABSL_HAVE_SCHED_YIELD cannot be directly set
414 #elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \
415     defined(__VXWORKS__)
416 #define ABSL_HAVE_SCHED_YIELD 1
417 #endif
418 
419 // ABSL_HAVE_SEMAPHORE_H
420 //
421 // Checks whether the platform supports the <semaphore.h> header and sem_init(3)
422 // family of functions as standardized in POSIX.1-2001.
423 //
424 // Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
425 // explicitly deprecated and will cause build failures if enabled for those
426 // platforms.  We side-step the issue by not defining it here for Apple
427 // platforms.
428 #ifdef ABSL_HAVE_SEMAPHORE_H
429 #error ABSL_HAVE_SEMAPHORE_H cannot be directly set
430 #elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__)
431 #define ABSL_HAVE_SEMAPHORE_H 1
432 #endif
433 
434 // ABSL_HAVE_ALARM
435 //
436 // Checks whether the platform supports the <signal.h> header and alarm(2)
437 // function as standardized in POSIX.1-2001.
438 #ifdef ABSL_HAVE_ALARM
439 #error ABSL_HAVE_ALARM cannot be directly set
440 #elif defined(__GOOGLE_GRTE_VERSION__)
441 // feature tests for Google's GRTE
442 #define ABSL_HAVE_ALARM 1
443 #elif defined(__GLIBC__)
444 // feature test for glibc
445 #define ABSL_HAVE_ALARM 1
446 #elif defined(_MSC_VER)
447 // feature tests for Microsoft's library
448 #elif defined(__MINGW32__)
449 // mingw32 doesn't provide alarm(2):
450 // https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.2-trunk/mingwrt/include/unistd.h
451 // mingw-w64 provides a no-op implementation:
452 // https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/misc/alarm.c
453 #elif defined(__EMSCRIPTEN__)
454 // emscripten doesn't support signals
455 #elif defined(__wasi__)
456 // WASI doesn't support signals
457 #elif defined(__Fuchsia__)
458 // Signals don't exist on fuchsia.
459 #elif defined(__native_client__)
460 // Signals don't exist on hexagon/QuRT
461 #elif defined(__hexagon__)
462 #else
463 // other standard libraries
464 #define ABSL_HAVE_ALARM 1
465 #endif
466 
467 // ABSL_IS_LITTLE_ENDIAN
468 // ABSL_IS_BIG_ENDIAN
469 //
470 // Checks the endianness of the platform.
471 //
472 // Notes: uses the built in endian macros provided by GCC (since 4.6) and
473 // Clang (since 3.2); see
474 // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html.
475 // Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error.
476 #if defined(ABSL_IS_BIG_ENDIAN)
477 #error "ABSL_IS_BIG_ENDIAN cannot be directly set."
478 #endif
479 #if defined(ABSL_IS_LITTLE_ENDIAN)
480 #error "ABSL_IS_LITTLE_ENDIAN cannot be directly set."
481 #endif
482 
483 #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
484      __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
485 #define ABSL_IS_LITTLE_ENDIAN 1
486 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
487     __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
488 #define ABSL_IS_BIG_ENDIAN 1
489 #elif defined(_WIN32)
490 #define ABSL_IS_LITTLE_ENDIAN 1
491 #else
492 #error "absl endian detection needs to be set up for your compiler"
493 #endif
494 
495 // macOS < 10.13 and iOS < 12 don't support <any>, <optional>, or <variant>
496 // because the libc++ shared library shipped on the system doesn't have the
497 // requisite exported symbols.  See
498 // https://github.com/abseil/abseil-cpp/issues/207 and
499 // https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
500 //
501 // libc++ spells out the availability requirements in the file
502 // llvm-project/libcxx/include/__config via the #define
503 // _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS. The set of versions has been
504 // modified a few times, via
505 // https://github.com/llvm/llvm-project/commit/7fb40e1569dd66292b647f4501b85517e9247953
506 // and
507 // https://github.com/llvm/llvm-project/commit/0bc451e7e137c4ccadcd3377250874f641ca514a
508 // The second has the actually correct versions, thus, is what we copy here.
509 #if defined(__APPLE__) &&                                         \
510     ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&   \
511       __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) ||  \
512      (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&  \
513       __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \
514      (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) &&   \
515       __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) ||   \
516      (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) &&      \
517       __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000))
518 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 1
519 #else
520 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 0
521 #endif
522 
523 // ABSL_HAVE_STD_ANY
524 //
525 // Checks whether C++17 std::any is available.
526 #ifdef ABSL_HAVE_STD_ANY
527 #error "ABSL_HAVE_STD_ANY cannot be directly set."
528 #elif defined(__cpp_lib_any) && __cpp_lib_any >= 201606L
529 #define ABSL_HAVE_STD_ANY 1
530 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
531     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
532     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
533 #define ABSL_HAVE_STD_ANY 1
534 #endif
535 
536 // ABSL_HAVE_STD_OPTIONAL
537 //
538 // Checks whether C++17 std::optional is available.
539 #ifdef ABSL_HAVE_STD_OPTIONAL
540 #error "ABSL_HAVE_STD_OPTIONAL cannot be directly set."
541 #elif defined(__cpp_lib_optional) && __cpp_lib_optional >= 202106L
542 #define ABSL_HAVE_STD_OPTIONAL 1
543 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
544     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
545     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
546 #define ABSL_HAVE_STD_OPTIONAL 1
547 #endif
548 
549 // ABSL_HAVE_STD_VARIANT
550 //
551 // Checks whether C++17 std::variant is available.
552 #ifdef ABSL_HAVE_STD_VARIANT
553 #error "ABSL_HAVE_STD_VARIANT cannot be directly set."
554 #elif defined(__cpp_lib_variant) && __cpp_lib_variant >= 201606L
555 #define ABSL_HAVE_STD_VARIANT 1
556 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
557     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
558     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
559 #define ABSL_HAVE_STD_VARIANT 1
560 #endif
561 
562 // ABSL_HAVE_STD_STRING_VIEW
563 //
564 // Checks whether C++17 std::string_view is available.
565 #ifdef ABSL_HAVE_STD_STRING_VIEW
566 #error "ABSL_HAVE_STD_STRING_VIEW cannot be directly set."
567 #elif defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
568 #define ABSL_HAVE_STD_STRING_VIEW 1
569 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
570     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
571 #define ABSL_HAVE_STD_STRING_VIEW 1
572 #endif
573 
574 // ABSL_HAVE_STD_ORDERING
575 //
576 // Checks whether C++20 std::{partial,weak,strong}_ordering are available.
577 //
578 // __cpp_lib_three_way_comparison is missing on libc++
579 // (https://github.com/llvm/llvm-project/issues/73953) so treat it as defined
580 // when building in C++20 mode.
581 #ifdef ABSL_HAVE_STD_ORDERING
582 #error "ABSL_HAVE_STD_ORDERING cannot be directly set."
583 #elif (defined(__cpp_lib_three_way_comparison) &&    \
584        __cpp_lib_three_way_comparison >= 201907L) || \
585     (defined(ABSL_INTERNAL_CPLUSPLUS_LANG) &&        \
586      ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L)
587 #define ABSL_HAVE_STD_ORDERING 1
588 #endif
589 
590 // ABSL_USES_STD_ANY
591 //
592 // Indicates whether absl::any is an alias for std::any.
593 #if !defined(ABSL_OPTION_USE_STD_ANY)
594 #error options.h is misconfigured.
595 #elif ABSL_OPTION_USE_STD_ANY == 0 || \
596     (ABSL_OPTION_USE_STD_ANY == 2 && !defined(ABSL_HAVE_STD_ANY))
597 #undef ABSL_USES_STD_ANY
598 #elif ABSL_OPTION_USE_STD_ANY == 1 || \
599     (ABSL_OPTION_USE_STD_ANY == 2 && defined(ABSL_HAVE_STD_ANY))
600 #define ABSL_USES_STD_ANY 1
601 #else
602 #error options.h is misconfigured.
603 #endif
604 
605 // ABSL_USES_STD_OPTIONAL
606 //
607 // Indicates whether absl::optional is an alias for std::optional.
608 #if !defined(ABSL_OPTION_USE_STD_OPTIONAL)
609 #error options.h is misconfigured.
610 #elif ABSL_OPTION_USE_STD_OPTIONAL == 0 || \
611     (ABSL_OPTION_USE_STD_OPTIONAL == 2 && !defined(ABSL_HAVE_STD_OPTIONAL))
612 #undef ABSL_USES_STD_OPTIONAL
613 #elif ABSL_OPTION_USE_STD_OPTIONAL == 1 || \
614     (ABSL_OPTION_USE_STD_OPTIONAL == 2 && defined(ABSL_HAVE_STD_OPTIONAL))
615 #define ABSL_USES_STD_OPTIONAL 1
616 #else
617 #error options.h is misconfigured.
618 #endif
619 
620 // ABSL_USES_STD_VARIANT
621 //
622 // Indicates whether absl::variant is an alias for std::variant.
623 #if !defined(ABSL_OPTION_USE_STD_VARIANT)
624 #error options.h is misconfigured.
625 #elif ABSL_OPTION_USE_STD_VARIANT == 0 || \
626     (ABSL_OPTION_USE_STD_VARIANT == 2 && !defined(ABSL_HAVE_STD_VARIANT))
627 #undef ABSL_USES_STD_VARIANT
628 #elif ABSL_OPTION_USE_STD_VARIANT == 1 || \
629     (ABSL_OPTION_USE_STD_VARIANT == 2 && defined(ABSL_HAVE_STD_VARIANT))
630 #define ABSL_USES_STD_VARIANT 1
631 #else
632 #error options.h is misconfigured.
633 #endif
634 
635 // ABSL_USES_STD_STRING_VIEW
636 //
637 // Indicates whether absl::string_view is an alias for std::string_view.
638 #if !defined(ABSL_OPTION_USE_STD_STRING_VIEW)
639 #error options.h is misconfigured.
640 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
641     (ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
642      !defined(ABSL_HAVE_STD_STRING_VIEW))
643 #undef ABSL_USES_STD_STRING_VIEW
644 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 1 || \
645     (ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
646      defined(ABSL_HAVE_STD_STRING_VIEW))
647 #define ABSL_USES_STD_STRING_VIEW 1
648 #else
649 #error options.h is misconfigured.
650 #endif
651 
652 // ABSL_USES_STD_ORDERING
653 //
654 // Indicates whether absl::{partial,weak,strong}_ordering are aliases for the
655 // std:: ordering types.
656 #if !defined(ABSL_OPTION_USE_STD_ORDERING)
657 #error options.h is misconfigured.
658 #elif ABSL_OPTION_USE_STD_ORDERING == 0 || \
659     (ABSL_OPTION_USE_STD_ORDERING == 2 && !defined(ABSL_HAVE_STD_ORDERING))
660 #undef ABSL_USES_STD_ORDERING
661 #elif ABSL_OPTION_USE_STD_ORDERING == 1 || \
662     (ABSL_OPTION_USE_STD_ORDERING == 2 && defined(ABSL_HAVE_STD_ORDERING))
663 #define ABSL_USES_STD_ORDERING 1
664 #else
665 #error options.h is misconfigured.
666 #endif
667 
668 // In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
669 // SEH exception from emplace for variant<SomeStruct> when constructing the
670 // struct can throw. This defeats some of variant_test and
671 // variant_exception_safety_test.
672 #if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
673 #define ABSL_INTERNAL_MSVC_2017_DBG_MODE
674 #endif
675 
676 // ABSL_INTERNAL_MANGLED_NS
677 // ABSL_INTERNAL_MANGLED_BACKREFERENCE
678 //
679 // Internal macros for building up mangled names in our internal fork of CCTZ.
680 // This implementation detail is only needed and provided for the MSVC build.
681 //
682 // These macros both expand to string literals.  ABSL_INTERNAL_MANGLED_NS is
683 // the mangled spelling of the `absl` namespace, and
684 // ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing
685 // the proper count to skip past the CCTZ fork namespace names.  (This number
686 // is one larger when there is an inline namespace name to skip.)
687 #if defined(_MSC_VER)
688 #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
689 #define ABSL_INTERNAL_MANGLED_NS "absl"
690 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
691 #else
692 #define ABSL_INTERNAL_MANGLED_NS \
693   ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
694 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
695 #endif
696 #endif
697 
698 // ABSL_DLL
699 //
700 // When building Abseil as a DLL, this macro expands to `__declspec(dllexport)`
701 // so we can annotate symbols appropriately as being exported. When used in
702 // headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
703 // that consumers know the symbol is defined inside the DLL. In all other cases,
704 // the macro expands to nothing.
705 #if defined(_MSC_VER)
706 #if defined(ABSL_BUILD_DLL)
707 #define ABSL_DLL __declspec(dllexport)
708 #elif defined(ABSL_CONSUME_DLL)
709 #define ABSL_DLL __declspec(dllimport)
710 #else
711 #define ABSL_DLL
712 #endif
713 #else
714 #define ABSL_DLL
715 #endif  // defined(_MSC_VER)
716 
717 #if defined(_MSC_VER)
718 #if defined(ABSL_BUILD_TEST_DLL)
719 #define ABSL_TEST_DLL __declspec(dllexport)
720 #elif defined(ABSL_CONSUME_TEST_DLL)
721 #define ABSL_TEST_DLL __declspec(dllimport)
722 #else
723 #define ABSL_TEST_DLL
724 #endif
725 #else
726 #define ABSL_TEST_DLL
727 #endif  // defined(_MSC_VER)
728 
729 // ABSL_HAVE_MEMORY_SANITIZER
730 //
731 // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
732 // a compiler instrumentation module and a run-time library.
733 #ifdef ABSL_HAVE_MEMORY_SANITIZER
734 #error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set."
735 #elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer)
736 #define ABSL_HAVE_MEMORY_SANITIZER 1
737 #endif
738 
739 // ABSL_HAVE_THREAD_SANITIZER
740 //
741 // ThreadSanitizer (TSan) is a fast data race detector.
742 #ifdef ABSL_HAVE_THREAD_SANITIZER
743 #error "ABSL_HAVE_THREAD_SANITIZER cannot be directly set."
744 #elif defined(__SANITIZE_THREAD__)
745 #define ABSL_HAVE_THREAD_SANITIZER 1
746 #elif ABSL_HAVE_FEATURE(thread_sanitizer)
747 #define ABSL_HAVE_THREAD_SANITIZER 1
748 #endif
749 
750 // ABSL_HAVE_ADDRESS_SANITIZER
751 //
752 // AddressSanitizer (ASan) is a fast memory error detector.
753 #ifdef ABSL_HAVE_ADDRESS_SANITIZER
754 #error "ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set."
755 #elif defined(__SANITIZE_ADDRESS__)
756 #define ABSL_HAVE_ADDRESS_SANITIZER 1
757 #elif ABSL_HAVE_FEATURE(address_sanitizer)
758 #define ABSL_HAVE_ADDRESS_SANITIZER 1
759 #endif
760 
761 // ABSL_HAVE_HWADDRESS_SANITIZER
762 //
763 // Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan
764 // memory error detector which can use CPU features like ARM TBI, Intel LAM or
765 // AMD UAI.
766 #ifdef ABSL_HAVE_HWADDRESS_SANITIZER
767 #error "ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set."
768 #elif defined(__SANITIZE_HWADDRESS__)
769 #define ABSL_HAVE_HWADDRESS_SANITIZER 1
770 #elif ABSL_HAVE_FEATURE(hwaddress_sanitizer)
771 #define ABSL_HAVE_HWADDRESS_SANITIZER 1
772 #endif
773 
774 // ABSL_HAVE_DATAFLOW_SANITIZER
775 //
776 // Dataflow Sanitizer (or DFSAN) is a generalised dynamic data flow analysis.
777 #ifdef ABSL_HAVE_DATAFLOW_SANITIZER
778 #error "ABSL_HAVE_DATAFLOW_SANITIZER cannot be directly set."
779 #elif defined(DATAFLOW_SANITIZER)
780 // GCC provides no method for detecting the presence of the standalone
781 // DataFlowSanitizer (-fsanitize=dataflow), so GCC users of -fsanitize=dataflow
782 // should also use -DDATAFLOW_SANITIZER.
783 #define ABSL_HAVE_DATAFLOW_SANITIZER 1
784 #elif ABSL_HAVE_FEATURE(dataflow_sanitizer)
785 #define ABSL_HAVE_DATAFLOW_SANITIZER 1
786 #endif
787 
788 // ABSL_HAVE_LEAK_SANITIZER
789 //
790 // LeakSanitizer (or lsan) is a detector of memory leaks.
791 // https://clang.llvm.org/docs/LeakSanitizer.html
792 // https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
793 //
794 // The macro ABSL_HAVE_LEAK_SANITIZER can be used to detect at compile-time
795 // whether the LeakSanitizer is potentially available. However, just because the
796 // LeakSanitizer is available does not mean it is active. Use the
797 // always-available run-time interface in //absl/debugging/leak_check.h for
798 // interacting with LeakSanitizer.
799 #ifdef ABSL_HAVE_LEAK_SANITIZER
800 #error "ABSL_HAVE_LEAK_SANITIZER cannot be directly set."
801 #elif defined(LEAK_SANITIZER)
802 // GCC provides no method for detecting the presence of the standalone
803 // LeakSanitizer (-fsanitize=leak), so GCC users of -fsanitize=leak should also
804 // use -DLEAK_SANITIZER.
805 #define ABSL_HAVE_LEAK_SANITIZER 1
806 // Clang standalone LeakSanitizer (-fsanitize=leak)
807 #elif ABSL_HAVE_FEATURE(leak_sanitizer)
808 #define ABSL_HAVE_LEAK_SANITIZER 1
809 #elif defined(ABSL_HAVE_ADDRESS_SANITIZER)
810 // GCC or Clang using the LeakSanitizer integrated into AddressSanitizer.
811 #define ABSL_HAVE_LEAK_SANITIZER 1
812 #endif
813 
814 // ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
815 //
816 // Class template argument deduction is a language feature added in C++17.
817 #ifdef ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
818 #error "ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION cannot be directly set."
819 #elif defined(__cpp_deduction_guides)
820 #define ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
821 #endif
822 
823 // ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
824 //
825 // Prior to C++17, static constexpr variables defined in classes required a
826 // separate definition outside of the class body, for example:
827 //
828 // class Foo {
829 //   static constexpr int kBar = 0;
830 // };
831 // constexpr int Foo::kBar;
832 //
833 // In C++17, these variables defined in classes are considered inline variables,
834 // and the extra declaration is redundant. Since some compilers warn on the
835 // extra declarations, ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL can be used
836 // conditionally ignore them:
837 //
838 // #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
839 // constexpr int Foo::kBar;
840 // #endif
841 #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
842     ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L
843 #define ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1
844 #endif
845 
846 // `ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with
847 // RTTI support.
848 #ifdef ABSL_INTERNAL_HAS_RTTI
849 #error ABSL_INTERNAL_HAS_RTTI cannot be directly set
850 #elif ABSL_HAVE_FEATURE(cxx_rtti)
851 #define ABSL_INTERNAL_HAS_RTTI 1
852 #elif defined(__GNUC__) && defined(__GXX_RTTI)
853 #define ABSL_INTERNAL_HAS_RTTI 1
854 #elif defined(_MSC_VER) && defined(_CPPRTTI)
855 #define ABSL_INTERNAL_HAS_RTTI 1
856 #elif !defined(__GNUC__) && !defined(_MSC_VER)
857 // Unknown compiler, default to RTTI
858 #define ABSL_INTERNAL_HAS_RTTI 1
859 #endif
860 
861 // `ABSL_INTERNAL_HAS_CXA_DEMANGLE` determines whether `abi::__cxa_demangle` is
862 // available.
863 #ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
864 #error ABSL_INTERNAL_HAS_CXA_DEMANGLE cannot be directly set
865 #elif defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__))
866 #define ABSL_INTERNAL_HAS_CXA_DEMANGLE 0
867 #elif defined(__GNUC__)
868 #define ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
869 #elif defined(__clang__) && !defined(_MSC_VER)
870 #define ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
871 #endif
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     !defined(_M_ARM64EC)
882 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 1
883 // indicates that at least SSE was targeted with the /arch:SSE option.
884 // All x86-64 processors support SSE, so support can be assumed.
885 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
886 #define ABSL_INTERNAL_HAVE_SSE 1
887 #endif
888 
889 // ABSL_INTERNAL_HAVE_SSE2 is used for compile-time detection of SSE2 support.
890 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
891 // which architectures support the various x86 instruction sets.
892 #ifdef ABSL_INTERNAL_HAVE_SSE2
893 #error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set
894 #elif defined(__SSE2__)
895 #define ABSL_INTERNAL_HAVE_SSE2 1
896 #elif (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) && \
897     !defined(_M_ARM64EC)
898 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2
899 // indicates that at least SSE2 was targeted with the /arch:SSE2 option.
900 // All x86-64 processors support SSE2, so support can be assumed.
901 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
902 #define ABSL_INTERNAL_HAVE_SSE2 1
903 #endif
904 
905 // ABSL_INTERNAL_HAVE_SSSE3 is used for compile-time detection of SSSE3 support.
906 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
907 // which architectures support the various x86 instruction sets.
908 //
909 // MSVC does not have a mode that targets SSSE3 at compile-time. To use SSSE3
910 // with MSVC requires either assuming that the code will only every run on CPUs
911 // that support SSSE3, otherwise __cpuid() can be used to detect support at
912 // runtime and fallback to a non-SSSE3 implementation when SSSE3 is unsupported
913 // by the CPU.
914 #ifdef ABSL_INTERNAL_HAVE_SSSE3
915 #error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set
916 #elif defined(__SSSE3__)
917 #define ABSL_INTERNAL_HAVE_SSSE3 1
918 #endif
919 
920 // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM
921 // SIMD).
922 //
923 // If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode.
924 // In device mode, NEON intrinsics are not available, regardless of host
925 // platform.
926 // https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code
927 #ifdef ABSL_INTERNAL_HAVE_ARM_NEON
928 #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set
929 #elif defined(__ARM_NEON) && !(defined(__NVCC__) && defined(__CUDACC__))
930 #define ABSL_INTERNAL_HAVE_ARM_NEON 1
931 #endif
932 
933 // ABSL_HAVE_CONSTANT_EVALUATED is used for compile-time detection of
934 // constant evaluation support through `absl::is_constant_evaluated`.
935 #ifdef ABSL_HAVE_CONSTANT_EVALUATED
936 #error ABSL_HAVE_CONSTANT_EVALUATED cannot be directly set
937 #endif
938 #ifdef __cpp_lib_is_constant_evaluated
939 #define ABSL_HAVE_CONSTANT_EVALUATED 1
940 #elif ABSL_HAVE_BUILTIN(__builtin_is_constant_evaluated)
941 #define ABSL_HAVE_CONSTANT_EVALUATED 1
942 #endif
943 
944 // ABSL_INTERNAL_CONSTEXPR_SINCE_CXXYY is used to conditionally define constexpr
945 // for different C++ versions.
946 //
947 // These macros are an implementation detail and will be unconditionally removed
948 // once the minimum supported C++ version catches up to a given version.
949 //
950 // For this reason, this symbol is considered INTERNAL and code outside of
951 // Abseil must not use it.
952 #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
953     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
954 #define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17 constexpr
955 #else
956 #define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX17
957 #endif
958 #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
959     ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
960 #define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 constexpr
961 #else
962 #define ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20
963 #endif
964 
965 // ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros
966 // into an integer that can be compared against.
967 #ifdef ABSL_INTERNAL_EMSCRIPTEN_VERSION
968 #error ABSL_INTERNAL_EMSCRIPTEN_VERSION cannot be directly set
969 #endif
970 #ifdef __EMSCRIPTEN__
971 #include <emscripten/version.h>
972 #ifdef __EMSCRIPTEN_major__
973 #if __EMSCRIPTEN_minor__ >= 1000
974 #error __EMSCRIPTEN_minor__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION
975 #endif
976 #if __EMSCRIPTEN_tiny__ >= 1000
977 #error __EMSCRIPTEN_tiny__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION
978 #endif
979 #define ABSL_INTERNAL_EMSCRIPTEN_VERSION                              \
980   ((__EMSCRIPTEN_major__) * 1000000 + (__EMSCRIPTEN_minor__) * 1000 + \
981    (__EMSCRIPTEN_tiny__))
982 #endif
983 #endif
984 
985 #endif  // ABSL_BASE_CONFIG_H_
986