aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp-tstring/y_absl/base/config.h
blob: 22bbf3c0b59a8cd30537fc29a82023c9b17a1de1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: config.h
// -----------------------------------------------------------------------------
//
// This header file defines a set of macros for checking the presence of
// important compiler and platform features. Such macros can be used to
// produce portable code by parameterizing compilation based on the presence or
// lack of a given feature.
//
// We define a "feature" as some interface we wish to program to: for example,
// a library function or system call. A value of `1` indicates support for
// that feature; any other value indicates the feature support is undefined.
//
// Example:
//
// Suppose a programmer wants to write a program that uses the 'mmap()' system
// call. The Abseil macro for that feature (`Y_ABSL_HAVE_MMAP`) allows you to
// selectively include the `mmap.h` header and bracket code using that feature
// in the macro:
//
//   #include "y_absl/base/config.h"
//
//   #ifdef Y_ABSL_HAVE_MMAP
//   #include "sys/mman.h"
//   #endif  //Y_ABSL_HAVE_MMAP
//
//   ...
//   #ifdef Y_ABSL_HAVE_MMAP
//   void *ptr = mmap(...);
//   ...
//   #endif  // Y_ABSL_HAVE_MMAP

#ifndef Y_ABSL_BASE_CONFIG_H_
#define Y_ABSL_BASE_CONFIG_H_

// Included for the __GLIBC__ macro (or similar macros on other systems).
#include <limits.h>

#ifdef __cplusplus
// Included for __GLIBCXX__, _LIBCPP_VERSION
#include <cstddef>
#endif  // __cplusplus

// Y_ABSL_INTERNAL_CPLUSPLUS_LANG
//
// MSVC does not set the value of __cplusplus correctly, but instead uses
// _MSVC_LANG as a stand-in.
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
//
// However, there are reports that MSVC even sets _MSVC_LANG incorrectly at
// times, for example:
// https://github.com/microsoft/vscode-cpptools/issues/1770
// https://reviews.llvm.org/D70996
//
// For this reason, this symbol is considered INTERNAL and code outside of
// Abseil must not use it.
#if defined(_MSVC_LANG)
#define Y_ABSL_INTERNAL_CPLUSPLUS_LANG _MSVC_LANG
#elif defined(__cplusplus)
#define Y_ABSL_INTERNAL_CPLUSPLUS_LANG __cplusplus
#endif

#if defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L
// Include library feature test macros.
#include <version>
#endif

#if defined(__APPLE__)
// Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED,
// __IPHONE_8_0.
#include <Availability.h>
#include <TargetConditionals.h>
#endif

#include "y_absl/base/options.h"
#include "y_absl/base/policy_checks.h"

// Abseil long-term support (LTS) releases will define
// `Y_ABSL_LTS_RELEASE_VERSION` to the integer representing the date string of the
// LTS release version, and will define `Y_ABSL_LTS_RELEASE_PATCH_LEVEL` to the
// integer representing the patch-level for that release.
//
// For example, for LTS release version "20300401.2", this would give us
// Y_ABSL_LTS_RELEASE_VERSION == 20300401 && Y_ABSL_LTS_RELEASE_PATCH_LEVEL == 2
//
// These symbols will not be defined in non-LTS code.
//
// Abseil recommends that clients live-at-head. Therefore, if you are using
// these symbols to assert a minimum version requirement, we recommend you do it
// as
//
// #if defined(Y_ABSL_LTS_RELEASE_VERSION) && Y_ABSL_LTS_RELEASE_VERSION < 20300401
// #error Project foo requires Abseil LTS version >= 20300401
// #endif
//
// The `defined(Y_ABSL_LTS_RELEASE_VERSION)` part of the check excludes
// live-at-head clients from the minimum version assertion.
//
// See https://abseil.io/about/releases for more information on Abseil release
// management.
//
// LTS releases can be obtained from
// https://github.com/abseil/abseil-cpp/releases.
#define Y_ABSL_LTS_RELEASE_VERSION 20240116
#define Y_ABSL_LTS_RELEASE_PATCH_LEVEL 2

// Helper macro to convert a CPP variable to a string literal.
#define Y_ABSL_INTERNAL_DO_TOKEN_STR(x) #x
#define Y_ABSL_INTERNAL_TOKEN_STR(x) Y_ABSL_INTERNAL_DO_TOKEN_STR(x)

// -----------------------------------------------------------------------------
// Abseil namespace annotations
// -----------------------------------------------------------------------------

// Y_ABSL_NAMESPACE_BEGIN/Y_ABSL_NAMESPACE_END
//
// An annotation placed at the beginning/end of each `namespace y_absl` scope.
// This is used to inject an inline namespace.
//
// The proper way to write Abseil code in the `y_absl` namespace is:
//
// namespace y_absl {
// Y_ABSL_NAMESPACE_BEGIN
//
// void Foo();  // y_absl::Foo().
//
// Y_ABSL_NAMESPACE_END
// }  // namespace y_absl
//
// Users of Abseil should not use these macros, because users of Abseil should
// not write `namespace y_absl {` in their own code for any reason.  (Abseil does
// not support forward declarations of its own types, nor does it support
// user-provided specialization of Abseil templates.  Code that violates these
// rules may be broken without warning.)
#if !defined(Y_ABSL_OPTION_USE_INLINE_NAMESPACE) || \
    !defined(Y_ABSL_OPTION_INLINE_NAMESPACE_NAME)
