35 #ifndef EASTL_INTERNAL_CONFIG_H
36 #define EASTL_INTERNAL_CONFIG_H
70 #ifdef EASTL_USER_CONFIG_HEADER
71 #include EASTL_USER_CONFIG_HEADER
89 #ifndef EASTL_EABASE_DISABLED
90 #include <stk_util/util/eabase_eastl.h>
105 #pragma warning(push, 0)
133 #ifndef EASTL_VERSION
134 #define EASTL_VERSION "1.11.03"
135 #define EASTL_VERSION_N 11103
147 #if (EABASE_VERSION_N < 20022) && !defined(EA_PLATFORM_MICROSOFT)
148 #if defined(EA_PLATFORM_WINDOWS) || defined(EA_PLATFORM_XENON)
149 #define EA_PLATFORM_MICROSOFT 1
161 #if (EABASE_VERSION_N < 20022) && !defined(EA_COMPILER_NO_STANDARD_CPP_LIBRARY)
162 #if defined(EA_PLATFORM_ANDROID)
163 #define EA_COMPILER_NO_STANDARD_CPP_LIBRARY 1
175 #if (EABASE_VERSION_N < 20022) && !defined(EA_COMPILER_NO_RTTI)
176 #if defined(__SNC__) && !defined(__RTTI)
177 #define EA_COMPILER_NO_RTTI
178 #elif defined(__GXX_ABI_VERSION) && !defined(__GXX_RTTI)
179 #define EA_COMPILER_NO_RTTI
180 #elif defined(_MSC_VER) && !defined(_CPPRTTI)
181 #define EA_COMPILER_NO_RTTI
182 #elif defined(__MWERKS__)
184 #define EA_COMPILER_NO_RTTI
222 #if defined(EA_DEBUG) || defined(_DEBUG)
223 #define EASTL_DEBUG 1
225 #define EASTL_DEBUG 0
247 #ifndef EASTL_DEBUGPARAMS_LEVEL
249 #define EASTL_DEBUGPARAMS_LEVEL 2
251 #define EASTL_DEBUGPARAMS_LEVEL 0
296 #if defined(EA_DLL) && !defined(EASTL_DLL)
300 #ifndef EASTL_API // If the build file hasn't already defined this to be dllexport...
301 #if EASTL_DLL && defined(_MSC_VER)
302 #define EASTL_API __declspec(dllimport)
303 #define EASTL_TEMPLATE_API // Not sure if there is anything we can do here.
306 #define EASTL_TEMPLATE_API
333 #ifndef EASTL_NAME_ENABLED
334 #define EASTL_NAME_ENABLED EASTL_DEBUG
338 #if EASTL_NAME_ENABLED
339 #define EASTL_NAME(x) x
340 #define EASTL_NAME_VAL(x) x
342 #define EASTL_NAME(x)
343 #define EASTL_NAME_VAL(x) ((const char*)NULL)
363 #ifndef EASTL_DEFAULT_NAME_PREFIX
364 #define EASTL_DEFAULT_NAME_PREFIX "EASTL"
383 #ifndef EASTL_ASSERT_ENABLED
384 #define EASTL_ASSERT_ENABLED EASTL_DEBUG
413 #ifndef EASTL_EMPTY_REFERENCE_ASSERT_ENABLED
414 #define EASTL_EMPTY_REFERENCE_ASSERT_ENABLED EASTL_ASSERT_ENABLED
430 #ifndef EASTL_ASSERTION_FAILURE_DEFINED
431 #define EASTL_ASSERTION_FAILURE_DEFINED
435 typedef void (*EASTL_AssertionFailureFunction)(
const char* pExpression,
void* pContext);
457 #if EASTL_ASSERT_ENABLED
458 #define EASTL_ASSERT(expression) (void)((expression) || (eastl::AssertionFailure(#expression), 0))
460 #define EASTL_ASSERT(expression)
476 #ifndef EASTL_FAIL_MSG
477 #if EASTL_ASSERT_ENABLED
478 #define EASTL_FAIL_MSG(message) (eastl::AssertionFailure(message))
480 #define EASTL_FAIL_MSG(message)
499 #if defined(EASTL_DEBUG) && !defined(EASTL_CT_ASSERT)
500 template <
bool>
struct EASTL_CT_ASSERTION_FAILURE;
501 template <>
struct EASTL_CT_ASSERTION_FAILURE<true>{
enum { value = 1 }; };
502 template <
int x>
struct EASTL_CT_ASSERTION_TEST{};
504 #define EASTL_PREPROCESSOR_JOIN(a, b) EASTL_PREPROCESSOR_JOIN1(a, b)
505 #define EASTL_PREPROCESSOR_JOIN1(a, b) EASTL_PREPROCESSOR_JOIN2(a, b)
506 #define EASTL_PREPROCESSOR_JOIN2(a, b) a##b
508 #if defined(_MSC_VER)
509 #define EASTL_CT_ASSERT(expression) typedef EASTL_CT_ASSERTION_TEST< sizeof(EASTL_CT_ASSERTION_FAILURE< (bool)(expression) >)> EASTL_CT_ASSERT_FAILURE
510 #elif defined(__ICL) || defined(__ICC)
511 #define EASTL_CT_ASSERT(expression) typedef char EASTL_PREPROCESSOR_JOIN(EASTL_CT_ASSERT_FAILURE_, __LINE__) [EASTL_CT_ASSERTION_FAILURE< (bool)(expression) >::value]
512 #elif defined(__MWERKS__)
513 #define EASTL_CT_ASSERT(expression) enum { EASTL_PREPROCESSOR_JOIN(EASTL_CT_ASSERT_FAILURE_, __LINE__) = sizeof(EASTL_CT_ASSERTION_FAILURE< (bool)(expression) >) }
515 #define EASTL_CT_ASSERT(expression) typedef EASTL_CT_ASSERTION_TEST< sizeof(EASTL_CT_ASSERTION_FAILURE< (bool)(expression) >)> EASTL_PREPROCESSOR_JOIN1(EASTL_CT_ASSERT_FAILURE_, __LINE__)
518 #define EASTL_CT_ASSERT(expression)
536 #ifndef EASTL_DEBUG_BREAK
537 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
538 #define EASTL_DEBUG_BREAK() __debugbreak() // This is a compiler intrinsic which will map to appropriate inlined asm for the platform.
539 #elif defined(EA_PROCESSOR_MIPS) //
540 #define EASTL_DEBUG_BREAK() asm("break")
541 #elif defined(__SNC__)
542 #define EASTL_DEBUG_BREAK() *(int*)(0) = 0
543 #elif defined(EA_PLATFORM_PS3)
544 #define EASTL_DEBUG_BREAK() asm volatile("tw 31,1,1")
545 #elif defined(EA_PROCESSOR_POWERPC) // Generic PowerPC.
546 #define EASTL_DEBUG_BREAK() asm(".long 0") // This triggers an exception by executing opcode 0x00000000.
547 #elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && defined(EA_ASM_STYLE_INTEL)
548 #define EASTL_DEBUG_BREAK() { __asm int 3 }
549 #elif (defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)) && (defined(EA_ASM_STYLE_ATT) || defined(__GNUC__))
550 #define EASTL_DEBUG_BREAK() asm("int3")
552 void EASTL_DEBUG_BREAK();
555 void EASTL_DEBUG_BREAK();
570 #ifndef EASTL_ALLOCATOR_COPY_ENABLED
571 #define EASTL_ALLOCATOR_COPY_ENABLED 0
587 #ifndef EASTL_FIXED_SIZE_TRACKING_ENABLED
588 #define EASTL_FIXED_SIZE_TRACKING_ENABLED EASTL_DEBUG
608 #ifndef EASTL_RTTI_ENABLED
609 #if defined(EA_COMPILER_NO_RTTI)
610 #define EASTL_RTTI_ENABLED 0
612 #define EASTL_RTTI_ENABLED 1
629 #if !defined(EASTL_EXCEPTIONS_ENABLED) || ((EASTL_EXCEPTIONS_ENABLED == 1) && defined(EA_COMPILER_NO_EXCEPTIONS))
630 #define EASTL_EXCEPTIONS_ENABLED 0
647 #ifndef EASTL_STRING_OPT_CHAR_INIT
652 #define EASTL_STRING_OPT_CHAR_INIT 1
655 #ifndef EASTL_STRING_OPT_EXPLICIT_CTORS
664 #define EASTL_STRING_OPT_EXPLICIT_CTORS 0
667 #ifndef EASTL_STRING_OPT_LENGTH_ERRORS
672 #define EASTL_STRING_OPT_LENGTH_ERRORS EASTL_EXCEPTIONS_ENABLED
675 #ifndef EASTL_STRING_OPT_RANGE_ERRORS
681 #define EASTL_STRING_OPT_RANGE_ERRORS EASTL_EXCEPTIONS_ENABLED
684 #ifndef EASTL_STRING_OPT_ARGUMENT_ERRORS
692 #define EASTL_STRING_OPT_ARGUMENT_ERRORS 0
704 #ifndef EASTL_ABSTRACT_STRING_ENABLED
705 #define EASTL_ABSTRACT_STRING_ENABLED 0
717 #ifndef EASTL_BITSET_SIZE_T
718 #define EASTL_BITSET_SIZE_T 1
737 #ifndef EASTL_LIST_SIZE_CACHE
738 #define EASTL_LIST_SIZE_CACHE 0
741 #ifndef EASTL_SLIST_SIZE_CACHE
742 #define EASTL_SLIST_SIZE_CACHE 0
765 #ifndef EASTL_MAX_STACK_USAGE
766 #define EASTL_MAX_STACK_USAGE 4000
788 #ifndef EASTL_VA_COPY_ENABLED
789 #if defined(__MWERKS__) || (defined(__GNUC__) && (__GNUC__ >= 3) && (!defined(__i386__) || defined(__x86_64__)) && !defined(__ppc__) && !defined(__PPC__) && !defined(__PPC64__))
790 #define EASTL_VA_COPY_ENABLED 1
792 #define EASTL_VA_COPY_ENABLED 0
801 #if !defined(EASTL_LIST_PROXY_ENABLED)
805 #if defined(EASTL_DEBUG) && (!defined(__GNUC__) || defined(__SNC__)) && (!defined(_MSC_VER) || (_MSC_VER < 1400))
806 #define EASTL_LIST_PROXY_ENABLED 1
807 #define EASTL_LIST_PROXY_MAY_ALIAS EASTL_MAY_ALIAS
809 #define EASTL_LIST_PROXY_ENABLED 0
810 #define EASTL_LIST_PROXY_MAY_ALIAS
827 #ifndef EASTL_STD_ITERATOR_CATEGORY_ENABLED
828 #define EASTL_STD_ITERATOR_CATEGORY_ENABLED 1
831 #if EASTL_STD_ITERATOR_CATEGORY_ENABLED
832 #define EASTL_ITC_NS std
834 #define EASTL_ITC_NS eastl
854 #ifndef EASTL_VALIDATION_ENABLED
855 #define EASTL_VALIDATION_ENABLED EASTL_DEBUG
869 #ifndef EASTL_VALIDATE_COMPARE_ENABLED
870 #define EASTL_VALIDATE_COMPARE_ENABLED EASTL_VALIDATION_ENABLED
873 #if EASTL_VALIDATE_COMPARE_ENABLED
874 #define EASTL_VALIDATE_COMPARE EASTL_ASSERT
876 #define EASTL_VALIDATE_COMPARE(expression)
891 #ifndef EASTL_VALIDATE_INTRUSIVE_LIST
892 #define EASTL_VALIDATE_INTRUSIVE_LIST 0
912 #ifndef EASTL_FORCE_INLINE
913 #define EASTL_FORCE_INLINE EA_FORCE_INLINE
933 #if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
934 #define EASTL_MAY_ALIAS __attribute__((__may_alias__))
936 #define EASTL_MAY_ALIAS
964 #if defined(__GNUC__) && (__GNUC__ >= 3)
965 #define EASTL_LIKELY(x) __builtin_expect(!!(x), true)
966 #define EASTL_UNLIKELY(x) __builtin_expect(!!(x), false)
968 #define EASTL_LIKELY(x) (x)
969 #define EASTL_UNLIKELY(x) (x)
987 #ifndef EASTL_MINMAX_ENABLED
988 #define EASTL_MINMAX_ENABLED 1
1008 #ifndef EASTL_NOMINMAX
1009 #define EASTL_NOMINMAX 1
1025 #ifndef EASTL_ALIGN_OF
1026 #if defined(__MWERKS__)
1027 #define EASTL_ALIGN_OF(type) ((size_t)__alignof__(type))
1028 #elif !defined(__GNUC__) || (__GNUC__ >= 3) // GCC 2.x doesn't do __alignof correctly all the time.
1029 #define EASTL_ALIGN_OF __alignof
1031 #define EASTL_ALIGN_OF(type) ((size_t)offsetof(struct{ char c; type m; }, m))
1050 #ifndef EASTL_SIZE_T
1051 #if(EA_PLATFORM_WORD_SIZE == 4) // If (sizeof(size_t) == 4) and we can thus use size_t as-is...
1053 #define EASTL_SIZE_T size_t
1054 #define EASTL_SSIZE_T intptr_t
1056 #define EASTL_SIZE_T uint32_t
1057 #define EASTL_SSIZE_T int32_t
1061 typedef EASTL_SIZE_T eastl_size_t;
1062 typedef EASTL_SSIZE_T eastl_ssize_t;
1084 #define EASTLAddRef AddRef
1087 #ifndef EASTLRelease
1088 #define EASTLRelease Release
1111 #ifndef EASTL_ALLOCATOR_EXPLICIT_ENABLED
1112 #define EASTL_ALLOCATOR_EXPLICIT_ENABLED 0
1115 #if EASTL_ALLOCATOR_EXPLICIT_ENABLED
1116 #define EASTL_ALLOCATOR_EXPLICIT explicit
1118 #define EASTL_ALLOCATOR_EXPLICIT
1162 #ifndef EASTLAlloc // To consider: Instead of calling through pAllocator, just go directly to operator new, since that's what allocator does.
1163 #define EASTLAlloc(allocator, n) (allocator).allocate(n);
1166 #ifndef EASTLAllocFlags // To consider: Instead of calling through pAllocator, just go directly to operator new, since that's what allocator does.
1167 #define EASTLAllocFlags(allocator, n, flags) (allocator).allocate(n, flags);
1170 #ifndef EASTLAllocAligned
1171 #define EASTLAllocAligned(allocator, n, alignment, offset) (allocator).allocate((n), (alignment), (offset))
1175 #define EASTLFree(allocator, p, size) (allocator).deallocate((p), (size))
1178 #ifndef EASTLAllocatorType
1179 #define EASTLAllocatorType eastl::allocator
1182 #ifndef EASTLAllocatorDefault
1188 #define EASTLAllocatorDefault eastl::GetDefaultAllocator
1191 #endif // Header include guard
EASTL_API void AssertionFailure(const char *pExpression)
EASTL_API void AssertionFailureFunctionDefault(const char *pExpression, void *)
EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pAssertionFailureFunction, void *pContext)