mirror of
https://github.com/electronicarts/EABase.git
synced 2026-01-18 17:11:23 +01:00
2.09.12
This commit is contained in:
47
.gitignore
vendored
47
.gitignore
vendored
@@ -1,2 +1,49 @@
|
||||
tags
|
||||
cscope.out
|
||||
**/*.swp
|
||||
**/*.swo
|
||||
.swp
|
||||
*.swp
|
||||
.swo
|
||||
.TMP
|
||||
-.d
|
||||
eastl_build_out
|
||||
build_bench
|
||||
bench.bat
|
||||
build.bat
|
||||
.p4config
|
||||
|
||||
## CMake generated files
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
|
||||
## Patch files
|
||||
*.patch
|
||||
|
||||
## For Visual Studio Generated projects
|
||||
*.sln
|
||||
**/*.vcxproj
|
||||
**/*.vcxproj.filters
|
||||
*.VC.opendb
|
||||
*.sdf
|
||||
**/*.suo
|
||||
**/*.user
|
||||
.vs/*
|
||||
**/Debug/*
|
||||
CMakeFiles/*
|
||||
EASTL.dir/**
|
||||
RelWithDebInfo/*
|
||||
Release/*
|
||||
Win32/*
|
||||
x64/*
|
||||
MinSizeRel/*
|
||||
build*/*
|
||||
Testing/*
|
||||
%ALLUSERSPROFILE%/*
|
||||
|
||||
# Buck
|
||||
/buck-out/
|
||||
/.buckd/
|
||||
/buckaroo/
|
||||
.buckconfig.local
|
||||
BUCKAROO_DEPS
|
||||
|
||||
@@ -599,7 +599,7 @@
|
||||
#elif (defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_INTEL) || defined(EA_COMPILER_RVCT)) && !defined(__EXCEPTIONS) // GCC and most EDG-based compilers define __EXCEPTIONS when exception handling is enabled.
|
||||
#define EA_COMPILER_NO_EXCEPTIONS 1
|
||||
|
||||
#elif (defined(EA_COMPILER_BORLAND) || defined(EA_COMPILER_MSVC)) && !defined(_CPPUNWIND)
|
||||
#elif (defined(EA_COMPILER_MSVC)) && !defined(_CPPUNWIND)
|
||||
#define EA_COMPILER_NO_UNWIND 1
|
||||
|
||||
#endif // EA_COMPILER_NO_EXCEPTIONS / EA_COMPILER_NO_UNWIND
|
||||
|
||||
@@ -335,7 +335,7 @@
|
||||
// typedef EA_ALIGNED(int, int16, 16); int16 n16; typedef int int16; int16 n16; Define int16 as an int which is aligned on 16.
|
||||
// typedef EA_ALIGNED(X, X16, 16); X16 x16; typedef X X16; X16 x16; Define X16 as an X which is aligned on 16.
|
||||
|
||||
#if !defined(EA_ALIGN_MAX) // If the user hasn't globally set an alternative value...
|
||||
#if !defined(EA_ALIGN_MAX) // If the user hasn't globally set an alternative value...
|
||||
#if defined(EA_PROCESSOR_ARM) // ARM compilers in general tend to limit automatic variables to 8 or less.
|
||||
#define EA_ALIGN_MAX_STATIC 1048576
|
||||
#define EA_ALIGN_MAX_AUTOMATIC 1 // Typically they support only built-in natural aligment types (both arm-eabi and apple-abi).
|
||||
@@ -474,6 +474,56 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_HAS_INCLUDE_AVAILABLE
|
||||
//
|
||||
// Used to guard against the EA_HAS_INCLUDE() macro on compilers that do not
|
||||
// support said feature.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// #if EA_HAS_INCLUDE_AVAILABLE
|
||||
// #if EA_HAS_INCLUDE("myinclude.h")
|
||||
// #include "myinclude.h"
|
||||
// #endif
|
||||
// #endif
|
||||
#if !defined(EA_HAS_INCLUDE_AVAILABLE)
|
||||
#if EA_COMPILER_CPP17_ENABLED || EA_COMPILER_CLANG || EA_COMPILER_GNUC
|
||||
#define EA_HAS_INCLUDE_AVAILABLE 1
|
||||
#else
|
||||
#define EA_HAS_INCLUDE_AVAILABLE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_HAS_INCLUDE
|
||||
//
|
||||
// May be used in #if and #elif expressions to test for the existence
|
||||
// of the header referenced in the operand. If possible it evaluates to a
|
||||
// non-zero value and zero otherwise. The operand is the same form as the file
|
||||
// in a #include directive.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// #if EA_HAS_INCLUDE("myinclude.h")
|
||||
// #include "myinclude.h"
|
||||
// #endif
|
||||
//
|
||||
// #if EA_HAS_INCLUDE(<myinclude.h>)
|
||||
// #include <myinclude.h>
|
||||
// #endif
|
||||
|
||||
#if !defined(EA_HAS_INCLUDE)
|
||||
#if EA_COMPILER_CPP17_ENABLED
|
||||
#define EA_HAS_INCLUDE(x) __has_include(x)
|
||||
#elif EA_COMPILER_CLANG
|
||||
#define EA_HAS_INCLUDE(x) __has_include(x)
|
||||
#elif EA_COMPILER_GNUC
|
||||
#define EA_HAS_INCLUDE(x) __has_include(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_INIT_PRIORITY_AVAILABLE
|
||||
@@ -509,6 +559,39 @@
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_INIT_SEG_AVAILABLE
|
||||
//
|
||||
//
|
||||
#if !defined(EA_INIT_SEG_AVAILABLE)
|
||||
#if defined(_MSC_VER)
|
||||
#define EA_INIT_SEG_AVAILABLE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_INIT_SEG
|
||||
//
|
||||
// Specifies a keyword or code section that affects the order in which startup code is executed.
|
||||
//
|
||||
// https://docs.microsoft.com/en-us/cpp/preprocessor/init-seg?view=vs-2019
|
||||
//
|
||||
// Example:
|
||||
// EA_INIT_SEG(compiler) MyType gMyTypeGlobal;
|
||||
// EA_INIT_SEG("my_section") MyOtherType gMyOtherTypeGlobal;
|
||||
//
|
||||
#if !defined(EA_INIT_SEG)
|
||||
#if defined(EA_INIT_SEG_AVAILABLE)
|
||||
#define EA_INIT_SEG(x) \
|
||||
__pragma(warning(push)) __pragma(warning(disable : 4074)) __pragma(warning(disable : 4075)) __pragma(init_seg(x)) \
|
||||
__pragma(warning(pop))
|
||||
#else
|
||||
#define EA_INIT_SEG(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EA_MAY_ALIAS_AVAILABLE
|
||||
//
|
||||
@@ -1187,7 +1270,7 @@
|
||||
#define EA_WCHAR_T_NON_NATIVE 1
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND) || (defined(EA_COMPILER_CLANG) && defined(EA_PLATFORM_WINDOWS))
|
||||
#elif defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_CLANG) && defined(EA_PLATFORM_WINDOWS))
|
||||
#ifndef _NATIVE_WCHAR_T_DEFINED
|
||||
#define EA_WCHAR_T_NON_NATIVE 1
|
||||
#endif
|
||||
@@ -2379,13 +2462,16 @@
|
||||
#ifdef __cplusplus
|
||||
struct EANonCopyable
|
||||
{
|
||||
#if defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS) || defined(__EDG__) // EDG doesn't appear to behave properly for the case of defaulted constructors; it generates a mistaken warning about missing default constructors.
|
||||
EANonCopyable(){} // Putting {} here has the downside that it allows a class to create itself,
|
||||
~EANonCopyable(){} // but avoids linker errors that can occur with some compilers (e.g. Green Hills).
|
||||
#if defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS) || defined(__EDG__)
|
||||
// EDG doesn't appear to behave properly for the case of defaulted constructors;
|
||||
// it generates a mistaken warning about missing default constructors.
|
||||
EANonCopyable() {} // Putting {} here has the downside that it allows a class to create itself,
|
||||
~EANonCopyable() {} // but avoids linker errors that can occur with some compilers (e.g. Green Hills).
|
||||
#else
|
||||
EANonCopyable() = default;
|
||||
~EANonCopyable() = default;
|
||||
#endif
|
||||
|
||||
EA_NON_COPYABLE(EANonCopyable)
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -388,7 +388,7 @@
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND) // VC++ 7.1+ understands long long as a data type but doesn't accept %ll as a printf specifier.
|
||||
#if defined(EA_COMPILER_MSVC) // VC++ 7.1+ understands long long as a data type but doesn't accept %ll as a printf specifier.
|
||||
#define EA_PRI_64_LENGTH_SPECIFIER "I64"
|
||||
#define EA_SCN_64_LENGTH_SPECIFIER "I64"
|
||||
#else
|
||||
@@ -512,7 +512,7 @@
|
||||
//
|
||||
#ifndef BOOL8_T_DEFINED // If the user hasn't already defined this...
|
||||
#define BOOL8_T_DEFINED
|
||||
#if defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_INTEL) && defined(EA_PLATFORM_WINDOWS)) || defined(EA_COMPILER_BORLAND)
|
||||
#if defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_INTEL) && defined(EA_PLATFORM_WINDOWS))
|
||||
#if defined(__cplusplus)
|
||||
typedef bool bool8_t;
|
||||
#else
|
||||
@@ -596,7 +596,7 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Character types
|
||||
//
|
||||
#if defined(EA_COMPILER_MSVC) || defined(EA_COMPILER_BORLAND)
|
||||
#if defined(EA_COMPILER_MSVC)
|
||||
#if defined(EA_WCHAR_T_NON_NATIVE)
|
||||
// In this case, wchar_t is not defined unless we include
|
||||
// wchar.h or if the compiler makes it built-in.
|
||||
@@ -921,7 +921,7 @@
|
||||
//
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)
|
||||
// static_assert is defined by the compiler for both C and C++.
|
||||
#elif !defined(__cplusplus) && defined(EA_PLATFORM_ANDROID)
|
||||
#elif !defined(__cplusplus) && defined(EA_PLATFORM_ANDROID) && ((defined(__STDC_VERSION__) && __STDC_VERSION__ < 201100L) || !defined(__STDC_VERSION__))
|
||||
// AndroidNDK does not support static_assert despite claiming it's a C11 compiler
|
||||
#define NEED_CUSTOM_STATIC_ASSERT
|
||||
#elif defined(__clang__) && defined(__cplusplus)
|
||||
|
||||
@@ -144,11 +144,11 @@
|
||||
|
||||
// Clang libc++
|
||||
#if !defined(EA_HAVE_LIBCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBCPP_LIBRARY)
|
||||
#if defined(__clang__)
|
||||
#if defined(__cplusplus) && __has_include(<__config>)
|
||||
#if EA_HAS_INCLUDE_AVAILABLE
|
||||
#if EA_HAS_INCLUDE(<__config>)
|
||||
#define EA_HAVE_LIBCPP_LIBRARY 1 // We could also #include <ciso646> and check if defined(_LIBCPP_VERSION).
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(EA_HAVE_LIBCPP_LIBRARY)
|
||||
#define EA_NO_HAVE_LIBCPP_LIBRARY 1
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef EABASE_VERSION
|
||||
#define EABASE_VERSION "2.09.10"
|
||||
#define EABASE_VERSION_N 20910
|
||||
#define EABASE_VERSION "2.09.12"
|
||||
#define EABASE_VERSION_N 20912
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -84,6 +84,25 @@ EA_DISABLE_VC_WARNING(4265 4296 4310 4350 4481 4530 4625 4626 4996)
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Exercise EA_HAS_INCLUDE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if EA_HAS_INCLUDE_AVAILABLE
|
||||
#if EA_HAS_INCLUDE(<EASTL/map.h>)
|
||||
#include <EASTL/map.h>
|
||||
|
||||
eastl::map<int, int> gTestHasIncludeMap;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if EA_HAS_INCLUDE_AVAILABLE
|
||||
#if EA_HAS_INCLUDE(<DefinitelyDoesNotExist.h>)
|
||||
#error "Include Does Not EXIST!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Exercise EAHave
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -327,7 +346,7 @@ EA_CONSTEXPR int GetValue(){ return 37; }
|
||||
|
||||
|
||||
// EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE
|
||||
template struct EASTL_API eabase_template<char>;
|
||||
template struct eabase_template<char>;
|
||||
|
||||
|
||||
// Forward declarations
|
||||
@@ -505,15 +524,14 @@ struct SizeofMemberTestClass // Intentionally a non-pod.
|
||||
|
||||
// EA_INIT_PRIORITY
|
||||
InitPriorityTestClass gInitPriorityTestClass0 EA_INIT_PRIORITY(2000);
|
||||
#ifndef __SNC__ // SNC is broken with respect to constructors.
|
||||
InitPriorityTestClass gInitPriorityTestClass1 EA_INIT_PRIORITY(2000) (1);
|
||||
#endif
|
||||
|
||||
// EA_INIT_SEG
|
||||
EA_INIT_SEG(compiler) InitPriorityTestClass gInitSegTestSection(2300);
|
||||
|
||||
|
||||
// EA_MAY_ALIAS
|
||||
#ifndef __SNC__ // SNC doesn't support this usage.
|
||||
void* EA_MAY_ALIAS gPtr0 = NULL;
|
||||
#endif
|
||||
|
||||
typedef void* EA_MAY_ALIAS pvoid_may_alias;
|
||||
pvoid_may_alias gPtr1 = NULL;
|
||||
@@ -1552,7 +1570,6 @@ int TestEACompiler()
|
||||
|
||||
// As of this writing, eacompiler.h defines at least the following compilers:
|
||||
// EA_COMPILER_GNUC
|
||||
// EA_COMPILER_BORLANDC
|
||||
// EA_COMPILER_INTEL
|
||||
// EA_COMPILER_METROWERKS
|
||||
// EA_COMPILER_MSVC, EA_COMPILER_MSVC6, EA_COMPILER_MSVC7, EA_COMPILER_MSVC7_1
|
||||
@@ -2317,7 +2334,7 @@ int TestEACompilerTraits()
|
||||
EA_ALIGNED(int, k[3], ALIGNMENT_AMOUNT_16) = { 1, 2, 3 };
|
||||
struct EA_ALIGN(8) L { int x; int y; };
|
||||
|
||||
EA_DISABLE_VC_WARNING(4359)
|
||||
EA_DISABLE_VC_WARNING(4359) // ARM64: C4359: 'TestEACompilerTraits::X': Alignment specifier is less than actual alignment (4), and will be ignored.
|
||||
EA_ALIGN(ALIGNMENT_AMOUNT_32) struct X { int x; int y; } m;
|
||||
EA_RESTORE_VC_WARNING()
|
||||
|
||||
@@ -2411,10 +2428,8 @@ int TestEACompilerTraits()
|
||||
ClassWithDefaultCtor cdcA EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64);
|
||||
//ClassWithoutDefaultCtor cwdcA EA_POSTFIX_ALIGN(64);
|
||||
|
||||
#ifndef __SNC__ // SNC is broken with respect to constructors.
|
||||
ClassWithDefaultCtor cdcB EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64)(3);
|
||||
ClassWithoutDefaultCtor cwdcB EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64)(3);
|
||||
#endif
|
||||
ClassWithDefaultCtor cdcB EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64)(3);
|
||||
ClassWithoutDefaultCtor cwdcB EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64)(3);
|
||||
#else
|
||||
DoError(nErrorCount, "EA_POSTFIX_ALIGN test 2");
|
||||
#endif
|
||||
@@ -2491,10 +2506,10 @@ int TestEACompilerTraits()
|
||||
}
|
||||
|
||||
{ // Test EA_FORCE_INLINE_LAMBDA
|
||||
// auto testLambda = []() EA_FORCE_INLINE_LAMBDA
|
||||
// {
|
||||
// };
|
||||
// testLambda();
|
||||
auto testLambda = []() EA_FORCE_INLINE_LAMBDA
|
||||
{
|
||||
};
|
||||
testLambda();
|
||||
}
|
||||
|
||||
|
||||
@@ -2530,10 +2545,17 @@ int TestEACompilerTraits()
|
||||
if(gInitPriorityTestClass0.mX != 0)
|
||||
DoError(nErrorCount, "EA_INIT_PRIORITY test.");
|
||||
|
||||
#ifndef __SNC__ // SNC is broken with respect to constructors.
|
||||
if(gInitPriorityTestClass1.mX != 1)
|
||||
DoError(nErrorCount, "EA_INIT_PRIORITY test.");
|
||||
#endif
|
||||
if(gInitPriorityTestClass1.mX != 1)
|
||||
DoError(nErrorCount, "EA_INIT_PRIORITY test.");
|
||||
}
|
||||
|
||||
|
||||
{ // Test EA_INIT_SEG
|
||||
// We don't test that the init_seg succeeded in modifying the init priority.
|
||||
// We merely test that this compiles on all platforms and assume the compiler's
|
||||
// support of this is not broken.
|
||||
if(gInitSegTestSection.mX != 2300)
|
||||
DoError(nErrorCount, "EA_INIT_SEG test.");
|
||||
}
|
||||
|
||||
|
||||
@@ -2541,10 +2563,8 @@ int TestEACompilerTraits()
|
||||
// We don't test that the init priority succeeded in modifying the init priority.
|
||||
// We merely test that this compiles on all platforms and assume the compiler's
|
||||
// support of this is not broken.
|
||||
#ifndef __SNC__ // SNC doesn't support this usage.
|
||||
if(gPtr0 != NULL)
|
||||
DoError(nErrorCount, "EA_MAY_ALIAS test.");
|
||||
#endif
|
||||
if(gPtr0 != NULL)
|
||||
DoError(nErrorCount, "EA_MAY_ALIAS test.");
|
||||
|
||||
if(gPtr1 != NULL)
|
||||
DoError(nErrorCount, "EA_MAY_ALIAS test.");
|
||||
|
||||
Reference in New Issue
Block a user