#error options.h is misconfigured.
#endif

// Check that Y_ABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
#if defined(__cplusplus) && Y_ABSL_OPTION_USE_INLINE_NAMESPACE == 1

#define Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR \
  Y_ABSL_INTERNAL_TOKEN_STR(Y_ABSL_OPTION_INLINE_NAMESPACE_NAME)

static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != '\0',
              "options.h misconfigured: Y_ABSL_OPTION_INLINE_NAMESPACE_NAME must "
              "not be empty.");
static_assert(Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
                  Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[1] != 'e' ||
                  Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[2] != 'a' ||
                  Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[3] != 'd' ||
                  Y_ABSL_INTERNAL_INLINE_NAMESPACE_STR[4] != '\0',
              "options.h misconfigured: Y_ABSL_OPTION_INLINE_NAMESPACE_NAME must "
              "be changed to a new, unique identifier name.");

#endif

#if Y_ABSL_OPTION_USE_INLINE_NAMESPACE == 0
#define Y_ABSL_NAMESPACE_BEGIN
#define Y_ABSL_NAMESPACE_END
#define Y_ABSL_INTERNAL_C_SYMBOL(x) x
#elif Y_ABSL_OPTION_USE_INLINE_NAMESPACE == 1
#define Y_ABSL_NAMESPACE_BEGIN \
  inline namespace Y_ABSL_OPTION_INLINE_NAMESPACE_NAME {
#define Y_ABSL_NAMESPACE_END }
#define Y_ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v) x##_##v
#define Y_ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, v) \
  Y_ABSL_INTERNAL_C_SYMBOL_HELPER_2(x, v)
#define Y_ABSL_INTERNAL_C_SYMBOL(x) \
  Y_ABSL_INTERNAL_C_SYMBOL_HELPER_1(x, Y_ABSL_OPTION_INLINE_NAMESPACE_NAME)
#else
#error options.h is misconfigured.
#endif

// -----------------------------------------------------------------------------
// Compiler Feature Checks
// -----------------------------------------------------------------------------

// Y_ABSL_HAVE_BUILTIN()
//
// Checks whether the compiler supports a Clang Feature Checking Macro, and if
// so, checks whether it supports the provided builtin function "x" where x
// is one of the functions noted in
// https://clang.llvm.org/docs/LanguageExtensions.html
//
// Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
#ifdef __has_builtin
#define Y_ABSL_HAVE_BUILTIN(x) __has_builtin(x)
#else
#define Y_ABSL_HAVE_BUILTIN(x) 0
#endif

#ifdef __has_feature
#define Y_ABSL_HAVE_FEATURE(f) __has_feature(f)
#else
#define Y_ABSL_HAVE_FEATURE(f) 0
#endif

// Portable check for GCC minimum version:
// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define Y_ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) \
  (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
#else
#define Y_ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(x, y) 0
#endif

#if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
#define Y_ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) \
  (__clang_major__ > (x) || __clang_major__ == (x) && __clang_minor__ >= (y))
#else
#define Y_ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(x, y) 0
#endif

// Y_ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
// We assume __thread is supported on Linux or Asylo when compiled with Clang or
// compiled against libstdc++ with _GLIBCXX_HAVE_TLS defined.
#ifdef Y_ABSL_HAVE_TLS
#error Y_ABSL_HAVE_TLS cannot be directly set
#elif (defined(__linux__) || defined(__ASYLO__)) && \
    (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
#define Y_ABSL_HAVE_TLS 1
#endif

// Y_ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
//
// Checks whether `std::is_trivially_destructible<T>` is supported.
#ifdef Y_ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
#error Y_ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
#define Y_ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
#endif

// Y_ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
//
// Checks whether `std::is_trivially_default_constructible<T>` and
// `std::is_trivially_copy_constructible<T>` are supported.
#ifdef Y_ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
#error Y_ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
#else
#define Y_ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
#endif

// Y_ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
//
// Checks whether `std::is_trivially_copy_assignable<T>` is supported.
#ifdef Y_ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
#error Y_ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot be directly set
#else
#define Y_ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
#endif

// Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
//
// Checks whether `std::is_trivially_copyable<T>` is supported.
#ifdef Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE
#error Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE cannot be directly set
#define Y_ABSL_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
#endif

// Y_ABSL_HAVE_THREAD_LOCAL
//
// Checks whether C++11's `thread_local` storage duration specifier is
// supported.
#ifdef Y_ABSL_HAVE_THREAD_LOCAL
#error Y_ABSL_HAVE_THREAD_LOCAL cannot be directly set
#elif defined(__APPLE__)
// Notes:
// * Xcode's clang did not support `thread_local` until version 8, and
//   even then not for all iOS < 9.0.
// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
//   targeting iOS 9.x.
// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
//   making Y_ABSL_HAVE_FEATURE unreliable there.
//
#if Y_ABSL_HAVE_FEATURE(cxx_thread_local) && \
    !(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
#define Y_ABSL_HAVE_THREAD_LOCAL 1
#endif
#else  // !defined(__APPLE__)
#define Y_ABSL_HAVE_THREAD_LOCAL 1
#endif

// There are platforms for which TLS should not be used even though the compiler
// makes it seem like it's supported (Android NDK < r12b for example).
// This is primarily because of linker problems and toolchain misconfiguration:
// Abseil does not intend to support this indefinitely. Currently, the newest
// toolchain that we intend to support that requires this behavior is the
// r11 NDK - allowing for a 5 year support window on that means this option
// is likely to be removed around June of 2021.
// TLS isn't supported until NDK r12b per
// https://developer.android.com/ndk/downloads/revision_history.html
// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
// <android/ndk-version.h>. For NDK < r16, users should define these macros,
// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
#if defined(__ANDROID__) && defined(__clang__)
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif  // __has_include(<android/ndk-version.h>)
#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
    defined(__NDK_MINOR__) &&                                               \
    ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
#undef Y_ABSL_HAVE_TLS
#undef Y_ABSL_HAVE_THREAD_LOCAL
#endif
#endif  // defined(__ANDROID__) && defined(__clang__)

// Y_ABSL_HAVE_INTRINSIC_INT128
//
// Checks whether the __int128 compiler extension for a 128-bit integral type is
// supported.
//
// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
// supported, but we avoid using it in certain cases:
// * On Clang:
//   * Building using Clang for Windows, where the Clang runtime library has
//     128-bit support only on LP64 architectures, but Windows is LLP64.
// * On Nvidia's nvcc:
//   * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
//     actually support __int128.
#ifdef Y_ABSL_HAVE_INTRINSIC_INT128
#error Y_ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
#elif defined(__SIZEOF_INT128__)
#if (defined(__clang__) && !defined(_WIN32)) ||           \
    (defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
    (defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
#define Y_ABSL_HAVE_INTRINSIC_INT128 1
#elif defined(__CUDACC__)
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
// string explaining that it has been removed starting with CUDA 9. We use
// nested #ifs because there is no short-circuiting in the preprocessor.
// NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
#if __CUDACC_VER__ >= 70000
#define Y_ABSL_HAVE_INTRINSIC_INT128 1
#endif  // __CUDACC_VER__ >= 70000
#endif  // defined(__CUDACC__)
#endif  // Y_ABSL_HAVE_INTRINSIC_INT128

// Y_ABSL_HAVE_EXCEPTIONS
//
// Checks whether the compiler both supports and enables exceptions. Many
// compilers support a "no exceptions" mode that disables exceptions.
//
// Generally, when Y_ABSL_HAVE_EXCEPTIONS is not defined:
//
// * Code using `throw` and `try` may not compile.
// * The `noexcept` specifier will still compile and behave as normal.
// * The `noexcept` operator may still return `false`.
//
// For further details, consult the compiler's documentation.
#ifdef Y_ABSL_HAVE_EXCEPTIONS
#error Y_ABSL_HAVE_EXCEPTIONS cannot be directly set.
#elif Y_ABSL_INTERNAL_HAVE_MIN_CLANG_VERSION(3, 6)
// Clang >= 3.6
#if Y_ABSL_HAVE_FEATURE(cxx_exceptions)
#define Y_ABSL_HAVE_EXCEPTIONS 1
#endif  // Y_ABSL_HAVE_FEATURE(cxx_exceptions)
#elif defined(__clang__)
// Clang < 3.6
// http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
#if defined(__EXCEPTIONS) && Y_ABSL_HAVE_FEATURE(cxx_exceptions)
#define Y_ABSL_HAVE_EXCEPTIONS 1
#endif  // defined(__EXCEPTIONS) && Y_ABSL_HAVE_FEATURE(cxx_exceptions)
// Handle remaining special cases and default to exceptions being supported.
#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \
    !(Y_ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(5, 0) &&                        \
      !defined(__cpp_exceptions)) &&                                      \
    !(defined(_MSC_VER) && !defined(_CPPUNWIND))
#define Y_ABSL_HAVE_EXCEPTIONS 1
#endif

// -----------------------------------------------------------------------------
// Platform Feature Checks
// -----------------------------------------------------------------------------

// Currently supported operating systems and associated preprocessor
// symbols:
//
//   Linux and Linux-derived           __linux__
//   Android                           __ANDROID__ (implies __linux__)
//   Linux (non-Android)               __linux__ && !__ANDROID__
//   Darwin (macOS and iOS)            __APPLE__
//   Akaros (http://akaros.org)        __ros__
//   Windows                           _WIN32
//   NaCL                              __native_client__
//   AsmJS                             __asmjs__
//   WebAssembly (Emscripten)          __EMSCRIPTEN__
//   Fuchsia                           __Fuchsia__
//
// Note that since Android defines both __ANDROID__ and __linux__, one
// may probe for either Linux or Android by simply testing for __linux__.

// Y_ABSL_HAVE_MMAP
//
// Checks whether the platform has an mmap(2) implementation as defined in
// POSIX.1-2001.
#ifdef Y_ABSL_HAVE_MMAP
#error Y_ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||    \
    defined(_AIX) || defined(__ros__) || defined(__native_client__) ||       \
    defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \
    defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) ||          \
    defined(__HAIKU__) || defined(__OpenBSD__) || defined(__NetBSD__) ||     \
    defined(__QNX__) || defined(__VXWORKS__) || defined(__hexagon__)
#define Y_ABSL_HAVE_MMAP 1
#endif

// Y_ABSL_HAVE_PTHREAD_GETSCHEDPARAM
//
// Checks whether the platform implements the pthread_(get|set)schedparam(3)
// functions as defined in POSIX.1-2001.
#ifdef Y_ABSL_HAVE_PTHREAD_GETSCHEDPARAM
#error Y_ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
    defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) ||          \
    defined(__NetBSD__) || defined(__VXWORKS__)
#define Y_ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
#endif

// Y_ABSL_HAVE_SCHED_GETCPU
//
// Checks whether sched_getcpu is available.
#ifdef Y_ABSL_HAVE_SCHED_GETCPU
#error Y_ABSL_HAVE_SCHED_GETCPU cannot be directly set
#elif defined(__linux__)
#define Y_ABSL_HAVE_SCHED_GETCPU 1
#endif

// Y_ABSL_HAVE_SCHED_YIELD
//
// Checks whether the platform implements sched_yield(2) as defined in
// POSIX.1-2001.
#ifdef Y_ABSL_HAVE_SCHED_YIELD
#error Y_ABSL_HAVE_SCHED_YIELD cannot be directly set
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \
    defined(__VXWORKS__)
#define Y_ABSL_HAVE_SCHED_YIELD 1
#endif

// Y_ABSL_HAVE_SEMAPHORE_H
//
// Checks whether the platform supports the <semaphore.h> header and sem_init(3)
// family of functions as standardized in POSIX.1-2001.
//
// Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
// explicitly deprecated and will cause build failures if enabled for those
// platforms.  We side-step the issue by not defining it here for Apple
// platforms.
#ifdef Y_ABSL_HAVE_SEMAPHORE_H
#error Y_ABSL_HAVE_SEMAPHORE_H cannot be directly set
#elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__)
#define Y_ABSL_HAVE_SEMAPHORE_H 1
#endif

// Y_ABSL_HAVE_ALARM
//
// Checks whether the platform supports the <signal.h> header and alarm(2)
// function as standardized in POSIX.1-2001.
#ifdef Y_ABSL_HAVE_ALARM
#error Y_ABSL_HAVE_ALARM cannot be directly set
#elif defined(__GOOGLE_GRTE_VERSION__)
// feature tests for Google's GRTE
#define Y_ABSL_HAVE_ALARM 1
#elif defined(__GLIBC__)
// feature test for glibc
#define Y_ABSL_HAVE_ALARM 1
#elif defined(_MSC_VER)
// feature tests for Microsoft's library
#elif defined(__MINGW32__)
// mingw32 doesn't provide alarm(2):
// https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/5.2-trunk/mingwrt/include/unistd.h
// mingw-w64 provides a no-op implementation:
// https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-crt/misc/alarm.c
#elif defined(__EMSCRIPTEN__)
// emscripten doesn't support signals
#elif defined(__wasi__)
// WASI doesn't support signals
#elif defined(__Fuchsia__)
// Signals don't exist on fuchsia.
#elif defined(__native_client__)
// Signals don't exist on hexagon/QuRT
#elif defined(__hexagon__)
#else
// other standard libraries
#define Y_ABSL_HAVE_ALARM 1
#endif

// Y_ABSL_IS_LITTLE_ENDIAN
// Y_ABSL_IS_BIG_ENDIAN
//
// Checks the endianness of the platform.
//
// Notes: uses the built in endian macros provided by GCC (since 4.6) and
// Clang (since 3.2); see
// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html.
// Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error.
#if defined(Y_ABSL_IS_BIG_ENDIAN)
#error "Y_ABSL_IS_BIG_ENDIAN cannot be directly set."
#endif
#if defined(Y_ABSL_IS_LITTLE_ENDIAN)
#error "Y_ABSL_IS_LITTLE_ENDIAN cannot be directly set."
#endif

#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
     __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define Y_ABSL_IS_LITTLE_ENDIAN 1
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
    __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define Y_ABSL_IS_BIG_ENDIAN 1
#elif defined(_WIN32)
#define Y_ABSL_IS_LITTLE_ENDIAN 1
#else
#error "y_absl endian detection needs to be set up for your compiler"
#endif

// macOS < 10.13 and iOS < 12 don't support <any>, <optional>, or <variant>
// because the libc++ shared library shipped on the system doesn't have the
// requisite exported symbols.  See
// https://github.com/abseil/abseil-cpp/issues/207 and
// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
//
// libc++ spells out the availability requirements in the file
// llvm-project/libcxx/include/__config via the #define
// _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS. The set of versions has been
// modified a few times, via
// https://github.com/llvm/llvm-project/commit/7fb40e1569dd66292b647f4501b85517e9247953
// and
// https://github.com/llvm/llvm-project/commit/0bc451e7e137c4ccadcd3377250874f641ca514a
// The second has the actually correct versions, thus, is what we copy here.
#if defined(__APPLE__) &&                                         \
    ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&   \
      __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) ||  \
     (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&  \
      __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \
     (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) &&   \
      __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) ||   \
     (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) &&      \
      __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000))
#define Y_ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 1
#else
#define Y_ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE 0
#endif

// Y_ABSL_HAVE_STD_ANY
//
// Checks whether C++17 std::any is available.
#ifdef Y_ABSL_HAVE_STD_ANY
#error "Y_ABSL_HAVE_STD_ANY cannot be directly set."
#elif defined(__cpp_lib_any) && __cpp_lib_any >= 201606L
#define Y_ABSL_HAVE_STD_ANY 1
#elif defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
    !Y_ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
#define Y_ABSL_HAVE_STD_ANY 1
#endif

// Y_ABSL_HAVE_STD_OPTIONAL
//
// Checks whether C++17 std::optional is available.
#ifdef Y_ABSL_HAVE_STD_OPTIONAL
#error "Y_ABSL_HAVE_STD_OPTIONAL cannot be directly set."
#elif defined(__cpp_lib_optional) && __cpp_lib_optional >= 202106L
#define Y_ABSL_HAVE_STD_OPTIONAL 1
#elif defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
    !Y_ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
#define Y_ABSL_HAVE_STD_OPTIONAL 1
#endif

// Y_ABSL_HAVE_STD_VARIANT
//
// Checks whether C++17 std::variant is available.
#ifdef Y_ABSL_HAVE_STD_VARIANT
#error "Y_ABSL_HAVE_STD_VARIANT cannot be directly set."
#elif defined(__cpp_lib_variant) && __cpp_lib_variant >= 201606L
#define Y_ABSL_HAVE_STD_VARIANT 1
#elif defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L && \
    !Y_ABSL_INTERNAL_APPLE_CXX17_TYPES_UNAVAILABLE
#define Y_ABSL_HAVE_STD_VARIANT 1
#endif

// Y_ABSL_HAVE_STD_STRING_VIEW
//
// Checks whether C++17 std::string_view is available.
#ifdef Y_ABSL_HAVE_STD_STRING_VIEW
#error "Y_ABSL_HAVE_STD_STRING_VIEW cannot be directly set."
#elif defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606L
#define Y_ABSL_HAVE_STD_STRING_VIEW 1
#elif defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L
#define Y_ABSL_HAVE_STD_STRING_VIEW 1
#endif

// Y_ABSL_HAVE_STD_ORDERING
//
// Checks whether C++20 std::{partial,weak,strong}_ordering are available.
//
// __cpp_lib_three_way_comparison is missing on libc++
// (https://github.com/llvm/llvm-project/issues/73953) so treat it as defined
// when building in C++20 mode.
#ifdef Y_ABSL_HAVE_STD_ORDERING
#error "Y_ABSL_HAVE_STD_ORDERING cannot be directly set."
#elif (defined(__cpp_lib_three_way_comparison) &&    \
       __cpp_lib_three_way_comparison >= 201907L) || \
    (defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) &&        \
     Y_ABSL_INTERNAL_CPLUSPLUS_LANG >= 202002L)
