• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
241 #error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
242 #define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
243 #endif
244 
245 // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
246 //
247 // Checks whether `std::is_trivially_default_constructible<T>` and
248 // `std::is_trivially_copy_constructible<T>` are supported.
249 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
250 #error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
251 #else
252 #define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
253 #endif
254 
255 // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
256 //
257 // Checks whether `std::is_trivially_copy_assignable<T>` is supported.
258 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
259 #error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot be directly set
260 #else
261 #define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
262 #endif
263 
264 // ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
265 //
266 // Checks whether `std::is_trivially_copyable<T>` is supported.
267 #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
268 #error ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set
269 #define ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
270 #endif
271 
272 // ABSL_HAVE_THREAD_LOCAL
273 //
274 // Checks whether C++11's `thread_local` storage duration specifier is
275 // supported.
276 #ifdef ABSL_HAVE_THREAD_LOCAL
277 #error ABSL_HAVE_THREAD_LOCAL cannot be directly set
278 #elif defined(__APPLE__)
279 // Notes:
280 // * Xcode's clang did not support `thread_local` until version 8, and
281 //   even then not for all iOS < 9.0.
282 // * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
283 //   targeting iOS 9.x.
284 // * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
285 //   making ABSL_HAVE_FEATURE unreliable there.
286 //
287 #if ABSL_HAVE_FEATURE(cxx_thread_local) && \
288     !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
289 #define ABSL_HAVE_THREAD_LOCAL 1
290 #endif
291 #else  // !defined(__APPLE__)
292 #define ABSL_HAVE_THREAD_LOCAL 1
293 #endif
294 
295 // There are platforms for which TLS should not be used even though the compiler
296 // makes it seem like it's supported (Android NDK < r12b for example).
297 // This is primarily because of linker problems and toolchain misconfiguration:
298 // Abseil does not intend to support this indefinitely. Currently, the newest
299 // toolchain that we intend to support that requires this behavior is the
300 // r11 NDK - allowing for a 5 year support window on that means this option
301 // is likely to be removed around June of 2021.
302 // TLS isn't supported until NDK r12b per
303 // https://developer.android.com/ndk/downloads/revision_history.html
304 // Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
305 // <android/ndk-version.h>. For NDK < r16, users should define these macros,
306 // e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
307 #if defined(__ANDROID__) && defined(__clang__)
308 #if __has_include(<android/ndk-version.h>)
309 #include <android/ndk-version.h>
310 #endif  // __has_include(<android/ndk-version.h>)
311 #if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
312     defined(__NDK_MINOR__) &&                                               \
313     ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
314 #undef ABSL_HAVE_TLS
315 #undef ABSL_HAVE_THREAD_LOCAL
316 #endif
317 #endif  // defined(__ANDROID__) && defined(__clang__)
318 
319 // ABSL_HAVE_INTRINSIC_INT128
320 //
321 // Checks whether the __int128 compiler extension for a 128-bit integral type is
322 // supported.
323 //
324 // Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
325 // supported, but we avoid using it in certain cases:
326 // * On Clang:
327 //   * Building using Clang for Windows, where the Clang runtime library has
328 //     128-bit support only on LP64 architectures, but Windows is LLP64.
329 // * On Nvidia's nvcc:
330 //   * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
331 //     actually support __int128.
332 #ifdef ABSL_HAVE_INTRINSIC_INT128
333 #error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
334 #elif defined(__SIZEOF_INT128__)
335 #if (defined(__clang__) && !defined(_WIN32)) || \
336     (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) ||                \
337     (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
338 #define ABSL_HAVE_INTRINSIC_INT128 1
339 #elif defined(__CUDACC__)
340 // __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
341 // string explaining that it has been removed starting with CUDA 9. We use
342 // nested #ifs because there is no short-circuiting in the preprocessor.
343 // NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
344 #if __CUDACC_VER__ >= 70000
345 #define ABSL_HAVE_INTRINSIC_INT128 1
346 #endif  // __CUDACC_VER__ >= 70000
347 #endif  // defined(__CUDACC__)
348 #endif  // ABSL_HAVE_INTRINSIC_INT128
349 
350 // ABSL_HAVE_EXCEPTIONS
351 //
352 // Checks whether the compiler both supports and enables exceptions. Many
353 // compilers support a "no exceptions" mode that disables exceptions.
354 //
355 // Generally, when ABSL_HAVE_EXCEPTIONS is not defined:
356 //
357 // * Code using `throw` and `try` may not compile.
358 // * The `noexcept` specifier will still compile and behave as normal.
359 // * The `noexcept` operator may still return `false`.
360 //
361 // For further details, consult the compiler's documentation.
362 #ifdef ABSL_HAVE_EXCEPTIONS
363 #error ABSL_HAVE_EXCEPTIONS cannot be directly set.
364 #elif ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(3, 6)
365 // Clang >= 3.6
366 #if ABSL_HAVE_FEATURE(cxx_exceptions)
367 #define ABSL_HAVE_EXCEPTIONS 1
368 #endif  // ABSL_HAVE_FEATURE(cxx_exceptions)
369 #elif defined(__clang__)
370 // Clang < 3.6
371 // http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
372 #if defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
373 #define ABSL_HAVE_EXCEPTIONS 1
374 #endif  // defined(__EXCEPTIONS) && ABSL_HAVE_FEATURE(cxx_exceptions)
375 // Handle remaining special cases and default to exceptions being supported.
376 #elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \
377     !(ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0) &&                        \
378       !defined(__cpp_exceptions)) &&                                      \
379     !(defined(_MSC_VER) && !defined(_CPPUNWIND))
380 #define ABSL_HAVE_EXCEPTIONS 1
381 #endif
382 
383 // -----------------------------------------------------------------------------
384 // Platform Feature Checks
385 // -----------------------------------------------------------------------------
386 
387 // Currently supported operating systems and associated preprocessor
388 // symbols:
389 //
390 //   Linux and Linux-derived           __linux__
391 //   Android                           __ANDROID__ (implies __linux__)
392 //   Linux (non-Android)               __linux__ && !__ANDROID__
393 //   Darwin (macOS and iOS)            __APPLE__
394 //   Akaros (http://akaros.org)        __ros__
395 //   Windows                           _WIN32
396 //   NaCL                              __native_client__
397 //   AsmJS                             __asmjs__
398 //   WebAssembly                       __wasm__
399 //   Fuchsia                           __Fuchsia__
400 //
401 // Note that since Android defines both __ANDROID__ and __linux__, one
402 // may probe for either Linux or Android by simply testing for __linux__.
403 
404 // ABSL_HAVE_MMAP
405 //
406 // Checks whether the platform has an mmap(2) implementation as defined in
407 // POSIX.1-2001.
408 #ifdef ABSL_HAVE_MMAP
409 #error ABSL_HAVE_MMAP cannot be directly set
410 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
411     defined(_AIX) || defined(__ros__) || defined(__native_client__) ||    \
412     defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) ||    \
413     defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) ||       \
414     defined(__HAIKU__) || defined(__OpenBSD__) || defined(__NetBSD__) ||  \
415     defined(__QNX__) || defined(__VXWORKS__) || defined(__hexagon__)
416 #define ABSL_HAVE_MMAP 1
417 #endif
418 
419 // ABSL_HAVE_PTHREAD_GETSCHEDPARAM
420 //
421 // Checks whether the platform implements the pthread_(get|set)schedparam(3)
422 // functions as defined in POSIX.1-2001.
423 #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
424 #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
425 #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
426     defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) ||          \
427     defined(__NetBSD__) || defined(__VXWORKS__)
428 #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
429 #endif
430 
431 // ABSL_HAVE_SCHED_GETCPU
432 //
433 // Checks whether sched_getcpu is available.
434 #ifdef ABSL_HAVE_SCHED_GETCPU
435 #error ABSL_HAVE_SCHED_GETCPU cannot be directly set
436 #elif defined(__linux__)
437 #define ABSL_HAVE_SCHED_GETCPU 1
438 #endif
439 
440 // ABSL_HAVE_SCHED_YIELD
441 //
442 // Checks whether the platform implements sched_yield(2) as defined in
443 // POSIX.1-2001.
444 #ifdef ABSL_HAVE_SCHED_YIELD
445 #error ABSL_HAVE_SCHED_YIELD cannot be directly set
446 #elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \
447     defined(__VXWORKS__)
448 #define ABSL_HAVE_SCHED_YIELD 1
449 #endif
450 
451 // ABSL_HAVE_SEMAPHORE_H
452 //
453 // Checks whether the platform supports the <semaphore.h> header and sem_init(3)
454 // family of functions as standardized in POSIX.1-2001.
455 //
456 // Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
457 // explicitly deprecated and will cause build failures if enabled for those
458 // platforms.  We side-step the issue by not defining it here for Apple
459 // platforms.
460 #ifdef ABSL_HAVE_SEMAPHORE_H
461 #error ABSL_HAVE_SEMAPHORE_H cannot be directly set
462 #elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__)
463 #define ABSL_HAVE_SEMAPHORE_H 1
464 #endif
465 
466 // ABSL_HAVE_ALARM
467 //
468 // Checks whether the platform supports the <signal.h> header and alarm(2)
469 // function as standardized in POSIX.1-2001.
470 #ifdef ABSL_HAVE_ALARM
471 #error ABSL_HAVE_ALARM cannot be directly set
472 #elif defined(__GOOGLE_GRTE_VERSION__)
473 // feature tests for Google's GRTE
474 #define ABSL_HAVE_ALARM 1
475 #elif defined(__GLIBC__)
476 // feature test for glibc
477 #define ABSL_HAVE_ALARM 1
478 #elif defined(_MSC_VER)
479 // feature tests for Microsoft's library
480 #elif defined(__MINGW32__)
481 // mingw32 doesn't provide alarm(2):
482 // https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.2-trunk/mingwrt/include/unistd.h
483 // mingw-w64 provides a no-op implementation:
484 // https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/misc/alarm.c
485 #elif defined(__EMSCRIPTEN__)
486 // emscripten doesn't support signals
487 #elif defined(__Fuchsia__)
488 // Signals don't exist on fuchsia.
489 #elif defined(__native_client__)
490 // Signals don't exist on hexagon/QuRT
491 #elif defined(__hexagon__)
492 #else
493 // other standard libraries
494 #define ABSL_HAVE_ALARM 1
495 #endif
496 
497 // ABSL_IS_LITTLE_ENDIAN
498 // ABSL_IS_BIG_ENDIAN
499 //
500 // Checks the endianness of the platform.
501 //
502 // Notes: uses the built in endian macros provided by GCC (since 4.6) and
503 // Clang (since 3.2); see
504 // https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html.
505 // Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error.
506 #if defined(ABSL_IS_BIG_ENDIAN)
507 #error "ABSL_IS_BIG_ENDIAN cannot be directly set."
508 #endif
509 #if defined(ABSL_IS_LITTLE_ENDIAN)
510 #error "ABSL_IS_LITTLE_ENDIAN cannot be directly set."
511 #endif
512 
513 #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
514      __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
515 #define ABSL_IS_LITTLE_ENDIAN 1
516 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
517     __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
518 #define ABSL_IS_BIG_ENDIAN 1
519 #elif defined(_WIN32)
520 #define ABSL_IS_LITTLE_ENDIAN 1
521 #else
522 #error "absl endian detection needs to be set up for your compiler"
523 #endif
524 
525 // macOS < 10.13 and iOS < 12 don't support <any>, <optional>, or <variant>
526 // because the libc++ shared library shipped on the system doesn't have the
527 // requisite exported symbols.  See
528 // https://github.com/abseil/abseil-cpp/issues/207 and
529 // https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
530 //
531 // libc++ spells out the availability requirements in the file
532 // llvm-project/libcxx/include/__config via the #define
533 // _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS. The set of versions has been
534 // modified a few times, via
535 // https://github.com/llvm/llvm-project/commit/7fb40e1569dd66292b647f4501b85517e9247953
536 // and
537 // https://github.com/llvm/llvm-project/commit/0bc451e7e137c4ccadcd3377250874f641ca514a
538 // The second has the actually correct versions, thus, is what we copy here.
539 #if defined(__APPLE__) &&                                           \
540     ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&     \
541       __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) ||    \
542      (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&    \
543       __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) ||   \
544      (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) &&     \
545       __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) ||     \
546      (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) &&        \
547       __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000))
548 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 1
549 #else
550 #define ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 0
551 #endif
552 
553 // ABSL_HAVE_STD_ANY
554 //
555 // Checks whether C++17 std::any is available.
556 #ifdef ABSL_HAVE_STD_ANY
557 #error "ABSL_HAVE_STD_ANY cannot be directly set."
558 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
559     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
560     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
561 #define ABSL_HAVE_STD_ANY 1
562 #endif
563 
564 // ABSL_HAVE_STD_OPTIONAL
565 //
566 // Checks whether C++17 std::optional is available.
567 #ifdef ABSL_HAVE_STD_OPTIONAL
568 #error "ABSL_HAVE_STD_OPTIONAL cannot be directly set."
569 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) &&  \
570     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
571     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
572 #define ABSL_HAVE_STD_OPTIONAL 1
573 #endif
574 
575 // ABSL_HAVE_STD_VARIANT
576 //
577 // Checks whether C++17 std::variant is available.
578 #ifdef ABSL_HAVE_STD_VARIANT
579 #error "ABSL_HAVE_STD_VARIANT cannot be directly set."
580 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
581     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
582     !ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
583 #define ABSL_HAVE_STD_VARIANT 1
584 #endif
585 
586 // ABSL_HAVE_STD_STRING_VIEW
587 //
588 // Checks whether C++17 std::string_view is available.
589 #ifdef ABSL_HAVE_STD_STRING_VIEW
590 #error "ABSL_HAVE_STD_STRING_VIEW cannot be directly set."
591 #elif defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
592     ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
593 #define ABSL_HAVE_STD_STRING_VIEW 1
594 #endif
595 
596 // ABSL_USES_STD_ANY
597 //
598 // Indicates whether absl::any is an alias for std::any.
599 #if !defined(ABSL_OPTION_USE_STD_ANY)
600 #error options.h is misconfigured.
601 #elif ABSL_OPTION_USE_STD_ANY == 0 || \
602     (ABSL_OPTION_USE_STD_ANY == 2 && !defined(ABSL_HAVE_STD_ANY))
603 #undef ABSL_USES_STD_ANY
604 #elif ABSL_OPTION_USE_STD_ANY == 1 || \
605     (ABSL_OPTION_USE_STD_ANY == 2 && defined(ABSL_HAVE_STD_ANY))
606 #define ABSL_USES_STD_ANY 1
607 #else
608 #error options.h is misconfigured.
609 #endif
610 
611 // ABSL_USES_STD_OPTIONAL
612 //
613 // Indicates whether absl::optional is an alias for std::optional.
614 #if !defined(ABSL_OPTION_USE_STD_OPTIONAL)
615 #error options.h is misconfigured.
616 #elif ABSL_OPTION_USE_STD_OPTIONAL == 0 || \
617     (ABSL_OPTION_USE_STD_OPTIONAL == 2 && !defined(ABSL_HAVE_STD_OPTIONAL))
618 #undef ABSL_USES_STD_OPTIONAL
619 #elif ABSL_OPTION_USE_STD_OPTIONAL == 1 || \
620     (ABSL_OPTION_USE_STD_OPTIONAL == 2 && defined(ABSL_HAVE_STD_OPTIONAL))
621 #define ABSL_USES_STD_OPTIONAL 1
622 #else
623 #error options.h is misconfigured.
624 #endif
625 
626 // ABSL_USES_STD_VARIANT
627 //
628 // Indicates whether absl::variant is an alias for std::variant.
629 #if !defined(ABSL_OPTION_USE_STD_VARIANT)
630 #error options.h is misconfigured.
631 #elif ABSL_OPTION_USE_STD_VARIANT == 0 || \
632     (ABSL_OPTION_USE_STD_VARIANT == 2 && !defined(ABSL_HAVE_STD_VARIANT))
633 #undef ABSL_USES_STD_VARIANT
634 #elif ABSL_OPTION_USE_STD_VARIANT == 1 || \
635     (ABSL_OPTION_USE_STD_VARIANT == 2 && defined(ABSL_HAVE_STD_VARIANT))
636 #define ABSL_USES_STD_VARIANT 1
637 #else
638 #error options.h is misconfigured.
639 #endif
640 
641 // ABSL_USES_STD_STRING_VIEW
642 //
643 // Indicates whether absl::string_view is an alias for std::string_view.
644 #if !defined(ABSL_OPTION_USE_STD_STRING_VIEW)
645 #error options.h is misconfigured.
646 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
647     (ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
648      !defined(ABSL_HAVE_STD_STRING_VIEW))
649 #undef ABSL_USES_STD_STRING_VIEW
650 #elif ABSL_OPTION_USE_STD_STRING_VIEW == 1 || \
651     (ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
652      defined(ABSL_HAVE_STD_STRING_VIEW))
653 #define ABSL_USES_STD_STRING_VIEW 1
654 #else
655 #error options.h is misconfigured.
656 #endif
657 
658 // In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
659 // SEH exception from emplace for variant<SomeStruct> when constructing the
660 // struct can throw. This defeats some of variant_test and
661 // variant_exception_safety_test.
662 #if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
663 #define ABSL_INTERNAL_MSVC_2017_DBG_MODE
664 #endif
665 
666 // ABSL_INTERNAL_MANGLED_NS
667 // ABSL_INTERNAL_MANGLED_BACKREFERENCE
668 //
669 // Internal macros for building up mangled names in our internal fork of CCTZ.
670 // This implementation detail is only needed and provided for the MSVC build.
671 //
672 // These macros both expand to string literals.  ABSL_INTERNAL_MANGLED_NS is
673 // the mangled spelling of the `absl` namespace, and
674 // ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing
675 // the proper count to skip past the CCTZ fork namespace names.  (This number
676 // is one larger when there is an inline namespace name to skip.)
677 #if defined(_MSC_VER)
678 #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
679 #define ABSL_INTERNAL_MANGLED_NS "absl"
680 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
681 #else
682 #define ABSL_INTERNAL_MANGLED_NS \
683   ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
684 #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
685 #endif
686 #endif
687 
688 // ABSL_DLL
689 //
690 // When building Abseil as a DLL, this macro expands to `__declspec(dllexport)`
691 // so we can annotate symbols appropriately as being exported. When used in
692 // headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
693 // that consumers know the symbol is defined inside the DLL. In all other cases,
694 // the macro expands to nothing.
695 #if defined(_MSC_VER)
696 #if defined(ABSL_BUILD_DLL)
697 #define ABSL_DLL __declspec(dllexport)
698 #elif defined(ABSL_CONSUME_DLL)
699 #define ABSL_DLL __declspec(dllimport)
700 #else
701 #define ABSL_DLL
702 #endif
703 #else
704 #define ABSL_DLL
705 #endif  // defined(_MSC_VER)
706 
707 #if defined(_MSC_VER)
708 #if defined(ABSL_BUILD_TEST_DLL)
709 #define ABSL_TEST_DLL __declspec(dllexport)
710 #elif defined(ABSL_CONSUME_TEST_DLL)
711 #define ABSL_TEST_DLL __declspec(dllimport)
712 #else
713 #define ABSL_TEST_DLL
714 #endif
715 #else
716 #define ABSL_TEST_DLL
717 #endif  // defined(_MSC_VER)
718 
719 // ABSL_HAVE_MEMORY_SANITIZER
720 //
721 // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
722 // a compiler instrumentation module and a run-time library.
723 #ifdef ABSL_HAVE_MEMORY_SANITIZER
724 #error "ABSL_HAVE_MEMORY_SANITIZER cannot be directly set."
725 #elif !defined(__native_client__) && ABSL_HAVE_FEATURE(memory_sanitizer)
726 #define ABSL_HAVE_MEMORY_SANITIZER 1
727 #endif
728 
729 // ABSL_HAVE_THREAD_SANITIZER
730 //
731 // ThreadSanitizer (TSan) is a fast data race detector.
732 #ifdef ABSL_HAVE_THREAD_SANITIZER
733 #error "ABSL_HAVE_THREAD_SANITIZER cannot be directly set."
734 #elif defined(__SANITIZE_THREAD__)
735 #define ABSL_HAVE_THREAD_SANITIZER 1
736 #elif ABSL_HAVE_FEATURE(thread_sanitizer)
737 #define ABSL_HAVE_THREAD_SANITIZER 1
738 #endif
739 
740 // ABSL_HAVE_ADDRESS_SANITIZER
741 //
742 // AddressSanitizer (ASan) is a fast memory error detector.
743 #ifdef ABSL_HAVE_ADDRESS_SANITIZER
744 #error "ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set."
745 #elif defined(__SANITIZE_ADDRESS__)
746 #define ABSL_HAVE_ADDRESS_SANITIZER 1
747 #elif ABSL_HAVE_FEATURE(address_sanitizer)
748 #define ABSL_HAVE_ADDRESS_SANITIZER 1
749 #endif
750 
751 // ABSL_HAVE_HWADDRESS_SANITIZER
752 //
753 // Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan
754 // memory error detector which can use CPU features like ARM TBI, Intel LAM or
755 // AMD UAI.
756 #ifdef ABSL_HAVE_HWADDRESS_SANITIZER
757 #error "ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set."
758 #elif defined(__SANITIZE_HWADDRESS__)
759 #define ABSL_HAVE_HWADDRESS_SANITIZER 1
760 #elif ABSL_HAVE_FEATURE(hwaddress_sanitizer)
761 #define ABSL_HAVE_HWADDRESS_SANITIZER 1
762 #endif
763 
764 // ABSL_HAVE_DATAFLOW_SANITIZER
765 //
766 // Dataflow Sanitizer (or DFSAN) is a generalised dynamic data flow analysis.
767 #ifdef ABSL_HAVE_DATAFLOW_SANITIZER
768 #error "ABSL_HAVE_DATAFLOW_SANITIZER cannot be directly set."
769 #elif defined(DATAFLOW_SANITIZER)
770 // GCC provides no method for detecting the presence of the standalone
771 // DataFlowSanitizer (-fsanitize=dataflow), so GCC users of -fsanitize=dataflow
772 // should also use -DDATAFLOW_SANITIZER.
773 #define ABSL_HAVE_DATAFLOW_SANITIZER 1
774 #elif ABSL_HAVE_FEATURE(dataflow_sanitizer)
775 #define ABSL_HAVE_DATAFLOW_SANITIZER 1
776 #endif
777 
778 // ABSL_HAVE_LEAK_SANITIZER
779 //
780 // LeakSanitizer (or lsan) is a detector of memory leaks.
781 // https://clang.llvm.org/docs/LeakSanitizer.html
782 // https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
783 //
784 // The macro ABSL_HAVE_LEAK_SANITIZER can be used to detect at compile-time
785 // whether the LeakSanitizer is potentially available. However, just because the
786 // LeakSanitizer is available does not mean it is active. Use the
787 // always-available run-time interface in //absl/debugging/leak_check.h for
788 // interacting with LeakSanitizer.
789 #ifdef ABSL_HAVE_LEAK_SANITIZER
790 #error "ABSL_HAVE_LEAK_SANITIZER cannot be directly set."
791 #elif defined(LEAK_SANITIZER)
792 // GCC provides no method for detecting the presence of the standalone
793 // LeakSanitizer (-fsanitize=leak), so GCC users of -fsanitize=leak should also
794 // use -DLEAK_SANITIZER.
795 #define ABSL_HAVE_LEAK_SANITIZER 1
796 // Clang standalone LeakSanitizer (-fsanitize=leak)
797 #elif ABSL_HAVE_FEATURE(leak_sanitizer)
798 #define ABSL_HAVE_LEAK_SANITIZER 1
799 #elif defined(ABSL_HAVE_ADDRESS_SANITIZER)
800 // GCC or Clang using the LeakSanitizer integrated into AddressSanitizer.
801 #define ABSL_HAVE_LEAK_SANITIZER 1
802 #endif
803 
804 // ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
805 //
806 // Class template argument deduction is a language feature added in C++17.
807 #ifdef ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
808 #error "ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION cannot be directly set."
809 #elif defined(__cpp_deduction_guides)
810 #define ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
811 #endif
812 
813 // ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
814 //
815 // Prior to C++17, static constexpr variables defined in classes required a
816 // separate definition outside of the class body, for example:
817 //
818 // class Foo {
819 //   static constexpr int kBar = 0;
820 // };
821 // constexpr int Foo::kBar;
822 //
823 // In C++17, these variables defined in classes are considered inline variables,
824 // and the extra declaration is redundant. Since some compilers warn on the
825 // extra declarations, ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL can be used
826 // conditionally ignore them:
827 //
828 // #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
829 // constexpr int Foo::kBar;
830 // #endif
831 #if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
832     ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L
833 #define ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1
834 #endif
835 
836 // `ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with
837 // RTTI support.
838 #ifdef ABSL_INTERNAL_HAS_RTTI
839 #error ABSL_INTERNAL_HAS_RTTI cannot be directly set
840 #elif (defined(__GNUC__) && defined(__GXX_RTTI)) || \
841     (defined(_MSC_VER) && defined(_CPPRTTI)) ||     \
842     (!defined(__GNUC__) && !defined(_MSC_VER))
843 #define ABSL_INTERNAL_HAS_RTTI 1
844 #endif  // !defined(__GNUC__) || defined(__GXX_RTTI)
845 
846 // ABSL_INTERNAL_HAVE_SSE is used for compile-time detection of SSE support.
847 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
848 // which architectures support the various x86 instruction sets.
849 #ifdef ABSL_INTERNAL_HAVE_SSE
850 #error ABSL_INTERNAL_HAVE_SSE cannot be directly set
851 #elif defined(__SSE__)
852 #define ABSL_INTERNAL_HAVE_SSE 1
853 #elif (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) && \
854     !defined(_M_ARM64EC)
855 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 1
856 // indicates that at least SSE was targeted with the /arch:SSE option.
857 // All x86-64 processors support SSE, so support can be assumed.
858 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
859 #define ABSL_INTERNAL_HAVE_SSE 1
860 #endif
861 
862 // ABSL_INTERNAL_HAVE_SSE2 is used for compile-time detection of SSE2 support.
863 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
864 // which architectures support the various x86 instruction sets.
865 #ifdef ABSL_INTERNAL_HAVE_SSE2
866 #error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set
867 #elif defined(__SSE2__)
868 #define ABSL_INTERNAL_HAVE_SSE2 1
869 #elif (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) && \
870     !defined(_M_ARM64EC)
871 // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2
872 // indicates that at least SSE2 was targeted with the /arch:SSE2 option.
873 // All x86-64 processors support SSE2, so support can be assumed.
874 // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
875 #define ABSL_INTERNAL_HAVE_SSE2 1
876 #endif
877 
878 // ABSL_INTERNAL_HAVE_SSSE3 is used for compile-time detection of SSSE3 support.
879 // See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
880 // which architectures support the various x86 instruction sets.
881 //
882 // MSVC does not have a mode that targets SSSE3 at compile-time. To use SSSE3
883 // with MSVC requires either assuming that the code will only every run on CPUs
884 // that support SSSE3, otherwise __cpuid() can be used to detect support at
885 // runtime and fallback to a non-SSSE3 implementation when SSSE3 is unsupported
886 // by the CPU.
887 #ifdef ABSL_INTERNAL_HAVE_SSSE3
888 #error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set
889 #elif defined(__SSSE3__)
890 #define ABSL_INTERNAL_HAVE_SSSE3 1
891 #endif
892 
893 // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM
894 // SIMD).
895 //
896 // If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode.
897 // In device mode, NEON intrinsics are not available, regardless of host
898 // platform.
899 // https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code
900 #ifdef ABSL_INTERNAL_HAVE_ARM_NEON
901 #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set
902 #elif defined(__ARM_NEON) && !defined(__CUDA_ARCH__)
903 #define ABSL_INTERNAL_HAVE_ARM_NEON 1
904 #endif
905 
906 // ABSL_HAVE_CONSTANT_EVALUATED is used for compile-time detection of
907 // constant evaluation support through `absl::is_constant_evaluated`.
908 #ifdef ABSL_HAVE_CONSTANT_EVALUATED
909 #error ABSL_HAVE_CONSTANT_EVALUATED cannot be directly set
910 #endif
911 #ifdef __cpp_lib_is_constant_evaluated
912 #define ABSL_HAVE_CONSTANT_EVALUATED 1
913 #elif ABSL_HAVE_BUILTIN(__builtin_is_constant_evaluated)
914 #define ABSL_HAVE_CONSTANT_EVALUATED 1
915 #endif
916 
917 // ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros
918 // into an integer that can be compared against.
919 #ifdef ABSL_INTERNAL_EMSCRIPTEN_VERSION
920 #error ABSL_INTERNAL_EMSCRIPTEN_VERSION cannot be directly set
921 #endif
922 #ifdef __EMSCRIPTEN__
923 #include <emscripten/version.h>
924 #ifdef __EMSCRIPTEN_major__
925 #if __EMSCRIPTEN_minor__ >= 1000
926 #error __EMSCRIPTEN_minor__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION
927 #endif
928 #if __EMSCRIPTEN_tiny__ >= 1000
929 #error __EMSCRIPTEN_tiny__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION
930 #endif
931 #define ABSL_INTERNAL_EMSCRIPTEN_VERSION                          \
932   ((__EMSCRIPTEN_major__)*1000000 + (__EMSCRIPTEN_minor__)*1000 + \
933    (__EMSCRIPTEN_tiny__))
934 #endif
935 #endif
936 
937 #endif  // ABSL_BASE_CONFIG_H_
938