Repository navigation
Expand file tree
/
Copy pathconfig.h
More file actions
1889 lines (1595 loc) · 67.8 KB
/
Copy pathconfig.h
File metadata and controls
1889 lines (1595 loc) · 67.8 KB
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
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_INTERNAL_CONFIG_H
#define EASTL_INTERNAL_CONFIG_H
///////////////////////////////////////////////////////////////////////////////
// ReadMe
//
// This is the EASTL configuration file. All configurable parameters of EASTL
// are controlled through this file. However, all the settings here can be
// manually overridden by the user. There are three ways for a user to override
// the settings in this file:
//
// - Simply edit this file.
// - Define EASTL_USER_CONFIG_HEADER.
// - Predefine individual defines (e.g. EASTL_ASSERT).
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// EASTL_USER_CONFIG_HEADER
//
// This allows the user to define a header file to be #included before the
// EASTL config.h contents are compiled. A primary use of this is to override
// the contents of this config.h file. Note that all the settings below in
// this file are user-overridable.
//
// Example usage:
// #define EASTL_USER_CONFIG_HEADER "MyConfigOverrides.h"
// #include <EASTL/vector.h>
//
///////////////////////////////////////////////////////////////////////////////
#ifdef EASTL_USER_CONFIG_HEADER
#include EASTL_USER_CONFIG_HEADER
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_EABASE_DISABLED
//
// The user can disable EABase usage and manually supply the configuration
// via defining EASTL_EABASE_DISABLED and defining the appropriate entities
// globally or via the above EASTL_USER_CONFIG_HEADER.
//
// Example usage:
// #define EASTL_EABASE_DISABLED
// #include <EASTL/vector.h>
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_EABASE_DISABLED
#include <EABase/eabase.h>
#endif
#include <EABase/eahave.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_VERSION
//
// We more or less follow the conventional EA packaging approach to versioning
// here. A primary distinction here is that minor versions are defined as two
// digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic
// here is that the value is a counter and not a floating point fraction.
// Note that the major version doesn't have leading zeros.
//
// Example version strings:
// "0.91.00" // Major version 0, minor version 91, patch version 0.
// "1.00.00" // Major version 1, minor and patch version 0.
// "3.10.02" // Major version 3, minor version 10, patch version 02.
// "12.03.01" // Major version 12, minor version 03, patch version
//
// Example usage:
// printf("EASTL version: %s", EASTL_VERSION);
// printf("EASTL version: %d.%d.%d", EASTL_VERSION_N / 10000 % 100, EASTL_VERSION_N / 100 % 100, EASTL_VERSION_N % 100);
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_VERSION
#define EASTL_VERSION "3.18.00"
#define EASTL_VERSION_N 31800
#endif
///////////////////////////////////////////////////////////////////////////////
// EA_COMPILER_NO_STANDARD_CPP_LIBRARY
//
// Defined as 1 or undefined.
// Implements support for the definition of EA_COMPILER_NO_STANDARD_CPP_LIBRARY for the case
// of using EABase versions prior to the addition of its EA_COMPILER_NO_STANDARD_CPP_LIBRARY support.
//
#if !defined(EA_COMPILER_NO_STANDARD_CPP_LIBRARY)
#if defined(EA_PLATFORM_ANDROID)
// Disabled because EA's eaconfig/android_config/android_sdk packages currently
// don't support linking STL libraries. Perhaps we can figure out what linker arguments
// are needed for an app so we can manually specify them and then re-enable this code.
//
//#include <android/api-level.h>
//
//#if (__ANDROID_API__ < 9) // Earlier versions of Android provide no std C++ STL implementation.
#define EA_COMPILER_NO_STANDARD_CPP_LIBRARY 1
//#endif
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EA_NOEXCEPT
//
// Defined as a macro. Provided here for backward compatibility with older
// EABase versions prior to 2.00.40 that don't yet define it themselves.
//
#if !defined(EA_NOEXCEPT)
#define EA_NOEXCEPT
#define EA_NOEXCEPT_IF(predicate)
#define EA_NOEXCEPT_EXPR(expression) false
#endif
///////////////////////////////////////////////////////////////////////////////
// EA_CPP14_CONSTEXPR
//
// Defined as constexpr when a C++14 compiler is present. Defines it as nothing
// when using a C++11 compiler.
// C++14 relaxes the specification for constexpr such that it allows more
// kinds of expressions. Since a C++11 compiler doesn't allow this, we need
// to make a unique define for C++14 constexpr. This macro should be used only
// when you are using it with code that specfically requires C++14 constexpr
// functionality beyond the regular C++11 constexpr functionality.
// http://en.wikipedia.org/wiki/C%2B%2B14#Relaxed_constexpr_restrictions
//
#if !defined(EA_CPP14_CONSTEXPR)
#if defined(EA_COMPILER_CPP14_ENABLED)
#define EA_CPP14_CONSTEXPR constexpr
#else
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL namespace
//
// We define this so that users that #include this config file can reference
// these namespaces without seeing any other files that happen to use them.
///////////////////////////////////////////////////////////////////////////////
/// EA Standard Template Library
namespace eastl
{
// Intentionally empty.
}
///////////////////////////////////////////////////////////////////////////////
// EASTL_DEBUG
//
// Defined as an integer >= 0. Default is 1 for debug builds and 0 for
// release builds. This define is also a master switch for the default value
// of some other settings.
//
// Example usage:
// #if EASTL_DEBUG
// ...
// #endif
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_DEBUG
#if defined(EA_DEBUG) || defined(_DEBUG)
#define EASTL_DEBUG 1
#else
#define EASTL_DEBUG 0
#endif
#endif
// Developer debug. Helps EASTL developers assert EASTL is coded correctly.
// Normally disabled for users since it validates internal things and not user things.
#ifndef EASTL_DEV_DEBUG
#define EASTL_DEV_DEBUG 0
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_DEBUGPARAMS_LEVEL
//
// EASTL_DEBUGPARAMS_LEVEL controls what debug information is passed through to
// the allocator by default.
// This value may be defined by the user ... if not it will default to 1 for
// EA_DEBUG builds, otherwise 0.
//
// 0 - no debug information is passed through to allocator calls.
// 1 - 'name' is passed through to allocator calls.
// 2 - 'name', __FILE__, and __LINE__ are passed through to allocator calls.
//
// This parameter mirrors the equivalent parameter in the CoreAllocator package.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_DEBUGPARAMS_LEVEL
#if EASTL_DEBUG
#define EASTL_DEBUGPARAMS_LEVEL 2
#else
#define EASTL_DEBUGPARAMS_LEVEL 0
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_DLL
//
// Defined as 0 or 1. The default is dependent on the definition of EA_DLL.
// If EA_DLL is defined, then EASTL_DLL is 1, else EASTL_DLL is 0.
// EA_DLL is a define that controls DLL builds within the EAConfig build system.
// EASTL_DLL controls whether EASTL is built and used as a DLL.
// Normally you wouldn't do such a thing, but there are use cases for such
// a thing, particularly in the case of embedding C++ into C# applications.
//
#ifndef EASTL_DLL
#if defined(EA_DLL)
#define EASTL_DLL 1
#else
#define EASTL_DLL 0
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_IF_NOT_DLL
//
// Utility to include expressions only for static builds.
//
#ifndef EASTL_IF_NOT_DLL
#if EASTL_DLL
#define EASTL_IF_NOT_DLL(x)
#else
#define EASTL_IF_NOT_DLL(x) x
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_API
//
// This is used to label functions as DLL exports under Microsoft platforms.
// If EA_DLL is defined, then the user is building EASTL as a DLL and EASTL's
// non-templated functions will be exported. EASTL template functions are not
// labelled as EASTL_API (and are thus not exported in a DLL build). This is
// because it's not possible (or at least unsafe) to implement inline templated
// functions in a DLL.
//
// Example usage of EASTL_API:
// EASTL_API int someVariable = 10; // Export someVariable in a DLL build.
//
// struct EASTL_API SomeClass{ // Export SomeClass and its member functions in a DLL build.
// EASTL_LOCAL void PrivateMethod(); // Not exported.
// };
//
// EASTL_API void SomeFunction(); // Export SomeFunction in a DLL build.
//
//
#if defined(EA_DLL) && !defined(EASTL_DLL)
#define EASTL_DLL 1
#endif
#ifndef EASTL_API // If the build file hasn't already defined this to be dllexport...
#if EASTL_DLL
#if defined(_MSC_VER)
#define EASTL_API __declspec(dllimport)
#define EASTL_LOCAL
#elif defined(__CYGWIN__)
#define EASTL_API __attribute__((dllimport))
#define EASTL_LOCAL
#elif (defined(__GNUC__) && (__GNUC__ >= 4))
#define EASTL_API __attribute__ ((visibility("default")))
#define EASTL_LOCAL __attribute__ ((visibility("hidden")))
#else
#define EASTL_API
#define EASTL_LOCAL
#endif
#else
#define EASTL_API
#define EASTL_LOCAL
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_EASTDC_API
//
// This is used for importing EAStdC functions into EASTL, possibly via a DLL import.
//
#ifndef EASTL_EASTDC_API
#if EASTL_DLL
#if defined(_MSC_VER)
#define EASTL_EASTDC_API __declspec(dllimport)
#define EASTL_EASTDC_LOCAL
#elif defined(__CYGWIN__)
#define EASTL_EASTDC_API __attribute__((dllimport))
#define EASTL_EASTDC_LOCAL
#elif (defined(__GNUC__) && (__GNUC__ >= 4))
#define EASTL_EASTDC_API __attribute__ ((visibility("default")))
#define EASTL_EASTDC_LOCAL __attribute__ ((visibility("hidden")))
#else
#define EASTL_EASTDC_API
#define EASTL_EASTDC_LOCAL
#endif
#else
#define EASTL_EASTDC_API
#define EASTL_EASTDC_LOCAL
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_EASTDC_VSNPRINTF
//
// Defined as 0 or 1. By default it is 1.
//
// When enabled EASTL uses EAStdC's Vsnprintf function directly instead of
// having the user provide a global Vsnprintf8/16/32 function. The benefit
// of this is that it will allow EASTL to just link to EAStdC's Vsnprintf
// without the user doing anything. The downside is that any users who aren't
// already using EAStdC will either need to now depend on EAStdC or globally
// define this property to be 0 and simply provide functions that have the same
// names. See the usage of EASTL_EASTDC_VSNPRINTF in string.h for more info.
//
#if !defined(EASTL_EASTDC_VSNPRINTF)
#define EASTL_EASTDC_VSNPRINTF 1
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_NAME_ENABLED / EASTL_NAME / EASTL_NAME_VAL
//
// Used to wrap debug string names. In a release build, the definition
// goes away. These are present to avoid release build compiler warnings
// and to make code simpler.
//
// Example usage of EASTL_NAME:
// // pName will defined away in a release build and thus prevent compiler warnings.
// void allocator::set_name(const char* EASTL_NAME(pName))
// {
// #if EASTL_NAME_ENABLED
// mpName = pName;
// #endif
// }
//
// Example usage of EASTL_NAME_VAL:
// // "xxx" is defined to NULL in a release build.
// vector<T, Allocator>::vector(const allocator_type& allocator = allocator_type(EASTL_NAME_VAL("xxx")));
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_NAME_ENABLED
#define EASTL_NAME_ENABLED EASTL_DEBUG
#endif
#ifndef EASTL_NAME
#if EASTL_NAME_ENABLED
#define EASTL_NAME(x) x
#define EASTL_NAME_VAL(x) x
#else
#define EASTL_NAME(x)
#define EASTL_NAME_VAL(x) ((const char*)NULL)
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_DEFAULT_NAME_PREFIX
//
// Defined as a string literal. Defaults to "EASTL".
// This define is used as the default name for EASTL where such a thing is
// referenced in EASTL. For example, if the user doesn't specify an allocator
// name for their deque, it is named "EASTL deque". However, you can override
// this to say "SuperBaseball deque" by changing EASTL_DEFAULT_NAME_PREFIX.
//
// Example usage (which is simply taken from how deque.h uses this define):
// #ifndef EASTL_DEQUE_DEFAULT_NAME
// #define EASTL_DEQUE_DEFAULT_NAME EASTL_DEFAULT_NAME_PREFIX " deque"
// #endif
//
#ifndef EASTL_DEFAULT_NAME_PREFIX
#define EASTL_DEFAULT_NAME_PREFIX "EASTL"
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_ASSERT_ENABLED
//
// Defined as 0 or non-zero. Default is same as EASTL_DEBUG.
// If EASTL_ASSERT_ENABLED is non-zero, then asserts will be executed via
// the assertion mechanism.
//
// Example usage:
// #if EASTL_ASSERT_ENABLED
// EASTL_ASSERT(v.size() > 17);
// #endif
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ASSERT_ENABLED
#define EASTL_ASSERT_ENABLED EASTL_DEBUG
#endif
// Developer assert. Helps EASTL developers assert EASTL is coded correctly.
// Normally disabled for users since it validates internal things and not user things.
#ifndef EASTL_DEV_ASSERT_ENABLED
#define EASTL_DEV_ASSERT_ENABLED EASTL_DEV_DEBUG
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_EMPTY_REFERENCE_ASSERT_ENABLED
//
// Defined as 0 or non-zero. Default is same as EASTL_ASSERT_ENABLED.
// This is like EASTL_ASSERT_ENABLED, except it is for empty container
// references. Sometime people like to be able to take a reference to
// the front of the container, but not use it if the container is empty.
// In practice it's often easier and more efficient to do this than to write
// extra code to check if the container is empty.
//
// NOTE: If this is enabled, EASTL_ASSERT_ENABLED must also be enabled
//
// Example usage:
// template <typename T, typename Allocator>
// inline typename vector<T, Allocator>::reference
// vector<T, Allocator>::front()
// {
// #if EASTL_ASSERT_ENABLED
// EASTL_ASSERT(mpEnd > mpBegin);
// #endif
//
// return *mpBegin;
// }
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_EMPTY_REFERENCE_ASSERT_ENABLED
#define EASTL_EMPTY_REFERENCE_ASSERT_ENABLED EASTL_ASSERT_ENABLED
#endif
///////////////////////////////////////////////////////////////////////////////
// SetAssertionFailureFunction
//
// Allows the user to set a custom assertion failure mechanism.
//
// Example usage:
// void Assert(const char* pExpression, void* pContext);
// SetAssertionFailureFunction(Assert, this);
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ASSERTION_FAILURE_DEFINED
#define EASTL_ASSERTION_FAILURE_DEFINED
namespace eastl
{
typedef void (*EASTL_AssertionFailureFunction)(const char* pExpression, void* pContext);
EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pFunction, void* pContext);
// These are the internal default functions that implement asserts.
EASTL_API void AssertionFailure(const char* pExpression);
EASTL_API void AssertionFailureFunctionDefault(const char* pExpression, void* pContext);
}
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_ASSERT
//
// Assertion macro. Can be overridden by user with a different value.
//
// Example usage:
// EASTL_ASSERT(intVector.size() < 100);
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ASSERT
#if EASTL_ASSERT_ENABLED
#define EASTL_ASSERT(expression) \
EA_DISABLE_VC_WARNING(4127) \
do { \
EA_ANALYSIS_ASSUME(expression); \
(void)((expression) || (eastl::AssertionFailure(#expression), 0)); \
} while (0) \
EA_RESTORE_VC_WARNING()
#else
#define EASTL_ASSERT(expression)
#endif
#endif
// Developer assert. Helps EASTL developers assert EASTL is coded correctly.
// Normally disabled for users since it validates internal things and not user things.
#ifndef EASTL_DEV_ASSERT
#if EASTL_DEV_ASSERT_ENABLED
#define EASTL_DEV_ASSERT(expression) \
EA_DISABLE_VC_WARNING(4127) \
do { \
EA_ANALYSIS_ASSUME(expression); \
(void)((expression) || (eastl::AssertionFailure(#expression), 0)); \
} while(0) \
EA_RESTORE_VC_WARNING()
#else
#define EASTL_DEV_ASSERT(expression)
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_ASSERT_MSG
//
// Example usage:
// EASTL_ASSERT_MSG(false, "detected error condition!");
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ASSERT_MSG
#if EASTL_ASSERT_ENABLED
#define EASTL_ASSERT_MSG(expression, message) \
EA_DISABLE_VC_WARNING(4127) \
do { \
EA_ANALYSIS_ASSUME(expression); \
(void)((expression) || (eastl::AssertionFailure(message), 0)); \
} while (0) \
EA_RESTORE_VC_WARNING()
#else
#define EASTL_ASSERT_MSG(expression, message)
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_FAIL_MSG
//
// Failure macro. Can be overridden by user with a different value.
//
// Example usage:
// EASTL_FAIL("detected error condition!");
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_FAIL_MSG
#if EASTL_ASSERT_ENABLED
#define EASTL_FAIL_MSG(message) (eastl::AssertionFailure(message))
#else
#define EASTL_FAIL_MSG(message)
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_CT_ASSERT / EASTL_CT_ASSERT_NAMED
//
// EASTL_CT_ASSERT is a macro for compile time assertion checks, useful for
// validating *constant* expressions. The advantage over using EASTL_ASSERT
// is that errors are caught at compile time instead of runtime.
//
// Example usage:
// EASTL_CT_ASSERT(sizeof(uint32_t) == 4);
//
///////////////////////////////////////////////////////////////////////////////
#define EASTL_CT_ASSERT(expression) static_assert(expression, #expression)
///////////////////////////////////////////////////////////////////////////////
// EASTL_CT_ASSERT_MSG
//
// EASTL_CT_ASSERT_MSG is a macro for compile time assertion checks, useful for
// validating *constant* expressions. The advantage over using EASTL_ASSERT
// is that errors are caught at compile time instead of runtime.
// The message must be a string literal.
//
// Example usage:
// EASTL_CT_ASSERT_MSG(sizeof(uint32_t) == 4, "The size of uint32_t must be 4.");
//
///////////////////////////////////////////////////////////////////////////////
#define EASTL_CT_ASSERT_MSG(expression, message) static_assert(expression, message)
///////////////////////////////////////////////////////////////////////////////
// EASTL_DEBUG_BREAK / EASTL_DEBUG_BREAK_OVERRIDE
//
// This function causes an app to immediately stop under the debugger.
// It is implemented as a macro in order to allow stopping at the site
// of the call.
//
// EASTL_DEBUG_BREAK_OVERRIDE allows one to define EASTL_DEBUG_BREAK directly.
// This is useful in cases where you desire to disable EASTL_DEBUG_BREAK
// but do not wish to (or cannot) define a custom void function() to replace
// EASTL_DEBUG_BREAK callsites.
//
// Example usage:
// EASTL_DEBUG_BREAK();
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_DEBUG_BREAK_OVERRIDE
#ifndef EASTL_DEBUG_BREAK
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
#define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
#elif (defined(EA_PROCESSOR_ARM) && !defined(EA_PROCESSOR_ARM64)) && defined(__APPLE__)
#define EASTL_DEBUG_BREAK() asm("trap")
#elif defined(EA_PROCESSOR_ARM64) && defined(__APPLE__)
#include <signal.h>
#include <unistd.h>
#define EASTL_DEBUG_BREAK() kill( getpid(), SIGINT )
#elif defined(EA_PROCESSOR_ARM64) && defined(__GNUC__)
#define EASTL_DEBUG_BREAK() asm("brk 10")
#elif defined(EA_PROCESSOR_ARM) && defined(__GNUC__)
#define EASTL_DEBUG_BREAK() asm("BKPT 10") // The 10 is arbitrary. It's just a unique id.
#elif defined(EA_PROCESSOR_ARM) && defined(__ARMCC_VERSION)
#define EASTL_DEBUG_BREAK() __breakpoint(10)
#elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
#define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
#define EASTL_DEBUG_BREAK() { __asm int 3 }
#elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
#define EASTL_DEBUG_BREAK() asm("int3")
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#endif
#else
void EASTL_DEBUG_BREAK(); // User must define this externally.
#endif
#else
#ifndef EASTL_DEBUG_BREAK
#if EASTL_DEBUG_BREAK_OVERRIDE == 1
// define an empty callable to satisfy the call site.
#define EASTL_DEBUG_BREAK ([]{})
#else
#define EASTL_DEBUG_BREAK EASTL_DEBUG_BREAK_OVERRIDE
#endif
#else
#error EASTL_DEBUG_BREAK is already defined yet you would like to override it. Please ensure no other headers are already defining EASTL_DEBUG_BREAK before this header (config.h) is included
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_ALLOCATOR_COPY_ENABLED
//
// Defined as 0 or 1. Default is 0 (disabled) until some future date.
// If enabled (1) then container operator= copies the allocator from the
// source container. It ideally should be set to enabled but for backwards
// compatibility with older versions of EASTL it is currently set to 0.
// Regardless of whether this value is 0 or 1, this container copy constructs
// or copy assigns allocators.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_ALLOCATOR_COPY_ENABLED
#define EASTL_ALLOCATOR_COPY_ENABLED 0
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_FIXED_SIZE_TRACKING_ENABLED
//
// Defined as an integer >= 0. Default is same as EASTL_DEBUG.
// If EASTL_FIXED_SIZE_TRACKING_ENABLED is enabled, then fixed
// containers in debug builds track the max count of objects
// that have been in the container. This allows for the tuning
// of fixed container sizes to their minimum required size.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_FIXED_SIZE_TRACKING_ENABLED
#define EASTL_FIXED_SIZE_TRACKING_ENABLED EASTL_DEBUG
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_RTTI_ENABLED
//
// Defined as 0 or 1. Default is 1 if RTTI is supported by the compiler.
// This define exists so that we can use some dynamic_cast operations in the
// code without warning. dynamic_cast is only used if the specifically refers
// to it; EASTL won't do dynamic_cast behind your back.
//
// Example usage:
// #if EASTL_RTTI_ENABLED
// pChildClass = dynamic_cast<ChildClass*>(pParentClass);
// #endif
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_RTTI_ENABLED
// The VC++ default Standard Library (Dinkumware) disables major parts of RTTI
// (e.g. type_info) if exceptions are disabled, even if RTTI itself is enabled.
// _HAS_EXCEPTIONS is defined by Dinkumware to 0 or 1 (disabled or enabled).
#if defined(EA_COMPILER_NO_RTTI) || (defined(_MSC_VER) && defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && !(defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS))
#define EASTL_RTTI_ENABLED 0
#else
#define EASTL_RTTI_ENABLED 1
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_EXCEPTIONS_ENABLED
//
// Defined as 0 or 1. Default is to follow what the compiler settings are.
// The user can predefine EASTL_EXCEPTIONS_ENABLED to 0 or 1; however, if the
// compiler is set to disable exceptions then EASTL_EXCEPTIONS_ENABLED is
// forced to a value of 0 regardless of the user predefine.
//
// Note that we do not enable EASTL exceptions by default if the compiler
// has exceptions enabled. To enable EASTL_EXCEPTIONS_ENABLED you need to
// manually set it to 1.
//
///////////////////////////////////////////////////////////////////////////////
#if !defined(EASTL_EXCEPTIONS_ENABLED) || ((EASTL_EXCEPTIONS_ENABLED == 1) && defined(EA_COMPILER_NO_EXCEPTIONS))
#define EASTL_EXCEPTIONS_ENABLED 0
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_STRING_OPT_XXXX
//
// Enables some options / optimizations options that cause the string class
// to behave slightly different from the C++ standard basic_string. These are
// options whereby you can improve performance by avoiding operations that
// in practice may never occur for you.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_STRING_OPT_EXPLICIT_CTORS
// Defined as 0 or 1. Default is 0.
// Defines if we should implement explicity in constructors where the C++
// standard string does not. The advantage of enabling explicit constructors
// is that you can do this: string s = "hello"; in addition to string s("hello");
// The disadvantage of enabling explicity constructors is that there can be
// silent conversions done which impede performance if the user isn't paying
// attention.
// C++ standard string ctors are not explicit.
#define EASTL_STRING_OPT_EXPLICIT_CTORS 0
#endif
#ifndef EASTL_STRING_OPT_LENGTH_ERRORS
// Defined as 0 or 1. Default is equal to EASTL_EXCEPTIONS_ENABLED.
// Defines if we check for string values going beyond kMaxSize
// (a very large value) and throw exections if so.
// C++ standard strings are expected to do such checks.
#define EASTL_STRING_OPT_LENGTH_ERRORS EASTL_EXCEPTIONS_ENABLED
#endif
#ifndef EASTL_STRING_OPT_RANGE_ERRORS
// Defined as 0 or 1. Default is equal to EASTL_EXCEPTIONS_ENABLED.
// Defines if we check for out-of-bounds references to string
// positions and throw exceptions if so. Well-behaved code shouldn't
// refence out-of-bounds positions and so shouldn't need these checks.
// C++ standard strings are expected to do such range checks.
#define EASTL_STRING_OPT_RANGE_ERRORS EASTL_EXCEPTIONS_ENABLED
#endif
#ifndef EASTL_STRING_OPT_ARGUMENT_ERRORS
// Defined as 0 or 1. Default is 0.
// Defines if we check for NULL ptr arguments passed to string
// functions by the user and throw exceptions if so. Well-behaved code
// shouldn't pass bad arguments and so shouldn't need these checks.
// Also, some users believe that strings should check for NULL pointers
// in all their arguments and do no-ops if so. This is very debatable.
// C++ standard strings are not required to check for such argument errors.
#define EASTL_STRING_OPT_ARGUMENT_ERRORS 0
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_BITSET_SIZE_T
//
// Defined as 0 or 1. Default is 1.
// Controls whether bitset uses size_t or eastl_size_t.
//
#ifndef EASTL_BITSET_SIZE_T
#define EASTL_BITSET_SIZE_T 1
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_INT128_SUPPORTED
//
// Defined as 0 or 1.
//
#ifndef EASTL_INT128_SUPPORTED
#if defined(__SIZEOF_INT128__) || (defined(EA_COMPILER_INTMAX_SIZE) && (EA_COMPILER_INTMAX_SIZE >= 16))
#define EASTL_INT128_SUPPORTED 1
#else
#define EASTL_INT128_SUPPORTED 0
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_DEFAULT_ALLOCATOR_ALIGNED_ALLOCATIONS_SUPPORTED
//
// Defined as 0 or 1.
// Tells if you can use the default EASTL allocator to do aligned allocations,
// which for most uses tells if you can store aligned objects in containers
// that use default allocators. It turns out that when built as a DLL for
// some platforms, EASTL doesn't have a way to do aligned allocations, as it
// doesn't have a heap that supports it. There is a way to work around this
// with dynamically defined allocators, but that's currently a to-do.
//
#ifndef EASTL_DEFAULT_ALLOCATOR_ALIGNED_ALLOCATIONS_SUPPORTED
#if EASTL_DLL
#define EASTL_DEFAULT_ALLOCATOR_ALIGNED_ALLOCATIONS_SUPPORTED 0
#else
#define EASTL_DEFAULT_ALLOCATOR_ALIGNED_ALLOCATIONS_SUPPORTED 1
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_INT128_DEFINED
//
// Defined as 0 or 1.
// Specifies whether eastl_int128_t/eastl_uint128_t have been typedef'd yet.
//
#ifndef EASTL_INT128_DEFINED
#if EASTL_INT128_SUPPORTED
#define EASTL_INT128_DEFINED 1
#if defined(__SIZEOF_INT128__) || defined(EA_COMPILER_GNUC) || defined(__clang__)
typedef __int128_t eastl_int128_t;
typedef __uint128_t eastl_uint128_t;
#else
typedef int128_t eastl_int128_t; // The EAStdC package defines an EA::StdC::int128_t and uint128_t type,
typedef uint128_t eastl_uint128_t; // though they are currently within the EA::StdC namespace.
#endif
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_BITSET_WORD_TYPE_DEFAULT / EASTL_BITSET_WORD_SIZE_DEFAULT
//
// Defined as an integral power of two type, usually uint32_t or uint64_t.
// Specifies the word type that bitset should use internally to implement
// storage. By default this is the platform register word size, but there
// may be reasons to use a different value.
//
// Defines the integral data type used by bitset by default.
// You can override this default on a bitset-by-bitset case by supplying a
// custom bitset WordType template parameter.
//
// The C++ standard specifies that the std::bitset word type be unsigned long,
// but that isn't necessarily the most efficient data type for the given platform.
// We can follow the standard and be potentially less efficient or we can do what
// is more efficient but less like the C++ std::bitset.
//
#if !defined(EASTL_BITSET_WORD_TYPE_DEFAULT)
#if defined(EASTL_BITSET_WORD_SIZE) // EASTL_BITSET_WORD_SIZE is deprecated, but we temporarily support the ability for the user to specify it. Use EASTL_BITSET_WORD_TYPE_DEFAULT instead.
#if (EASTL_BITSET_WORD_SIZE == 4)
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint32_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 4
#else
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint64_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 8
#endif
#elif (EA_PLATFORM_WORD_SIZE == 16) // EA_PLATFORM_WORD_SIZE is defined in EABase.
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint128_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 16
#elif (EA_PLATFORM_WORD_SIZE == 8)
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint64_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 8
#elif (EA_PLATFORM_WORD_SIZE == 4)
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint32_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 4
#else
#define EASTL_BITSET_WORD_TYPE_DEFAULT uint16_t
#define EASTL_BITSET_WORD_SIZE_DEFAULT 2
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_LIST_SIZE_CACHE
//
// Defined as 0 or 1. Default is 1. Changed from 0 in version 1.16.01.
// If defined as 1, the list and slist containers (and possibly any additional
// containers as well) keep a member mSize (or similar) variable which allows
// the size() member function to execute in constant time (a.k.a. O(1)).
// There are debates on both sides as to whether it is better to have this
// cached value or not, as having it entails some cost (memory and code).
// To consider: Make list size caching an optional template parameter.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_LIST_SIZE_CACHE
#define EASTL_LIST_SIZE_CACHE 1
#endif
#ifndef EASTL_SLIST_SIZE_CACHE
#define EASTL_SLIST_SIZE_CACHE 1
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_MAX_STACK_USAGE
//
// Defined as an integer greater than zero. Default is 4000.
// There are some places in EASTL where temporary objects are put on the
// stack. A common example of this is in the implementation of container
// swap functions whereby a temporary copy of the container is made.
// There is a problem, however, if the size of the item created on the stack
// is very large. This can happen with fixed-size containers, for example.
// The EASTL_MAX_STACK_USAGE define specifies the maximum amount of memory
// (in bytes) that the given platform/compiler will safely allow on the stack.
// Platforms such as Windows will generally allow larger values than embedded
// systems or console machines, but it is usually a good idea to stick with
// a max usage value that is portable across all platforms, lest the user be
// surprised when something breaks as it is ported to another platform.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_MAX_STACK_USAGE
#define EASTL_MAX_STACK_USAGE 4000
#endif
///////////////////////////////////////////////////////////////////////////////
// EASTL_VA_COPY_ENABLED
//
// Defined as 0 or 1. Default is 1 for compilers that need it, 0 for others.
// Some compilers on some platforms implement va_list whereby its contents
// are destroyed upon usage, even if passed by value to another function.
// With these compilers you can use va_copy to save and restore a va_list.
// Known compiler/platforms that destroy va_list contents upon usage include:
// CodeWarrior on PowerPC
// GCC on x86-64
// However, va_copy is part of the C99 standard and not part of earlier C and
// C++ standards. So not all compilers support it. VC++ doesn't support va_copy,
// but it turns out that VC++ doesn't usually need it on the platforms it supports,
// and va_copy can usually be implemented via memcpy(va_list, va_list) with VC++.
//
// Example usage:
// void Function(va_list arguments)
// {
// #if EASTL_VA_COPY_ENABLED
// va_list argumentsCopy;
// va_copy(argumentsCopy, arguments);
// #endif
// <use arguments or argumentsCopy>
// #if EASTL_VA_COPY_ENABLED
// va_end(argumentsCopy);
// #endif
// }
///////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_VA_COPY_ENABLED
#if ((defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__)) && (!defined(__i386__) || defined(__x86_64__)) && !defined(__ppc__) && !defined(__PPC__) && !defined(__PPC64__)