#define Y_ABSL_HAVE_STD_ORDERING 1
#endif

// Y_ABSL_USES_STD_ANY
//
// Indicates whether y_absl::any is an alias for std::any.
#if !defined(Y_ABSL_OPTION_USE_STD_ANY)
#error options.h is misconfigured.
#elif Y_ABSL_OPTION_USE_STD_ANY == 0 || \
    (Y_ABSL_OPTION_USE_STD_ANY == 2 && !defined(Y_ABSL_HAVE_STD_ANY))
#undef Y_ABSL_USES_STD_ANY
#elif Y_ABSL_OPTION_USE_STD_ANY == 1 || \
    (Y_ABSL_OPTION_USE_STD_ANY == 2 && defined(Y_ABSL_HAVE_STD_ANY))
#define Y_ABSL_USES_STD_ANY 1
#else
#error options.h is misconfigured.
#endif

// Y_ABSL_USES_STD_OPTIONAL
//
// Indicates whether y_absl::optional is an alias for std::optional.
#if !defined(Y_ABSL_OPTION_USE_STD_OPTIONAL)
#error options.h is misconfigured.
#elif Y_ABSL_OPTION_USE_STD_OPTIONAL == 0 || \
    (Y_ABSL_OPTION_USE_STD_OPTIONAL == 2 && !defined(Y_ABSL_HAVE_STD_OPTIONAL))
#undef Y_ABSL_USES_STD_OPTIONAL
#elif Y_ABSL_OPTION_USE_STD_OPTIONAL == 1 || \
    (Y_ABSL_OPTION_USE_STD_OPTIONAL == 2 && defined(Y_ABSL_HAVE_STD_OPTIONAL))
#define Y_ABSL_USES_STD_OPTIONAL 1
#else
#error options.h is misconfigured.
#endif

// Y_ABSL_USES_STD_VARIANT
//
// Indicates whether y_absl::variant is an alias for std::variant.
#if !defined(Y_ABSL_OPTION_USE_STD_VARIANT)
#error options.h is misconfigured.
#elif Y_ABSL_OPTION_USE_STD_VARIANT == 0 || \
    (Y_ABSL_OPTION_USE_STD_VARIANT == 2 && !defined(Y_ABSL_HAVE_STD_VARIANT))
#undef Y_ABSL_USES_STD_VARIANT
#elif Y_ABSL_OPTION_USE_STD_VARIANT == 1 || \
    (Y_ABSL_OPTION_USE_STD_VARIANT == 2 && defined(Y_ABSL_HAVE_STD_VARIANT))
#define Y_ABSL_USES_STD_VARIANT 1
#else
#error options.h is misconfigured.
#endif

// Y_ABSL_USES_STD_STRING_VIEW
//
// Indicates whether y_absl::string_view is an alias for std::string_view.
#if !defined(Y_ABSL_OPTION_USE_STD_STRING_VIEW)
#error options.h is misconfigured.
#elif Y_ABSL_OPTION_USE_STD_STRING_VIEW == 0 || \
    (Y_ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
     !defined(Y_ABSL_HAVE_STD_STRING_VIEW))
#undef Y_ABSL_USES_STD_STRING_VIEW
#elif Y_ABSL_OPTION_USE_STD_STRING_VIEW == 1 || \
    (Y_ABSL_OPTION_USE_STD_STRING_VIEW == 2 &&  \
     defined(Y_ABSL_HAVE_STD_STRING_VIEW))
#define Y_ABSL_USES_STD_STRING_VIEW 1
#else
#error options.h is misconfigured.
#endif

// Y_ABSL_USES_STD_ORDERING
//
// Indicates whether y_absl::{partial,weak,strong}_ordering are aliases for the
// std:: ordering types.
#if !defined(Y_ABSL_OPTION_USE_STD_ORDERING)
#error options.h is misconfigured.
#elif Y_ABSL_OPTION_USE_STD_ORDERING == 0 || \
    (Y_ABSL_OPTION_USE_STD_ORDERING == 2 && !defined(Y_ABSL_HAVE_STD_ORDERING))
#undef Y_ABSL_USES_STD_ORDERING
#elif Y_ABSL_OPTION_USE_STD_ORDERING == 1 || \
    (Y_ABSL_OPTION_USE_STD_ORDERING == 2 && defined(Y_ABSL_HAVE_STD_ORDERING))
#define Y_ABSL_USES_STD_ORDERING 1
#else
#error options.h is misconfigured.
#endif

// In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
// SEH exception from emplace for variant<SomeStruct> when constructing the
// struct can throw. This defeats some of variant_test and
// variant_exception_safety_test.
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
#define Y_ABSL_INTERNAL_MSVC_2017_DBG_MODE
#endif

// Y_ABSL_INTERNAL_MANGLED_NS
// Y_ABSL_INTERNAL_MANGLED_BACKREFERENCE
//
// Internal macros for building up mangled names in our internal fork of CCTZ.
// This implementation detail is only needed and provided for the MSVC build.
//
// These macros both expand to string literals.  Y_ABSL_INTERNAL_MANGLED_NS is
// the mangled spelling of the `y_absl` namespace, and
// Y_ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing
// the proper count to skip past the CCTZ fork namespace names.  (This number
// is one larger when there is an inline namespace name to skip.)
#if defined(_MSC_VER)
#if Y_ABSL_OPTION_USE_INLINE_NAMESPACE == 0
#define Y_ABSL_INTERNAL_MANGLED_NS "y_absl"
#define Y_ABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
#else
#define Y_ABSL_INTERNAL_MANGLED_NS \
  Y_ABSL_INTERNAL_TOKEN_STR(Y_ABSL_OPTION_INLINE_NAMESPACE_NAME) "@y_absl"
#define Y_ABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
#endif
#endif

// Y_ABSL_DLL
//
// When building Abseil as a DLL, this macro expands to `__declspec(dllexport)`
// so we can annotate symbols appropriately as being exported. When used in
// headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
// that consumers know the symbol is defined inside the DLL. In all other cases,
// the macro expands to nothing.
#if defined(_MSC_VER)
#if defined(Y_ABSL_BUILD_DLL)
#define Y_ABSL_DLL __declspec(dllexport)
#elif defined(Y_ABSL_CONSUME_DLL)
#define Y_ABSL_DLL __declspec(dllimport)
#else
#define Y_ABSL_DLL
#endif
#else
#define Y_ABSL_DLL
#endif  // defined(_MSC_VER)

#if defined(_MSC_VER)
#if defined(Y_ABSL_BUILD_TEST_DLL)
#define Y_ABSL_TEST_DLL __declspec(dllexport)
#elif defined(Y_ABSL_CONSUME_TEST_DLL)
#define Y_ABSL_TEST_DLL __declspec(dllimport)
#else
#define Y_ABSL_TEST_DLL
#endif
#else
#define Y_ABSL_TEST_DLL
#endif  // defined(_MSC_VER)

// Y_ABSL_HAVE_MEMORY_SANITIZER
//
// MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of
// a compiler instrumentation module and a run-time library.
#ifdef Y_ABSL_HAVE_MEMORY_SANITIZER
#error "Y_ABSL_HAVE_MEMORY_SANITIZER cannot be directly set."
#elif !defined(__native_client__) && Y_ABSL_HAVE_FEATURE(memory_sanitizer)
#define Y_ABSL_HAVE_MEMORY_SANITIZER 1
#endif

// Y_ABSL_HAVE_THREAD_SANITIZER
//
// ThreadSanitizer (TSan) is a fast data race detector.
#ifdef Y_ABSL_HAVE_THREAD_SANITIZER
#error "Y_ABSL_HAVE_THREAD_SANITIZER cannot be directly set."
#elif defined(__SANITIZE_THREAD__)
#define Y_ABSL_HAVE_THREAD_SANITIZER 1
#elif Y_ABSL_HAVE_FEATURE(thread_sanitizer)
#define Y_ABSL_HAVE_THREAD_SANITIZER 1
#endif

// Y_ABSL_HAVE_ADDRESS_SANITIZER
//
// AddressSanitizer (ASan) is a fast memory error detector.
#ifdef Y_ABSL_HAVE_ADDRESS_SANITIZER
#error "Y_ABSL_HAVE_ADDRESS_SANITIZER cannot be directly set."
#elif defined(__SANITIZE_ADDRESS__)
#define Y_ABSL_HAVE_ADDRESS_SANITIZER 1
#elif Y_ABSL_HAVE_FEATURE(address_sanitizer)
#define Y_ABSL_HAVE_ADDRESS_SANITIZER 1
#endif

// Y_ABSL_HAVE_HWADDRESS_SANITIZER
//
// Hardware-Assisted AddressSanitizer (or HWASAN) is even faster than asan
// memory error detector which can use CPU features like ARM TBI, Intel LAM or
// AMD UAI.
#ifdef Y_ABSL_HAVE_HWADDRESS_SANITIZER
#error "Y_ABSL_HAVE_HWADDRESS_SANITIZER cannot be directly set."
#elif defined(__SANITIZE_HWADDRESS__)
#define Y_ABSL_HAVE_HWADDRESS_SANITIZER 1
#elif Y_ABSL_HAVE_FEATURE(hwaddress_sanitizer)
#define Y_ABSL_HAVE_HWADDRESS_SANITIZER 1
#endif

// Y_ABSL_HAVE_DATAFLOW_SANITIZER
//
// Dataflow Sanitizer (or DFSAN) is a generalised dynamic data flow analysis.
#ifdef Y_ABSL_HAVE_DATAFLOW_SANITIZER
#error "Y_ABSL_HAVE_DATAFLOW_SANITIZER cannot be directly set."
#elif defined(DATAFLOW_SANITIZER)
// GCC provides no method for detecting the presence of the standalone
// DataFlowSanitizer (-fsanitize=dataflow), so GCC users of -fsanitize=dataflow
// should also use -DDATAFLOW_SANITIZER.
#define Y_ABSL_HAVE_DATAFLOW_SANITIZER 1
#elif Y_ABSL_HAVE_FEATURE(dataflow_sanitizer)
#define Y_ABSL_HAVE_DATAFLOW_SANITIZER 1
#endif

// Y_ABSL_HAVE_LEAK_SANITIZER
//
// LeakSanitizer (or lsan) is a detector of memory leaks.
// https://clang.llvm.org/docs/LeakSanitizer.html
// https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
//
// The macro Y_ABSL_HAVE_LEAK_SANITIZER can be used to detect at compile-time
// whether the LeakSanitizer is potentially available. However, just because the
// LeakSanitizer is available does not mean it is active. Use the
// always-available run-time interface in //y_absl/debugging/leak_check.h for
// interacting with LeakSanitizer.
#ifdef Y_ABSL_HAVE_LEAK_SANITIZER
#error "Y_ABSL_HAVE_LEAK_SANITIZER cannot be directly set."
#elif defined(LEAK_SANITIZER)
// GCC provides no method for detecting the presence of the standalone
// LeakSanitizer (-fsanitize=leak), so GCC users of -fsanitize=leak should also
// use -DLEAK_SANITIZER.
#define Y_ABSL_HAVE_LEAK_SANITIZER 1
// Clang standalone LeakSanitizer (-fsanitize=leak)
#elif Y_ABSL_HAVE_FEATURE(leak_sanitizer)
#define Y_ABSL_HAVE_LEAK_SANITIZER 1
#elif defined(Y_ABSL_HAVE_ADDRESS_SANITIZER)
// GCC or Clang using the LeakSanitizer integrated into AddressSanitizer.
#define Y_ABSL_HAVE_LEAK_SANITIZER 1
#endif

// Y_ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
//
// Class template argument deduction is a language feature added in C++17.
#ifdef Y_ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
#error "Y_ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION cannot be directly set."
#elif defined(__cpp_deduction_guides)
#define Y_ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
#endif

// Y_ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
//
// Prior to C++17, static constexpr variables defined in classes required a
// separate definition outside of the class body, for example:
//
// class Foo {
//   static constexpr int kBar = 0;
// };
// constexpr int Foo::kBar;
//
// In C++17, these variables defined in classes are considered inline variables,
// and the extra declaration is redundant. Since some compilers warn on the
// extra declarations, Y_ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL can be used
// conditionally ignore them:
//
// #ifdef Y_ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
// constexpr int Foo::kBar;
// #endif
#if defined(Y_ABSL_INTERNAL_CPLUSPLUS_LANG) && \
    Y_ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L
#define Y_ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1
#endif

// `Y_ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with
// RTTI support.
#ifdef Y_ABSL_INTERNAL_HAS_RTTI
#error Y_ABSL_INTERNAL_HAS_RTTI cannot be directly set
#elif Y_ABSL_HAVE_FEATURE(cxx_rtti)
#define Y_ABSL_INTERNAL_HAS_RTTI 1
#elif defined(__GNUC__) && defined(__GXX_RTTI)
#define Y_ABSL_INTERNAL_HAS_RTTI 1
#elif defined(_MSC_VER) && defined(_CPPRTTI)
#define Y_ABSL_INTERNAL_HAS_RTTI 1
#elif !defined(__GNUC__) && !defined(_MSC_VER)
// Unknown compiler, default to RTTI
#define Y_ABSL_INTERNAL_HAS_RTTI 1
#endif

// `Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE` determines whether `abi::__cxa_demangle` is
// available.
#ifdef Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE
#error Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE cannot be directly set
#elif defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__))
#define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 0
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) &&            \
    (__GNUC__ >= 4 || (__GNUC__ >= 3 && __GNUC_MINOR__ >= 4)) && \
    !defined(__mips__)
#define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
#elif defined(__clang__) && !defined(_MSC_VER)
#define Y_ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
#endif

// Y_ABSL_INTERNAL_HAVE_SSE is used for compile-time detection of SSE support.
// See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
// which architectures support the various x86 instruction sets.
#ifdef Y_ABSL_INTERNAL_HAVE_SSE
#error Y_ABSL_INTERNAL_HAVE_SSE cannot be directly set
#elif defined(__SSE__)
#define Y_ABSL_INTERNAL_HAVE_SSE 1
#elif (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) && \
    !defined(_M_ARM64EC)
// MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 1
// indicates that at least SSE was targeted with the /arch:SSE option.
// All x86-64 processors support SSE, so support can be assumed.
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
#define Y_ABSL_INTERNAL_HAVE_SSE 1
#endif

// Y_ABSL_INTERNAL_HAVE_SSE2 is used for compile-time detection of SSE2 support.
// See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
// which architectures support the various x86 instruction sets.
#ifdef Y_ABSL_INTERNAL_HAVE_SSE2
#error Y_ABSL_INTERNAL_HAVE_SSE2 cannot be directly set
#elif defined(__SSE2__)
#define Y_ABSL_INTERNAL_HAVE_SSE2 1
#elif (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) && \
    !defined(_M_ARM64EC)
// MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2
// indicates that at least SSE2 was targeted with the /arch:SSE2 option.
// All x86-64 processors support SSE2, so support can be assumed.
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
#define Y_ABSL_INTERNAL_HAVE_SSE2 1
#endif

// Y_ABSL_INTERNAL_HAVE_SSSE3 is used for compile-time detection of SSSE3 support.
// See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for an overview of
// which architectures support the various x86 instruction sets.
//
// MSVC does not have a mode that targets SSSE3 at compile-time. To use SSSE3
// with MSVC requires either assuming that the code will only every run on CPUs
// that support SSSE3, otherwise __cpuid() can be used to detect support at
// runtime and fallback to a non-SSSE3 implementation when SSSE3 is unsupported
// by the CPU.
#ifdef Y_ABSL_INTERNAL_HAVE_SSSE3
#error Y_ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set
#elif defined(__SSSE3__)
#define Y_ABSL_INTERNAL_HAVE_SSSE3 1
#endif

// Y_ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM
// SIMD).
//
// If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode.
// In device mode, NEON intrinsics are not available, regardless of host
// platform.
// https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code
#ifdef Y_ABSL_INTERNAL_HAVE_ARM_NEON
#error Y_ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set
#elif defined(__ARM_NEON) && !defined(__CUDA_ARCH__)
#define Y_ABSL_INTERNAL_HAVE_ARM_NEON 1
#endif

// Y_ABSL_HAVE_CONSTANT_EVALUATED is used for compile-time detection of
// constant evaluation support through `y_absl::is_constant_evaluated`.
#ifdef Y_ABSL_HAVE_CONSTANT_EVALUATED
#error Y_ABSL_HAVE_CONSTANT_EVALUATED cannot be directly set
#endif
#ifdef __cpp_lib_is_constant_evaluated
#define Y_ABSL_HAVE_CONSTANT_EVALUATED 1
#elif Y_ABSL_HAVE_BUILTIN(__builtin_is_constant_evaluated)
#define Y_ABSL_HAVE_CONSTANT_EVALUATED 1
#endif

// Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION combines Emscripten's three version macros
// into an integer that can be compared against.
#ifdef Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION
#error Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION cannot be directly set
#endif
#ifdef __EMSCRIPTEN__
#error #include <emscripten/version.h>
#ifdef __EMSCRIPTEN_major__
#if __EMSCRIPTEN_minor__ >= 1000
#error __EMSCRIPTEN_minor__ is too big to fit in Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION
#endif
#if __EMSCRIPTEN_tiny__ >= 1000
#error __EMSCRIPTEN_tiny__ is too big to fit in Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION
#endif
#define Y_ABSL_INTERNAL_EMSCRIPTEN_VERSION                              \
  ((__EMSCRIPTEN_major__) * 1000000 + (__EMSCRIPTEN_minor__) * 1000 + \
   (__EMSCRIPTEN_tiny__))
#endif
#endif

#endif  // Y_ABSL_BASE_CONFIG_H_