aboutsummaryrefslogtreecommitdiff
path: root/EASTL
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-04-08 16:45:12 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-04-08 16:45:12 +0200
commitc727b5ceb06fcdc8dc141f8861baff14836f752f (patch)
treee63efe5f62ca64504103b4f23e8eecc023638b2c /EASTL
parent45ad2e77935a7ad51177ac4448afc7327d6b4aae (diff)
parent3c534012646b0a68566a494d76fde274e29bfb9e (diff)
Merge commit '3c534012646b0a68566a494d76fde274e29bfb9e' as 'EASTL/test/packages/EABase'
Diffstat (limited to 'EASTL')
-rw-r--r--EASTL/test/packages/EABase/.gitignore49
-rw-r--r--EASTL/test/packages/EABase/.gitmodules18
-rw-r--r--EASTL/test/packages/EABase/.p4ignore4
-rw-r--r--EASTL/test/packages/EABase/.travis.yml68
-rw-r--r--EASTL/test/packages/EABase/CMakeLists.txt32
-rw-r--r--EASTL/test/packages/EABase/CONTRIBUTING.md73
-rw-r--r--EASTL/test/packages/EABase/LICENSE27
-rw-r--r--EASTL/test/packages/EABase/README.md26
-rw-r--r--EASTL/test/packages/EABase/doc/EABase.html309
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/config/eacompiler.h1778
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/config/eacompilertraits.h2561
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/config/eaplatform.h738
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/eabase.h1011
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/eahave.h877
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/earesult.h62
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/eastdarg.h99
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/eaunits.h54
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/int128.h1268
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/nullptr.h102
-rw-r--r--EASTL/test/packages/EABase/include/Common/EABase/version.h36
-rw-r--r--EASTL/test/packages/EABase/test/CMakeLists.txt67
m---------EASTL/test/packages/EABase/test/packages/EAAssert0
m---------EASTL/test/packages/EABase/test/packages/EAMain0
m---------EASTL/test/packages/EABase/test/packages/EASTL0
m---------EASTL/test/packages/EABase/test/packages/EAStdC0
m---------EASTL/test/packages/EABase/test/packages/EATest0
m---------EASTL/test/packages/EABase/test/packages/EAThread0
-rw-r--r--EASTL/test/packages/EABase/test/source/CEntryPoint.cpp4
-rw-r--r--EASTL/test/packages/EABase/test/source/TestEABase.cpp3742
-rw-r--r--EASTL/test/packages/EABase/test/source/TestEABase.h40
-rw-r--r--EASTL/test/packages/EABase/test/source/TestEABaseC.c1213
-rw-r--r--EASTL/test/packages/EABase/test/source/TestEABaseSeparate.cpp34
32 files changed, 14292 insertions, 0 deletions
diff --git a/EASTL/test/packages/EABase/.gitignore b/EASTL/test/packages/EABase/.gitignore
new file mode 100644
index 0000000..8d148cd
--- /dev/null
+++ b/EASTL/test/packages/EABase/.gitignore
@@ -0,0 +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
diff --git a/EASTL/test/packages/EABase/.gitmodules b/EASTL/test/packages/EABase/.gitmodules
new file mode 100644
index 0000000..165166f
--- /dev/null
+++ b/EASTL/test/packages/EABase/.gitmodules
@@ -0,0 +1,18 @@
+[submodule "test/packages/EAMain"]
+ path = test/packages/EAMain
+ url = git@github.com:electronicarts/EAMain.git
+[submodule "test/packages/EATest"]
+ path = test/packages/EATest
+ url = git@github.com:electronicarts/EATest.git
+[submodule "test/packages/EAStdC"]
+ path = test/packages/EAStdC
+ url = git@github.com:electronicarts/EAStdC.git
+[submodule "test/packages/EAAssert"]
+ path = test/packages/EAAssert
+ url = git@github.com:electronicarts/EAAssert.git
+[submodule "test/packages/EAThread"]
+ path = test/packages/EAThread
+ url = git@github.com:electronicarts/EAThread.git
+[submodule "test/packages/EASTL"]
+ path = test/packages/EASTL
+ url = git@github.com:electronicarts/EASTL.git
diff --git a/EASTL/test/packages/EABase/.p4ignore b/EASTL/test/packages/EABase/.p4ignore
new file mode 100644
index 0000000..b660f25
--- /dev/null
+++ b/EASTL/test/packages/EABase/.p4ignore
@@ -0,0 +1,4 @@
+tags
+
+.p4config
+/.git/
diff --git a/EASTL/test/packages/EABase/.travis.yml b/EASTL/test/packages/EABase/.travis.yml
new file mode 100644
index 0000000..1e4a16e
--- /dev/null
+++ b/EASTL/test/packages/EABase/.travis.yml
@@ -0,0 +1,68 @@
+language: cpp
+
+os:
+ - linux
+ - osx
+ - windows
+
+compiler:
+ - gcc
+ - clang
+ - msvc
+
+env:
+ - EA_CONFIG=Debug
+ - EA_CONFIG=Release
+
+addons:
+ apt:
+ sources:
+ - ubuntu-toolchain-r-test
+ - george-edison55-precise-backports
+ - llvm-toolchain-trusty-7
+ packages:
+ - cmake
+ - cmake-data
+ - g++-7
+ - clang-7
+
+matrix:
+ exclude:
+ - os: osx
+ compiler: gcc
+ - os: osx
+ compiler: msvc
+ - os: linux
+ compiler: msvc
+ - os: windows
+ compiler: clang
+ - os: windows
+ compiler: gcc
+
+# Handle git submodules yourself
+git:
+ submodules: false
+
+# Use sed to replace the SSH URL with the public URL, then initialize submodules
+before_install:
+ - sed --version >/dev/null 2>&1 && sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules || sed -i "" 's/git@github.com:/https:\/\/github.com\//' .gitmodules
+ - git submodule update --init
+
+install:
+ - if [[ "$CXX" == "g++" ]]; then export CC="gcc-7" ;fi
+ - if [[ "$CXX" == "g++" ]]; then export CXX="g++-7" ;fi
+ - if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CC="clang-7" ;fi
+ - if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CXX="clang++-7" ;fi
+
+# Universal Setup
+before_script:
+ - mkdir build_$EA_CONFIG
+ - cd build_$EA_CONFIG
+ - cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
+ - cmake --build . --config $EA_CONFIG
+
+script:
+ # Run Tests
+ - cd $TRAVIS_BUILD_DIR/build_$EA_CONFIG/test
+ - ctest -C $EA_CONFIG -V || exit 1
+
diff --git a/EASTL/test/packages/EABase/CMakeLists.txt b/EASTL/test/packages/EABase/CMakeLists.txt
new file mode 100644
index 0000000..fba98ea
--- /dev/null
+++ b/EASTL/test/packages/EABase/CMakeLists.txt
@@ -0,0 +1,32 @@
+#-------------------------------------------------------------------------------------------
+# Copyright (C) Electronic Arts Inc. All rights reserved.
+#-------------------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.1)
+project(EABase CXX)
+
+#-------------------------------------------------------------------------------------------
+# Options
+#-------------------------------------------------------------------------------------------
+option(EABASE_BUILD_TESTS "Enable generation of build files for tests" OFF)
+
+#-------------------------------------------------------------------------------------------
+# Package Tests
+#-------------------------------------------------------------------------------------------
+if(EABASE_BUILD_TESTS)
+ add_subdirectory(test)
+endif()
+
+#-------------------------------------------------------------------------------------------
+# Defines
+#-------------------------------------------------------------------------------------------
+add_definitions(-D_CHAR16T)
+
+#-------------------------------------------------------------------------------------------
+# Header only library
+#-------------------------------------------------------------------------------------------
+add_library(EABase INTERFACE)
+
+#-------------------------------------------------------------------------------------------
+# Include dirs
+#-------------------------------------------------------------------------------------------
+target_include_directories(EABase INTERFACE include/Common)
diff --git a/EASTL/test/packages/EABase/CONTRIBUTING.md b/EASTL/test/packages/EABase/CONTRIBUTING.md
new file mode 100644
index 0000000..015e1e7
--- /dev/null
+++ b/EASTL/test/packages/EABase/CONTRIBUTING.md
@@ -0,0 +1,73 @@
+## Contributing
+
+Before you can contribute, EA must have a Contributor License Agreement (CLA) on file that has been signed by each contributor.
+You can sign here: [Go to CLA](https://electronicarts.na1.echosign.com/public/esignWidget?wid=CBFCIBAA3AAABLblqZhByHRvZqmltGtliuExmuV-WNzlaJGPhbSRg2ufuPsM3P0QmILZjLpkGslg24-UJtek*)
+
+### Pull Request Policy
+
+All code contributions are submitted as [Github pull requests](https://help.github.com/articles/using-pull-requests/). All pull requests will be reviewed by a maintainer according to the guidelines found in the next section.
+
+Your pull request should:
+
+* merge cleanly
+* come with tests
+ * tests should be minimal and stable
+ * fail before your fix is applied
+* pass the test suite
+* code formatting is encoded in clang format
+ * limit using clang format on new code
+ * do not deviate from style already established in the files
+
+
+### Running the Unit Tests
+
+EAAssert uses CMake as its build system.
+
+* Create and navigate to "your_build_folder":
+ * mkdir your_build_folder && cd your_build_folder
+* Generate build scripts:
+ * cmake source_folder -DEABASE_BUILD_TESTS:BOOL=ON
+* Build unit tests for "your_config":
+ * cmake --build . --config your_config
+* Run the unit tests for "your_config" from the test folder:
+ * cd test && ctest -C your_config
+
+
+Here is an example batch file.
+```batch
+set build_folder=out
+mkdir %build_folder%
+pushd %build_folder%
+call cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
+call cmake --build . --config Release
+call cmake --build . --config Debug
+call cmake --build . --config RelWithDebInfo
+call cmake --build . --config MinSizeRel
+pushd test
+call ctest -C Release
+call ctest -C Debug
+call ctest -C RelWithDebInfo
+call ctest -C MinSizeRel
+popd
+popd
+```
+
+Here is an example bash file
+```bash
+build_folder=out
+mkdir $build_folder
+pushd $build_folder
+cmake .. -DEABASE_BUILD_TESTS:BOOL=ON
+cmake --build . --config Release
+cmake --build . --config Debug
+cmake --build . --config RelWithDebInfo
+cmake --build . --config MinSizeRel
+pushd test
+ctest -C Release
+ctest -C Debug
+ctest -C RelWithDebInfo
+ctest -C MinSizeRel
+popd
+popd
+```
+
diff --git a/EASTL/test/packages/EABase/LICENSE b/EASTL/test/packages/EABase/LICENSE
new file mode 100644
index 0000000..93ab228
--- /dev/null
+++ b/EASTL/test/packages/EABase/LICENSE
@@ -0,0 +1,27 @@
+/*
+Copyright (C) 2017 Electronic Arts Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of
+ its contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
diff --git a/EASTL/test/packages/EABase/README.md b/EASTL/test/packages/EABase/README.md
new file mode 100644
index 0000000..5efa1de
--- /dev/null
+++ b/EASTL/test/packages/EABase/README.md
@@ -0,0 +1,26 @@
+# EABase
+
+[![Build Status](https://travis-ci.org/electronicarts/EABase.svg?branch=master)](https://travis-ci.org/electronicarts/EABase)
+
+EABase is a small set of header files that define platform-independent data types and macros.
+
+
+## Documentation
+
+Please see [Introduction](doc/EABase.html).
+
+
+## Compiling sources
+
+Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on compiling and testing the source.
+
+
+## Credits
+
+Roberto Parolin is the current EABase owner within EA and is responsible for the open source repository.
+
+
+## License
+
+Modified BSD License (3-Clause BSD license) see the file LICENSE in the project root.
+
diff --git a/EASTL/test/packages/EABase/doc/EABase.html b/EASTL/test/packages/EABase/doc/EABase.html
new file mode 100644
index 0000000..0be38e2
--- /dev/null
+++ b/EASTL/test/packages/EABase/doc/EABase.html
@@ -0,0 +1,309 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>EABase Future Plans</title>
+ <style type="text/css">
+ .SmallBody{
+ font-size: 10pt
+ }
+
+ body
+ {
+ font-family: Palatino Linotype, Book Antiqua, Times New Roman;
+ font-size: 11pt;
+ }
+
+ h1
+ {
+ font-family: Verdana;
+ display: block;
+ background-color: #FFF0B0;
+ border: solid 2px black;
+ font-size: 16pt;
+ font-weight: bold;
+ padding: 6px;
+ }
+
+ h2
+ {
+ font-size: 14pt;
+ font-family: Verdana;
+ border-bottom: 2px solid black;
+ }
+
+ h3
+ {
+ font-family: Verdana;
+ font-size: 13pt;
+ font-weight: bold;
+ }
+
+ .code-example
+ {
+ display: block;
+ background-color: #e0e0f0;
+ margin-left: 3em;
+ margin-right: 3em;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ padding: 8px;
+ border: solid 2px #a0a0d0;
+ font-family: monospace;
+ font-size: 10pt;
+ white-space: pre;
+ }
+
+ .code-example-span
+ {
+ font-family: monospace;
+ font-size: 10pt;
+ white-space: pre;
+ }
+
+ .code-example-comment
+ {
+ background-color: #e0e0f0;
+ padding: 0px 0px;
+ font-family: monospace;
+ font-size: 10pt;
+ white-space: pre;
+ color: #999999;
+ margin: auto auto;
+ }
+
+
+ .faq-question
+ {
+ background-color: #D0E0D0;
+ font-size: 12pt;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ margin-top: 0em;
+ padding-left:8px;
+ padding-right:8px;
+ padding-top:2px;
+ padding-bottom:2px
+ }
+
+ .faq-answer
+ {
+ display: block;
+ margin: 4pt 1em 0.5em 1em;
+ }
+</style>
+</head>
+
+<body>
+<h1>EABase
+</h1>
+<h3>What is EABase?
+</h3>
+<p>EABase is a small set of header files that define platform-independent
+data types and macros. As such it is similar to many projects that have
+a platform.h, system.h, defines.h, etc. file. The difference is that
+EABase is very comprehensive and is the annointed Electronic Arts
+worldwide standard for new projects. </p>
+<p>With respect to the base types and definitions, many of these are
+already present in the most recent C language standard, though the C++
+standard has yet to formally adopt them. EABase bridges the gap and
+defines these values if they aren't already defined. With respect to
+compiler and platform definitions, EABase provides a standard reliable
+means of identifying or specifying compilers, platforms, endian-ness,
+alignment attributes, etc. </p>
+<h3>Usage notes </h3>
+<p>You probably don't want to use float_t and double_t. They are there for C99 compatibility but are rarely what you want to use, since their size is variable.</p>
+<p>Prid8, etc. are somewhat painful and ugly to use and you may find you don't like them. They too are for C99 compatibility.</p>
+<p>intptr_t is not a pointer to an int; it's an int with the same size as a pointer, so you can safely store pointers in it.</p>
+<p>EA::result_type is rarely used and exists for backwards compatibility.</p>
+<h3>What specifically does EABase define?</h3>
+<p>Here we list the things EABase defines, grouped by category. These
+defines are up to date as of the file modification date listed at the
+top of this file.</p>
+<h4>Base Types and Definitions<br>
+
+</h4>
+
+<div style="margin-left: 40px;">bool8_t, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float_t, double_t, (EAStdC package implements int128_t)<br>
+
+intptr_t, uintptr_t, intmax_t, uintmax_t, ssize_t<br>
+
+char8_t, char16_t, char32_t<br>
+
+INT8_C(), UINT8_C(), etc.<br>
+
+INT8_MIN, INT8_MAX, UINT8_MAX, etc.<br>
+
+PRId8, PRId16, PRId32, etc, SCNd8, SCNd16, SCNd32, etc.</div>
+
+<h4>Result Types and Definitions<br>
+
+</h4>
+
+<div style="margin-left: 40px;">EA::result_type<br>
+
+EA::SUCCESS, EA::FAILURE<br>
+
+EA_SUCCEEDED(), EA_FAILED()</div>
+
+<h4>Compiler Definitions<br>
+
+</h4>
+
+<div style="margin-left: 40px;">EA_COMPILER_GNUC<br>
+
+EA_COMPILER_SN<br>
+
+EA_COMPILER_MSVC<br>
+
+EA_COMPILER_METROWERKS<br>
+
+EA_COMPILER_INTEL<br>
+
+EA_COMPILER_BORLANDC<br>
+
+<br>
+
+EA_COMPILER_VERSION = &lt;integer&gt;<br>
+
+EA_COMPILER_NAME = &lt;string&gt;<br>
+
+EA_COMPILER_STRING = &lt;string&gt;<br>
+
+<br>
+
+EA_COMPILER_NO_STATIC_CONSTANTS<br>
+
+EA_COMPILER_NO_TEMPLATE_SPECIALIZATION<br>
+
+EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION<br>
+
+EA_COMPILER_NO_MEMBER_TEMPLATES<br>
+
+EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION<br>
+
+EA_COMPILER_NO_TEMPLATE_TEMPLATES<br>
+
+EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS<br>
+
+EA_COMPILER_NO_VOID_RETURNS<br>
+
+EA_COMPILER_NO_COVARIANT_RETURN_TYPE<br>
+
+EA_COMPILER_NO_DEDUCED_TYPENAME<br>
+
+EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP<br>
+
+EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE<br>
+
+EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS<br>
+
+EA_COMPILER_NO_EXCEPTIONS<br>
+
+EA_COMPILER_NO_UNWIND<br>
+
+<br>
+
+EA_COMPILER_IS_ANSIC<br>
+
+EA_COMPILER_IS_C99<br>
+
+EA_COMPILER_HAS_C99_TYPES<br>
+EA_COMPILER_IS_CPLUSPLUS<br>
+
+EA_COMPILER_MANAGED_CPP</div>
+<h4>Utilities<br>
+</h4>
+<div style="margin-left: 40px;">
+
+ <p>EA_ALIGN_OF()<br>
+ EA_PREFIX_ALIGN()<br>
+
+EA_POSTFIX_ALIGN()<br>
+ EA_ALIGNED()<br>
+
+EA_PACKED()<br>
+ EA_LIKELY()<br>
+ EA_UNLIKELY()<br>
+ EA_ASSUME()<br>
+ EA_PURE<br>
+ EA_WCHAR_T_NON_NATIVE<br>
+
+EA_WCHAR_SIZE<br>
+ EA_RESTRICT<br>
+ EA_DEPRECATED<br>
+EA_PREFIX_DEPRECATED<br>
+EA_POSTFIX_DEPRECATED <br>
+ EA_FORCE_INLINE<br>
+ EA_NO_INLINE<br>
+ EA_PREFIX_NO_INLINE<br>
+ EA_POSTFIX_NO_INLINE <br>
+ EA_PASCAL<br>
+
+EA_PASCAL_FUNC()<br>
+
+EA_SSE = [0 | 1]<br>
+
+EA_IMPORT<br>
+
+EA_EXPORT<br>
+EA_OVERRIDE<br>
+EA_INIT_PRIORITY<br>
+EA_MAY_ALIAS<br>
+</p>
+</div>
+
+<h4>Platform Definitions<br>
+
+</h4>
+
+<div style="margin-left: 40px;"><br>
+
+
+EA_PLATFORM_MAC<br>
+
+EA_PLATFORM_OSX<br>
+EA_PLATFORM_IPHONE<br>
+EA_PLATFORM_ANDROID<br>
+EA_PLATFORM_LINUX<br>
+
+EA_PLATFORM_WINDOWS<br>
+
+EA_PLATFORM_WIN32<br>
+
+EA_PLATFORM_WIN64<br>
+
+EA_PLATFORM_HPUX<br>
+
+EA_PLATFORM_SUN<br>
+
+<br>
+
+EA_PLATFORM_NAME<br>
+
+EA_PLATFORM_DESCRIPTION<br>
+
+EA_PROCESSOR_POWERPC, EA_PROCESSOR_X86, EA_PROCESSOR_ARM, etc.<br>
+
+EA_SYSTEM_LITTLE_ENDIAN, EA_SYSTEM_BIG_ENDIAN<br>
+
+EA_ASM_STYLE_ATT, EA_ASM_STYLE_INTEL, EA_ASM_STYLE_MOTOROLA<br>
+
+EA_PLATFORM_PTR_SIZE<br>
+EA_PLATFORM_WORD_SIZE</div>
+
+
+<br>
+
+<hr style="width: 100%; height: 2px;"><br>
+
+<br>
+
+<br>
+<br>
+<br>
+<br>
+
+
+
+</body>
+</html>
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/config/eacompiler.h b/EASTL/test/packages/EABase/include/Common/EABase/config/eacompiler.h
new file mode 100644
index 0000000..bd656ed
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/config/eacompiler.h
@@ -0,0 +1,1778 @@
+/*-----------------------------------------------------------------------------
+ * config/eacompiler.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *-----------------------------------------------------------------------------
+ * Currently supported defines include:
+ * EA_COMPILER_GNUC
+ * EA_COMPILER_ARM
+ * EA_COMPILER_EDG
+ * EA_COMPILER_SN
+ * EA_COMPILER_MSVC
+ * EA_COMPILER_METROWERKS
+ * EA_COMPILER_INTEL
+ * EA_COMPILER_BORLANDC
+ * EA_COMPILER_IBM
+ * EA_COMPILER_QNX
+ * EA_COMPILER_GREEN_HILLS
+ * EA_COMPILER_CLANG
+ * EA_COMPILER_CLANG_CL
+ *
+ * EA_COMPILER_VERSION = <integer>
+ * EA_COMPILER_NAME = <string>
+ * EA_COMPILER_STRING = <string>
+ *
+ * EA_COMPILER_VA_COPY_REQUIRED
+ *
+ * C++98/03 functionality
+ * EA_COMPILER_NO_STATIC_CONSTANTS
+ * EA_COMPILER_NO_TEMPLATE_SPECIALIZATION
+ * EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ * EA_COMPILER_NO_MEMBER_TEMPLATES
+ * EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION
+ * EA_COMPILER_NO_TEMPLATE_TEMPLATES
+ * EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS
+ * EA_COMPILER_NO_VOID_RETURNS
+ * EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ * EA_COMPILER_NO_DEDUCED_TYPENAME
+ * EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP
+ * EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE
+ * EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ * EA_COMPILER_NO_RTTI
+ * EA_COMPILER_NO_EXCEPTIONS
+ * EA_COMPILER_NO_NEW_THROW_SPEC
+ * EA_THROW_SPEC_NEW / EA_THROW_SPEC_DELETE
+ * EA_COMPILER_NO_UNWIND
+ * EA_COMPILER_NO_STANDARD_CPP_LIBRARY
+ * EA_COMPILER_NO_STATIC_VARIABLE_INIT
+ * EA_COMPILER_NO_STATIC_FUNCTION_INIT
+ * EA_COMPILER_NO_VARIADIC_MACROS
+ *
+ * C++11 functionality
+ * EA_COMPILER_NO_RVALUE_REFERENCES
+ * EA_COMPILER_NO_EXTERN_TEMPLATE
+ * EA_COMPILER_NO_RANGE_BASED_FOR_LOOP
+ * EA_COMPILER_NO_CONSTEXPR
+ * EA_COMPILER_NO_OVERRIDE
+ * EA_COMPILER_NO_INHERITANCE_FINAL
+ * EA_COMPILER_NO_NULLPTR
+ * EA_COMPILER_NO_AUTO
+ * EA_COMPILER_NO_DECLTYPE
+ * EA_COMPILER_NO_DEFAULTED_FUNCTIONS
+ * EA_COMPILER_NO_DELETED_FUNCTIONS
+ * EA_COMPILER_NO_LAMBDA_EXPRESSIONS
+ * EA_COMPILER_NO_TRAILING_RETURN_TYPES
+ * EA_COMPILER_NO_STRONGLY_TYPED_ENUMS
+ * EA_COMPILER_NO_FORWARD_DECLARED_ENUMS
+ * EA_COMPILER_NO_VARIADIC_TEMPLATES
+ * EA_COMPILER_NO_TEMPLATE_ALIASES
+ * EA_COMPILER_NO_INITIALIZER_LISTS
+ * EA_COMPILER_NO_NORETURN
+ * EA_COMPILER_NO_CARRIES_DEPENDENCY
+ * EA_COMPILER_NO_FALLTHROUGH
+ * EA_COMPILER_NO_NODISCARD
+ * EA_COMPILER_NO_MAYBE_UNUSED
+ * EA_COMPILER_NO_NONSTATIC_MEMBER_INITIALIZERS
+ * EA_COMPILER_NO_RIGHT_ANGLE_BRACKETS
+ * EA_COMPILER_NO_ALIGNOF
+ * EA_COMPILER_NO_ALIGNAS
+ * EA_COMPILER_NO_DELEGATING_CONSTRUCTORS
+ * EA_COMPILER_NO_INHERITING_CONSTRUCTORS
+ * EA_COMPILER_NO_USER_DEFINED_LITERALS
+ * EA_COMPILER_NO_STANDARD_LAYOUT_TYPES
+ * EA_COMPILER_NO_EXTENDED_SIZEOF
+ * EA_COMPILER_NO_INLINE_NAMESPACES
+ * EA_COMPILER_NO_UNRESTRICTED_UNIONS
+ * EA_COMPILER_NO_EXPLICIT_CONVERSION_OPERATORS
+ * EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
+ * EA_COMPILER_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
+ * EA_COMPILER_NO_NOEXCEPT
+ * EA_COMPILER_NO_RAW_LITERALS
+ * EA_COMPILER_NO_UNICODE_STRING_LITERALS
+ * EA_COMPILER_NO_NEW_CHARACTER_TYPES
+ * EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS
+ * EA_COMPILER_NO_UNIFIED_INITIALIZATION_SYNTAX
+ * EA_COMPILER_NO_EXTENDED_FRIEND_DECLARATIONS
+ *
+ * C++14 functionality
+ * EA_COMPILER_NO_VARIABLE_TEMPLATES
+ *
+ * C++17 functionality
+ * EA_COMPILER_NO_INLINE_VARIABLES
+ * EA_COMPILER_NO_ALIGNED_NEW
+ *
+ * C++20 functionality
+ * EA_COMPILER_NO_DESIGNATED_INITIALIZERS
+ *
+ *-----------------------------------------------------------------------------
+ *
+ * Supplemental documentation
+ * EA_COMPILER_NO_STATIC_CONSTANTS
+ * Code such as this is legal, but some compilers fail to compile it:
+ * struct A{ static const a = 1; };
+ *
+ * EA_COMPILER_NO_TEMPLATE_SPECIALIZATION
+ * Some compilers fail to allow template specialization, such as with this:
+ * template<class U> void DoSomething(U u);
+ * void DoSomething(int x);
+ *
+ * EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ * Some compilers fail to allow partial template specialization, such as with this:
+ * template <class T, class Allocator> class vector{ }; // Primary templated class.
+ * template <class Allocator> class vector<bool, Allocator>{ }; // Partially specialized version.
+ *
+ * EA_COMPILER_NO_MEMBER_TEMPLATES
+ * Some compilers fail to allow member template functions such as this:
+ * struct A{ template<class U> void DoSomething(U u); };
+ *
+ * EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION
+ * Some compilers fail to allow member template specialization, such as with this:
+ * struct A{
+ * template<class U> void DoSomething(U u);
+ * void DoSomething(int x);
+ * };
+ *
+ * EA_COMPILER_NO_TEMPLATE_TEMPLATES
+ * Code such as this is legal:
+ * template<typename T, template<typename> class U>
+ * U<T> SomeFunction(const U<T> x) { return x.DoSomething(); }
+ *
+ * EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS
+ * Some compilers fail to compile templated friends, as with this:
+ * struct A{ template<class U> friend class SomeFriend; };
+ * This is described in the C++ Standard at 14.5.3.
+ *
+ * EA_COMPILER_NO_VOID_RETURNS
+ * This is legal C++:
+ * void DoNothing1(){ };
+ * void DoNothing2(){ return DoNothing1(); }
+ *
+ * EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ * See the C++ standard sec 10.3,p5.
+ *
+ * EA_COMPILER_NO_DEDUCED_TYPENAME
+ * Some compilers don't support the use of 'typename' for
+ * dependent types in deduced contexts, as with this:
+ * template <class T> void Function(T, typename T::type);
+ *
+ * EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP
+ * Also known as Koenig lookup. Basically, if you have a function
+ * that is a namespace and you call that function without prefixing
+ * it with the namespace the compiler should look at any arguments
+ * you pass to that function call and search their namespace *first*
+ * to see if the given function exists there.
+ *
+ * EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE
+ * <exception> is in namespace std. Some std libraries fail to
+ * put the contents of <exception> in namespace std. The following
+ * code should normally be legal:
+ * void Function(){ std::terminate(); }
+ *
+ * EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ * Some compilers fail to execute DoSomething() properly, though they
+ * succeed in compiling it, as with this:
+ * template <int i>
+ * bool DoSomething(int j){ return i == j; };
+ * DoSomething<1>(2);
+ *
+ * EA_COMPILER_NO_EXCEPTIONS
+ * The compiler is configured to disallow the use of try/throw/catch
+ * syntax (often to improve performance). Use of such syntax in this
+ * case will cause a compilation error.
+ *
+ * EA_COMPILER_NO_UNWIND
+ * The compiler is configured to allow the use of try/throw/catch
+ * syntax and behaviour but disables the generation of stack unwinding
+ * code for responding to exceptions (often to improve performance).
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef INCLUDED_eacompiler_H
+#define INCLUDED_eacompiler_H
+
+ #include <EABase/config/eaplatform.h>
+
+ // Note: This is used to generate the EA_COMPILER_STRING macros
+ #ifndef INTERNAL_STRINGIZE
+ #define INTERNAL_STRINGIZE(x) INTERNAL_PRIMITIVE_STRINGIZE(x)
+ #endif
+ #ifndef INTERNAL_PRIMITIVE_STRINGIZE
+ #define INTERNAL_PRIMITIVE_STRINGIZE(x) #x
+ #endif
+
+ // EA_COMPILER_HAS_FEATURE
+ #ifndef EA_COMPILER_HAS_FEATURE
+ #if defined(__clang__)
+ #define EA_COMPILER_HAS_FEATURE(x) __has_feature(x)
+ #else
+ #define EA_COMPILER_HAS_FEATURE(x) 0
+ #endif
+ #endif
+
+
+ // EA_COMPILER_HAS_BUILTIN
+ #ifndef EA_COMPILER_HAS_BUILTIN
+ #if defined(__clang__)
+ #define EA_COMPILER_HAS_BUILTIN(x) __has_builtin(x)
+ #else
+ #define EA_COMPILER_HAS_BUILTIN(x) 0
+ #endif
+ #endif
+
+
+ // EDG (EDG compiler front-end, used by other compilers such as SN)
+ #if defined(__EDG_VERSION__)
+ #define EA_COMPILER_EDG 1
+
+ #if defined(_MSC_VER)
+ #define EA_COMPILER_EDG_VC_MODE 1
+ #endif
+ #if defined(__GNUC__)
+ #define EA_COMPILER_EDG_GCC_MODE 1
+ #endif
+ #endif
+
+ // EA_COMPILER_WINRTCX_ENABLED
+ //
+ // Defined as 1 if the compiler has its available C++/CX support enabled, else undefined.
+ // This specifically means the corresponding compilation unit has been built with Windows Runtime
+ // Components enabled, usually via the '-ZW' compiler flags being used. This option allows for using
+ // ref counted hat-type '^' objects and other C++/CX specific keywords like "ref new"
+ #if !defined(EA_COMPILER_WINRTCX_ENABLED) && defined(__cplusplus_winrt)
+ #define EA_COMPILER_WINRTCX_ENABLED 1
+ #endif
+
+
+ // EA_COMPILER_CPP11_ENABLED
+ //
+ // Defined as 1 if the compiler has its available C++11 support enabled, else undefined.
+ // This does not mean that all of C++11 or any particular feature of C++11 is supported
+ // by the compiler. It means that whatever C++11 support the compiler has is enabled.
+ // This also includes existing and older compilers that still identify C++11 as C++0x.
+ //
+ // We cannot use (__cplusplus >= 201103L) alone because some compiler vendors have
+ // decided to not define __cplusplus like thus until they have fully completed their
+ // C++11 support.
+ //
+ #if !defined(EA_COMPILER_CPP11_ENABLED) && defined(__cplusplus)
+ #if (__cplusplus >= 201103L) // Clang and GCC defines this like so in C++11 mode.
+ #define EA_COMPILER_CPP11_ENABLED 1
+ #elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+ #define EA_COMPILER_CPP11_ENABLED 1
+ #elif defined(_MSC_VER) && _MSC_VER >= 1600 // Microsoft unilaterally enables its C++11 support; there is no way to disable it.
+ #define EA_COMPILER_CPP11_ENABLED 1
+ #elif defined(__EDG_VERSION__) // && ???
+ // To do: Is there a generic way to determine this?
+ #endif
+ #endif
+
+
+ // EA_COMPILER_CPP14_ENABLED
+ //
+ // Defined as 1 if the compiler has its available C++14 support enabled, else undefined.
+ // This does not mean that all of C++14 or any particular feature of C++14 is supported
+ // by the compiler. It means that whatever C++14 support the compiler has is enabled.
+ //
+ // We cannot use (__cplusplus >= 201402L) alone because some compiler vendors have
+ // decided to not define __cplusplus like thus until they have fully completed their
+ // C++14 support.
+ #if !defined(EA_COMPILER_CPP14_ENABLED) && defined(__cplusplus)
+ #if (__cplusplus >= 201402L) // Clang and GCC defines this like so in C++14 mode.
+ #define EA_COMPILER_CPP14_ENABLED 1
+ #elif defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+
+ #define EA_COMPILER_CPP14_ENABLED 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_CPP17_ENABLED
+ //
+ // Defined as 1 if the compiler has its available C++17 support enabled, else undefined.
+ // This does not mean that all of C++17 or any particular feature of C++17 is supported
+ // by the compiler. It means that whatever C++17 support the compiler has is enabled.
+ //
+ // We cannot use (__cplusplus >= 201703L) alone because some compiler vendors have
+ // decided to not define __cplusplus like thus until they have fully completed their
+ // C++17 support.
+ #if !defined(EA_COMPILER_CPP17_ENABLED) && defined(__cplusplus)
+ #if (__cplusplus >= 201703L)
+ #define EA_COMPILER_CPP17_ENABLED 1
+ #elif defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L) // C++17+
+ #define EA_COMPILER_CPP17_ENABLED 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_CPP20_ENABLED
+ //
+ // Defined as 1 if the compiler has its available C++20 support enabled, else undefined.
+ // This does not mean that all of C++20 or any particular feature of C++20 is supported
+ // by the compiler. It means that whatever C++20 support the compiler has is enabled.
+ //
+ // We cannot use (__cplusplus >= 202003L) alone because some compiler vendors have
+ // decided to not define __cplusplus like thus until they have fully completed their
+ // C++20 support.
+ #if !defined(EA_COMPILER_CPP20_ENABLED) && defined(__cplusplus)
+ // TODO(rparoin): enable once a C++20 value for the __cplusplus macro has been published
+ // #if (__cplusplus >= 202003L)
+ // #define EA_COMPILER_CPP20_ENABLED 1
+ // #elif defined(_MSVC_LANG) && (_MSVC_LANG >= 202003L) // C++20+
+ // #define EA_COMPILER_CPP20_ENABLED 1
+ // #endif
+ #endif
+
+
+
+ #if defined(__ARMCC_VERSION)
+ // Note that this refers to the ARM RVCT compiler (armcc or armcpp), but there
+ // are other compilers that target ARM processors, such as GCC and Microsoft VC++.
+ // If you want to detect compiling for the ARM processor, check for EA_PROCESSOR_ARM
+ // being defined.
+ // This compiler is also identified by defined(__CC_ARM) || defined(__ARMCC__).
+ #define EA_COMPILER_RVCT 1
+ #define EA_COMPILER_ARM 1
+ #define EA_COMPILER_VERSION __ARMCC_VERSION
+ #define EA_COMPILER_NAME "RVCT"
+ //#define EA_COMPILER_STRING (defined below)
+
+ // Clang's GCC-compatible driver.
+ #elif defined(__clang__) && !defined(_MSC_VER)
+ #define EA_COMPILER_CLANG 1
+ #define EA_COMPILER_VERSION (__clang_major__ * 100 + __clang_minor__)
+ #define EA_COMPILER_NAME "clang"
+ #define EA_COMPILER_STRING EA_COMPILER_NAME __clang_version__
+
+ // GCC (a.k.a. GNUC)
+ #elif defined(__GNUC__) // GCC compilers exist for many platforms.
+ #define EA_COMPILER_GNUC 1
+ #define EA_COMPILER_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+ #define EA_COMPILER_NAME "GCC"
+ #define EA_COMPILER_STRING EA_COMPILER_NAME " compiler, version " INTERNAL_STRINGIZE( __GNUC__ ) "." INTERNAL_STRINGIZE( __GNUC_MINOR__ )
+
+ #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) // If GCC < 2.95...
+ #define EA_COMPILER_NO_MEMBER_TEMPLATES 1
+ #endif
+ #if (__GNUC__ == 2) && (__GNUC_MINOR__ <= 97) // If GCC <= 2.97...
+ #define EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS 1
+ #endif
+ #if (__GNUC__ == 3) && ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2)) // If GCC 3.1 or 3.2 (but not pre 3.1 or post 3.2)...
+ #define EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS 1
+ #endif
+
+ // Borland C++
+ #elif defined(__BORLANDC__)
+ #define EA_COMPILER_BORLANDC 1
+ #define EA_COMPILER_VERSION __BORLANDC__
+ #define EA_COMPILER_NAME "Borland C"
+ //#define EA_COMPILER_STRING (defined below)
+
+ #if (__BORLANDC__ <= 0x0550) // If Borland C++ Builder 4 and 5...
+ #define EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS 1
+ #endif
+ #if (__BORLANDC__ >= 0x561) && (__BORLANDC__ < 0x600)
+ #define EA_COMPILER_NO_MEMBER_FUNCTION_SPECIALIZATION 1
+ #endif
+
+
+ // Intel C++
+ // The Intel Windows compiler masquerades as VC++ and defines _MSC_VER.
+ // The Intel compiler is based on the EDG compiler front-end.
+ #elif defined(__ICL) || defined(__ICC)
+ #define EA_COMPILER_INTEL 1
+
+ // Should we enable the following? We probably should do so since enabling it does a lot more good than harm
+ // for users. The Intel Windows compiler does a pretty good job of emulating VC++ and so the user would likely
+ // have to handle few special cases where the Intel compiler doesn't emulate VC++ correctly.
+ #if defined(_MSC_VER)
+ #define EA_COMPILER_MSVC 1
+ #define EA_COMPILER_MICROSOFT 1
+ #endif
+
+ // Should we enable the following? This isn't as clear because as of this writing we don't know if the Intel
+ // compiler truly emulates GCC well enough that enabling this does more good than harm.
+ #if defined(__GNUC__)
+ #define EA_COMPILER_GNUC 1
+ #endif
+
+ #if defined(__ICL)
+ #define EA_COMPILER_VERSION __ICL
+ #elif defined(__ICC)
+ #define EA_COMPILER_VERSION __ICC
+ #endif
+ #define EA_COMPILER_NAME "Intel C++"
+ #if defined(_MSC_VER)
+ #define EA_COMPILER_STRING EA_COMPILER_NAME " compiler, version " INTERNAL_STRINGIZE( EA_COMPILER_VERSION ) ", EDG version " INTERNAL_STRINGIZE( __EDG_VERSION__ ) ", VC++ version " INTERNAL_STRINGIZE( _MSC_VER )
+ #elif defined(__GNUC__)
+ #define EA_COMPILER_STRING EA_COMPILER_NAME " compiler, version " INTERNAL_STRINGIZE( EA_COMPILER_VERSION ) ", EDG version " INTERNAL_STRINGIZE( __EDG_VERSION__ ) ", GCC version " INTERNAL_STRINGIZE( __GNUC__ )
+ #else
+ #define EA_COMPILER_STRING EA_COMPILER_NAME " compiler, version " INTERNAL_STRINGIZE( EA_COMPILER_VERSION ) ", EDG version " INTERNAL_STRINGIZE( __EDG_VERSION__ )
+ #endif
+
+
+ #elif defined(_MSC_VER)
+ #define EA_COMPILER_MSVC 1
+ #define EA_COMPILER_MICROSOFT 1
+ #define EA_COMPILER_VERSION _MSC_VER
+ #define EA_COMPILER_NAME "Microsoft Visual C++"
+ //#define EA_COMPILER_STRING (defined below)
+
+ #if defined(__clang__)
+ // Clang's MSVC-compatible driver.
+ #define EA_COMPILER_CLANG_CL 1
+ #endif
+
+ #define EA_STANDARD_LIBRARY_MSVC 1
+ #define EA_STANDARD_LIBRARY_MICROSOFT 1
+
+ #if (_MSC_VER <= 1200) // If VC6.x and earlier...
+ #if (_MSC_VER < 1200)
+ #define EA_COMPILER_MSVCOLD 1
+ #else
+ #define EA_COMPILER_MSVC6 1
+ #endif
+
+ #if (_MSC_VER < 1200) // If VC5.x or earlier...
+ #define EA_COMPILER_NO_TEMPLATE_SPECIALIZATION 1
+ #endif
+ #define EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS 1 // The compiler compiles this OK, but executes it wrong. Fixed in VC7.0
+ #define EA_COMPILER_NO_VOID_RETURNS 1 // The compiler fails to compile such cases. Fixed in VC7.0
+ #define EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE 1 // The compiler fails to compile such cases. Fixed in VC7.0
+ #define EA_COMPILER_NO_DEDUCED_TYPENAME 1 // The compiler fails to compile such cases. Fixed in VC7.0
+ #define EA_COMPILER_NO_STATIC_CONSTANTS 1 // The compiler fails to compile such cases. Fixed in VC7.0
+ #define EA_COMPILER_NO_COVARIANT_RETURN_TYPE 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP 1 // The compiler compiles this OK, but executes it wrong. Fixed in VC7.1
+ #define EA_COMPILER_NO_TEMPLATE_TEMPLATES 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ //#define EA_COMPILER_NO_MEMBER_TEMPLATES 1 // VC6.x supports member templates properly 95% of the time. So do we flag the remaining 5%?
+ //#define EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION 1 // VC6.x supports member templates properly 95% of the time. So do we flag the remaining 5%?
+
+ #elif (_MSC_VER <= 1300) // If VC7.0 and earlier...
+ #define EA_COMPILER_MSVC7 1
+
+ #define EA_COMPILER_NO_COVARIANT_RETURN_TYPE 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP 1 // The compiler compiles this OK, but executes it wrong. Fixed in VC7.1
+ #define EA_COMPILER_NO_TEMPLATE_TEMPLATES 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS 1 // The compiler fails to compile such cases. Fixed in VC7.1
+ #define EA_COMPILER_NO_MEMBER_FUNCTION_SPECIALIZATION 1 // This is the case only for VC7.0 and not VC6 or VC7.1+. Fixed in VC7.1
+ //#define EA_COMPILER_NO_MEMBER_TEMPLATES 1 // VC7.0 supports member templates properly 95% of the time. So do we flag the remaining 5%?
+
+ #elif (_MSC_VER < 1400) // VS2003 _MSC_VER of 1300 means VC7 (VS2003)
+ // The VC7.1 and later compiler is fairly close to the C++ standard
+ // and thus has no compiler limitations that we are concerned about.
+ #define EA_COMPILER_MSVC7_2003 1
+ #define EA_COMPILER_MSVC7_1 1
+
+ #elif (_MSC_VER < 1500) // VS2005 _MSC_VER of 1400 means VC8 (VS2005)
+ #define EA_COMPILER_MSVC8_2005 1
+ #define EA_COMPILER_MSVC8_0 1
+
+ #elif (_MSC_VER < 1600) // VS2008. _MSC_VER of 1500 means VC9 (VS2008)
+ #define EA_COMPILER_MSVC9_2008 1
+ #define EA_COMPILER_MSVC9_0 1
+
+ #elif (_MSC_VER < 1700) // VS2010 _MSC_VER of 1600 means VC10 (VS2010)
+ #define EA_COMPILER_MSVC_2010 1
+ #define EA_COMPILER_MSVC10_0 1
+
+ #elif (_MSC_VER < 1800) // VS2012 _MSC_VER of 1700 means VS2011/VS2012
+ #define EA_COMPILER_MSVC_2011 1 // Microsoft changed the name to VS2012 before shipping, despite referring to it as VS2011 up to just a few weeks before shipping.
+ #define EA_COMPILER_MSVC11_0 1
+ #define EA_COMPILER_MSVC_2012 1
+ #define EA_COMPILER_MSVC12_0 1
+
+ #elif (_MSC_VER < 1900) // VS2013 _MSC_VER of 1800 means VS2013
+ #define EA_COMPILER_MSVC_2013 1
+ #define EA_COMPILER_MSVC13_0 1
+
+ #elif (_MSC_VER < 1910) // VS2015 _MSC_VER of 1900 means VS2015
+ #define EA_COMPILER_MSVC_2015 1
+ #define EA_COMPILER_MSVC14_0 1
+
+ #elif (_MSC_VER < 1911) // VS2017 _MSC_VER of 1910 means VS2017
+ #define EA_COMPILER_MSVC_2017 1
+ #define EA_COMPILER_MSVC15_0 1
+
+ #endif
+
+
+ // IBM
+ #elif defined(__xlC__)
+ #define EA_COMPILER_IBM 1
+ #define EA_COMPILER_NAME "IBM XL C"
+ #define EA_COMPILER_VERSION __xlC__
+ #define EA_COMPILER_STRING "IBM XL C compiler, version " INTERNAL_STRINGIZE( __xlC__ )
+
+ // Unknown
+ #else // Else the compiler is unknown
+
+ #define EA_COMPILER_VERSION 0
+ #define EA_COMPILER_NAME "Unknown"
+
+ #endif
+
+ #ifndef EA_COMPILER_STRING
+ #define EA_COMPILER_STRING EA_COMPILER_NAME " compiler, version " INTERNAL_STRINGIZE(EA_COMPILER_VERSION)
+ #endif
+
+
+ // Deprecated definitions
+ // For backwards compatibility, should be supported for at least the life of EABase v2.0.x.
+ #ifndef EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ #define EA_COMPILER_PARTIAL_TEMPLATE_SPECIALIZATION 1
+ #endif
+ #ifndef EA_COMPILER_NO_TEMPLATE_SPECIALIZATION
+ #define EA_COMPILER_TEMPLATE_SPECIALIZATION 1
+ #endif
+ #ifndef EA_COMPILER_NO_MEMBER_TEMPLATES
+ #define EA_COMPILER_MEMBER_TEMPLATES 1
+ #endif
+ #ifndef EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION
+ #define EA_COMPILER_MEMBER_TEMPLATE_SPECIALIZATION 1
+ #endif
+
+
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // EA_COMPILER_VA_COPY_REQUIRED
+ //
+ // Defines whether va_copy must be used to copy or save va_list objects between uses.
+ // 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++.
+ ///////////////////////////////////////////////////////////////////////////////
+
+ #ifndef EA_COMPILER_VA_COPY_REQUIRED
+ #if ((defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__)) && (!defined(__i386__) || defined(__x86_64__)) && !defined(__ppc__) && !defined(__PPC__) && !defined(__PPC64__)
+ #define EA_COMPILER_VA_COPY_REQUIRED 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_RTTI
+ //
+ // If EA_COMPILER_NO_RTTI is defined, then RTTI (run-time type information)
+ // is not available (possibly due to being disabled by the user).
+ //
+ #if defined(__EDG_VERSION__) && !defined(__RTTI)
+ #define EA_COMPILER_NO_RTTI 1
+ #elif defined(__clang__) && !EA_COMPILER_HAS_FEATURE(cxx_rtti)
+ #define EA_COMPILER_NO_RTTI 1
+ #elif defined(__IBMCPP__) && !defined(__RTTI_ALL__)
+ #define EA_COMPILER_NO_RTTI 1
+ #elif defined(__GXX_ABI_VERSION) && !defined(__GXX_RTTI)
+ #define EA_COMPILER_NO_RTTI 1
+ #elif defined(_MSC_VER) && !defined(_CPPRTTI)
+ #define EA_COMPILER_NO_RTTI 1
+ #elif defined(__ARMCC_VERSION) && defined(__TARGET_CPU_MPCORE) && !defined(__RTTI)
+ #define EA_COMPILER_NO_RTTI 1
+ #endif
+
+
+
+ // EA_COMPILER_NO_EXCEPTIONS / EA_COMPILER_NO_UNWIND
+ //
+ // If EA_COMPILER_NO_EXCEPTIONS is defined, then the compiler is
+ // configured to not recognize C++ exception-handling statements
+ // such as try/catch/throw. Thus, when EA_COMPILER_NO_EXCEPTIONS is
+ // defined, code that attempts to use exception handling statements
+ // will usually cause a compilation error. If is often desirable
+ // for projects to disable exception handling because exception
+ // handling causes extra code and/or data generation which might
+ // not be needed, especially if it is known that exceptions won't
+ // be happening. When writing code that is to be portable between
+ // systems of which some enable exception handling while others
+ // don't, check for EA_COMPILER_NO_EXCEPTIONS being defined.
+ //
+ #if !defined(EA_COMPILER_NO_EXCEPTIONS) && !defined(EA_COMPILER_NO_UNWIND)
+ #if defined(EA_COMPILER_GNUC) && defined(_NO_EX) // GCC on some platforms defines _NO_EX when exceptions are disabled.
+ #define EA_COMPILER_NO_EXCEPTIONS 1
+
+ #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_MSVC)) && !defined(_CPPUNWIND)
+ #define EA_COMPILER_NO_UNWIND 1
+
+ #endif // EA_COMPILER_NO_EXCEPTIONS / EA_COMPILER_NO_UNWIND
+ #endif // !defined(EA_COMPILER_NO_EXCEPTIONS) && !defined(EA_COMPILER_NO_UNWIND)
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_VC_WARNINGS / EA_RESTORE_ALL_VC_WARNINGS
+ //
+ // Disable and re-enable all warning(s) within code.
+ //
+ // Example usage:
+ // EA_DISABLE_ALL_VC_WARNINGS()
+ // <code>
+ // EA_RESTORE_ALL_VC_WARNINGS()
+ //
+ //This is duplicated from EABase's eacompilertraits.h
+ #ifndef EA_DISABLE_ALL_VC_WARNINGS
+ #if defined(_MSC_VER)
+ #define EA_DISABLE_ALL_VC_WARNINGS() \
+ __pragma(warning(push, 0)) \
+ __pragma(warning(disable: 4244 4265 4267 4350 4472 4509 4548 4623 4710 4985 6320 4755 4625 4626 4702)) // Some warnings need to be explicitly called out.
+ #else
+ #define EA_DISABLE_ALL_VC_WARNINGS()
+ #endif
+ #endif
+
+ //This is duplicated from EABase's eacompilertraits.h
+ #ifndef EA_RESTORE_ALL_VC_WARNINGS
+ #if defined(_MSC_VER)
+ #define EA_RESTORE_ALL_VC_WARNINGS() \
+ __pragma(warning(pop))
+ #else
+ #define EA_RESTORE_ALL_VC_WARNINGS()
+ #endif
+ #endif
+
+ // Dinkumware
+ //This is duplicated from EABase's eahave.h
+ #if !defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && !defined(EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY)
+ #if defined(__cplusplus)
+ EA_DISABLE_ALL_VC_WARNINGS()
+ #include <cstddef> // Need to trigger the compilation of yvals.h without directly using <yvals.h> because it might not exist.
+ EA_RESTORE_ALL_VC_WARNINGS()
+ #endif
+
+ #if defined(__cplusplus) && defined(_CPPLIB_VER) /* If using the Dinkumware Standard library... */
+ #define EA_HAVE_DINKUMWARE_CPP_LIBRARY 1
+ #else
+ #define EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_ALIGNED_NEW
+ //
+ //
+ #if !defined(EA_COMPILER_NO_ALIGNED_NEW)
+ #if defined(_HAS_ALIGNED_NEW) && _HAS_ALIGNED_NEW // VS2017 15.5 Preview
+ // supported.
+ #elif defined(EA_COMPILER_CPP17_ENABLED)
+ // supported.
+ #else
+ #define EA_COMPILER_NO_ALIGNED_NEW 1
+ #endif
+ #endif
+
+ // EA_COMPILER_NO_NEW_THROW_SPEC / EA_THROW_SPEC_NEW / EA_THROW_SPEC_DELETE
+ //
+ // If defined then the compiler's version of operator new is not decorated
+ // with a throw specification. This is useful for us to know because we
+ // often want to write our own overloaded operator new implementations.
+ // We need such operator new overrides to be declared identically to the
+ // way the compiler is defining operator new itself.
+ //
+ // Example usage:
+ // void* operator new(std::size_t) EA_THROW_SPEC_NEW(std::bad_alloc);
+ // void* operator new[](std::size_t) EA_THROW_SPEC_NEW(std::bad_alloc);
+ // void* operator new(std::size_t, const std::nothrow_t&) EA_THROW_SPEC_NEW_NONE();
+ // void* operator new[](std::size_t, const std::nothrow_t&) EA_THROW_SPEC_NEW_NONE();
+ // void operator delete(void*) EA_THROW_SPEC_DELETE_NONE();
+ // void operator delete[](void*) EA_THROW_SPEC_DELETE_NONE();
+ // void operator delete(void*, const std::nothrow_t&) EA_THROW_SPEC_DELETE_NONE();
+ // void operator delete[](void*, const std::nothrow_t&) EA_THROW_SPEC_DELETE_NONE();
+ //
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY)
+ #if defined(_MSC_VER) && (_MSC_VER >= 1912) // VS2017 15.3+
+ #define EA_THROW_SPEC_NEW(x) noexcept(false)
+ #define EA_THROW_SPEC_NEW_NONE() noexcept
+ #define EA_THROW_SPEC_DELETE_NONE() noexcept
+
+ #elif defined(_MSC_VER) && (_MSC_VER >= 1910) // VS2017+
+ #define EA_THROW_SPEC_NEW(x) throw(x)
+ #define EA_THROW_SPEC_NEW_NONE() throw()
+ #define EA_THROW_SPEC_DELETE_NONE() throw()
+
+ #else
+ #if defined(EA_PLATFORM_SONY)
+ #define EA_THROW_SPEC_NEW(X) _THROWS(X)
+ #elif defined(_MSC_VER)
+ // Disabled warning "nonstandard extension used: 'throw (...)'" as this warning is a W4 warning which is usually off by default
+ // and doesn't convey any important information but will still complain when building with /Wall (which most teams do)
+ #define EA_THROW_SPEC_NEW(X) __pragma(warning(push)) __pragma(warning(disable: 4987)) _THROWS(X) __pragma(warning(pop))
+ #else
+ #define EA_THROW_SPEC_NEW(X) _THROW1(X)
+ #endif
+ #define EA_THROW_SPEC_NEW_NONE() _THROW0()
+ #define EA_THROW_SPEC_DELETE_NONE() _THROW0()
+
+ #endif
+ #elif defined(EA_COMPILER_NO_EXCEPTIONS) && !defined(EA_COMPILER_RVCT) && !defined(EA_PLATFORM_LINUX) && !defined(EA_PLATFORM_APPLE) && !defined(CS_UNDEFINED_STRING)
+ #define EA_COMPILER_NO_NEW_THROW_SPEC 1
+
+ #define EA_THROW_SPEC_NEW(x)
+ #define EA_THROW_SPEC_NEW_NONE()
+ #define EA_THROW_SPEC_DELETE_NONE()
+ #else
+ #define EA_THROW_SPEC_NEW(x) throw(x)
+ #define EA_THROW_SPEC_NEW_NONE() throw()
+ #define EA_THROW_SPEC_DELETE_NONE() throw()
+ #endif
+
+
+ // EA_COMPILER_NO_STANDARD_CPP_LIBRARY
+ //
+ // If defined, then the compiler doesn't provide a Standard C++ 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
+
+
+ // EA_COMPILER_NO_STATIC_VARIABLE_INIT
+ //
+ // If defined, it means that global or static C++ variables will be
+ // constructed. Not all compiler/platorm combinations support this.
+ // User code that needs to be portable must avoid having C++ variables
+ // that construct before main.
+ //
+ //#if defined(EA_PLATFORM_MOBILE)
+ // #define EA_COMPILER_NO_STATIC_VARIABLE_INIT 1
+ //#endif
+
+
+ // EA_COMPILER_NO_STATIC_FUNCTION_INIT
+ //
+ // If defined, it means that functions marked as startup functions
+ // (e.g. __attribute__((constructor)) in GCC) are supported. It may
+ // be that some compiler/platform combinations don't support this.
+ //
+ //#if defined(XXX) // So far, all compiler/platforms we use support this.
+ // #define EA_COMPILER_NO_STATIC_VARIABLE_INIT 1
+ //#endif
+
+ // EA_COMPILER_NO_VARIADIC_MACROS
+ //
+ // If defined, the compiler doesn't support C99/C++11 variadic macros.
+ // With a variadic macro, you can do this:
+ // #define MY_PRINTF(format, ...) printf(format, __VA_ARGS__)
+ //
+ #if !defined(EA_COMPILER_NO_VARIADIC_MACROS)
+ #if defined(_MSC_VER) && (_MSC_VER < 1500) // If earlier than VS2008..
+ #define EA_COMPILER_NO_VARIADIC_MACROS 1
+ #elif defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__)) < 401 // If earlier than GCC 4.1..
+ #define EA_COMPILER_NO_VARIADIC_MACROS 1
+ #elif defined(EA_COMPILER_EDG) // Includes other compilers
+ // variadic macros are supported
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_RVALUE_REFERENCES
+ //
+ // If defined, the compiler doesn't fully support C++11 rvalue reference semantics.
+ // This applies to the compiler only and not the Standard Library in use with the compiler,
+ // which is required by the Standard to have some support itself.
+ //
+ #if !defined(EA_COMPILER_NO_RVALUE_REFERENCES)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (_MSC_VER >= 1600) // VS2010+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403) // EDG 4.3+.
+ // supported. Earlier EDG supported a subset of rvalue references. Implicit move constructors and assignment operators aren't supported until EDG 4.5.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && EA_COMPILER_HAS_FEATURE(cxx_rvalue_references)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_RVALUE_REFERENCES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_EXTERN_TEMPLATE
+ //
+ // If defined, the compiler doesn't support C++11 extern template.
+ // With extern templates, you can do this:
+ // extern template void DoSomething(KnownType u);
+ //
+ #if !defined(EA_COMPILER_NO_EXTERN_TEMPLATE)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (_MSC_VER >= 1700) // VS2012+...
+ // Extern template is supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && defined(__apple_build_version__) && (EA_COMPILER_VERSION >= 401)
+ // Extern template is supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && !defined(__apple_build_version__) // Clang other than Apple's Clang
+ // Extern template is supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006) // GCC 4.6+
+ // Extern template is supported.
+ #else
+ #define EA_COMPILER_NO_EXTERN_TEMPLATE 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_RANGE_BASED_FOR_LOOP
+ //
+ // If defined, the compiler doesn't support C++11 range-based for loops.
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
+ // You must #include <iterator> for range-based for loops to work.
+ // Example usage:
+ // #include <iterator>
+ // #include <vector>
+ // std::vector<float> floatVector;
+ // for(float& f : floatVector)
+ // f += 1.0;
+ //
+ #if !defined(EA_COMPILER_NO_RANGE_BASED_FOR_LOOP)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && (defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1700)) // VS2012+...
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && (defined(__clang__) && (EA_COMPILER_VERSION >= 300)) // Clang 3.x+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && (defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006)) // GCC 4.6+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_RANGE_BASED_FOR_LOOP 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_CONSTEXPR
+ //
+ // Refers to C++11 = constexpr (const expression) declarations.
+ //
+ #if !defined(EA_COMPILER_NO_CONSTEXPR)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && (defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1900)) // VS2015+... Not present in VC++ up to and including VS2013.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406) // EDG 4.6+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && EA_COMPILER_HAS_FEATURE(cxx_constexpr)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006) // GCC 4.6+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1900) // VS 2015+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_CONSTEXPR 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_CONSTEXPR_IF
+ //
+ // Refers to C++17 = constexpr if(const expression) conditionals.
+ //
+ #if !defined(EA_COMPILER_NO_CONSTEXPR_IF)
+ #if defined(EA_COMPILER_CPP17_ENABLED) && (defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1911)) // VS2017 15.3+
+ // supported.
+ #elif defined(EA_COMPILER_CPP17_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 309) // Clang 3.9+
+ // supported.
+ #elif defined(EA_COMPILER_CPP17_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 7000) // GCC 7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_CONSTEXPR_IF 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_OVERRIDE
+ //
+ // Refers to the C++11 override specifier.
+ //
+ #ifndef EA_COMPILER_NO_OVERRIDE
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION > 1600) // VC++ > VS2010, even without C++11 support. VS2010 does support override, however will generate warnings due to the keyword being 'non-standard'
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_OVERRIDE 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_INHERITANCE_FINAL
+ //
+ // Refers to the C++11 final specifier.
+ //
+ #ifndef EA_COMPILER_NO_INHERITANCE_FINAL
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1500) // VS2008+, even without C++11 support.
+ // supported, though you need to use EA_INHERITANCE_FINAL for it to work with VS versions prior to 2012.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+
+ // supported
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported
+ #else
+ #define EA_COMPILER_NO_INHERITANCE_FINAL 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_AUTO
+ //
+ // Refers to C++11 auto.
+ //
+ #if !defined(EA_COMPILER_NO_AUTO)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported with the exception of the usage of braced initializer lists as of EDG 4.3.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_AUTO 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NULLPTR
+ //
+ // Refers to C++11 nullptr (which is a built in type). std::nullptr_t is defined in C++11 <cstddef>.
+ // Note that <EABase/nullptr.h> implements a portable nullptr implementation.
+ //
+ #if !defined(EA_COMPILER_NO_NULLPTR)
+ #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) && defined(EA_COMPILER_CPP11_ENABLED)
+ // supported
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006) && defined(EA_COMPILER_CPP11_ENABLED)
+ // supported
+ #elif defined(__clang__) && defined(EA_COMPILER_CPP11_ENABLED)
+ // supported
+ #elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403) && defined(EA_COMPILER_CPP11_ENABLED)
+ // supported
+ #else
+ #define EA_COMPILER_NO_NULLPTR 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_DECLTYPE
+ //
+ // Refers to C++11 decltype.
+ //
+ #if !defined(EA_COMPILER_NO_DECLTYPE)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported, though VS2010 doesn't support the spec completely as specified in the final standard.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4003) // GCC 4.3+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_DECLTYPE 1
+ #endif
+ #endif
+
+
+
+ // EA_COMPILER_NO_DEFAULTED_FUNCTIONS
+ // EA_COMPILER_NO_DELETED_FUNCTIONS
+ //
+ // Refers to C++11 = default and = delete function declarations.
+ //
+ #if !defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+
+ // supported, but as of VS2013 it isn't supported for defaulted move constructors and move assignment operators.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported, but as of EDG 4.3 it isn't supported for defaulted move constructors and move assignment operators until EDG 4.5.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) // Clang 3.0+, including Apple's Clang
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ // VC++ doesn't support it as of VS2012.
+ #define EA_COMPILER_NO_DEFAULTED_FUNCTIONS 1
+ #endif
+ #endif
+
+ #if !defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+
+ // supported, but as of VS2013 it isn't supported for defaulted move constructors and move assignment operators.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ // VC++ doesn't support it as of VS2012.
+ #define EA_COMPILER_NO_DELETED_FUNCTIONS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_LAMBDA_EXPRESSIONS
+ //
+ // Refers to C++11 lambda expressions.
+ //
+ #if !defined(EA_COMPILER_NO_LAMBDA_EXPRESSIONS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported, though VS2010 doesn't support the spec completely as specified in the final standard.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported. However, converting lambdas to function pointers is not supported until EDG 4.5.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_LAMBDA_EXPRESSIONS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_TRAILING_RETURN_TYPES
+ //
+ // Refers to C++11 trailing-return-type. Also sometimes referred to as "incomplete return type".
+ //
+ #if !defined(EA_COMPILER_NO_TRAILING_RETURN_TYPES)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported, though VS2010 doesn't support the spec completely as specified in the final standard.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402) // EDG 4.2+.
+ // supported. However, use of "this" in trailing return types is not supported untiil EDG 4.4
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_TRAILING_RETURN_TYPES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_STRONGLY_TYPED_ENUMS
+ //
+ // Refers to C++11 strongly typed enums, which includes enum classes and sized enums. Doesn't include forward-declared enums.
+ //
+ #if !defined(EA_COMPILER_NO_STRONGLY_TYPED_ENUMS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1700) // VS2012+
+ // supported. A subset of this is actually supported by VS2010.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 400) // EDG 4.0+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_STRONGLY_TYPED_ENUMS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_FORWARD_DECLARED_ENUMS
+ //
+ // Refers to C++11 forward declared enums.
+ //
+ #if !defined(EA_COMPILER_NO_FORWARD_DECLARED_ENUMS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1700) // VS2012+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported. EDG 4.3 supports basic forward-declared enums, but not forward-declared strongly typed enums.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006) // GCC 4.6+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_FORWARD_DECLARED_ENUMS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_VARIADIC_TEMPLATES
+ //
+ // Refers to C++11 variadic templates.
+ //
+ #if !defined(EA_COMPILER_NO_VARIADIC_TEMPLATES)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (_MSC_FULL_VER == 170051025) // VS2012 November Preview for Windows only.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403) // EDG 4.3+.
+ // supported, though 4.1 has partial support for variadic templates.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported, though GCC 4.3 has partial support for variadic templates.
+ #else
+ #define EA_COMPILER_NO_VARIADIC_TEMPLATES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_TEMPLATE_ALIASES
+ //
+ // Refers to C++11 alias templates.
+ // Example alias template usage:
+ // template <typename T>
+ // using Dictionary = eastl::map<eastl::string, T>;
+ //
+ // Dictionary<int> StringIntDictionary;
+ //
+ #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402) // EDG 4.2+.
+ // supported, though 4.1 has partial support for variadic templates.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported, though GCC 4.3 has partial support for variadic templates.
+ #else
+ #define EA_COMPILER_NO_TEMPLATE_ALIASES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_VARIABLE_TEMPLATES
+ //
+ // Refers to C++14 variable templates.
+ // Example variable template usage:
+ // template<class T>
+ // constexpr T pi = T(3.1415926535897932385);
+ //
+ #if !defined(EA_COMPILER_NO_VARIABLE_TEMPLATES)
+ #if defined(_MSC_VER) && (_MSC_FULL_VER >= 190023918) // VS2015 Update 2 and above.
+ // supported.
+ #elif defined(EA_COMPILER_CPP14_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 304) && !defined(__apple_build_version__) // Clang 3.4+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP14_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 5000) // GCC 5+
+ // supported.
+ #elif !defined(EA_COMPILER_CPP14_ENABLED)
+ #define EA_COMPILER_NO_VARIABLE_TEMPLATES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_INLINE_VARIABLES
+ //
+ // Refers to C++17 inline variables that allows the definition of variables in header files
+ //
+ // Example usage:
+ // struct Foo
+ // {
+ // static inline constexpr int kConstant = 42; // no out of class definition
+ // };
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4424.pdf
+ // http://en.cppreference.com/w/cpp/language/inline
+ //
+ #if !defined(EA_COMPILER_NO_INLINE_VARIABLES)
+ #define EA_COMPILER_NO_INLINE_VARIABLES 1
+ #endif
+
+
+ // EA_COMPILER_NO_INITIALIZER_LISTS
+ //
+ // Refers to C++11 initializer lists.
+ // This refers to the compiler support for this and not the Standard Library support (std::initializer_list).
+ //
+ #if !defined(EA_COMPILER_NO_INITIALIZER_LISTS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (_MSC_FULL_VER == 170051025) // VS2012 November Preview for Windows only.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported, though GCC 4.3 has partial support for it.
+ #else
+ #define EA_COMPILER_NO_INITIALIZER_LISTS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NORETURN
+ //
+ // Refers to C++11 declaration attribute: noreturn.
+ // http://en.cppreference.com/w/cpp/language/attributes
+ // http://blog.aaronballman.com/2011/09/understanding-attributes/
+ //
+ #if !defined(EA_COMPILER_NO_NORETURN)
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1300) // VS2003+
+ // supported via __declspec(noreturn). You need to use that or EA_NORETURN. VC++ up to VS2013 doesn't support any C++11 attribute types.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402) // EDG 4.2+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4008) // GCC 4.8+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_NORETURN 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_CARRIES_DEPENDENCY
+ //
+ // Refers to C++11 declaration attribute: carries_dependency.
+ // http://en.cppreference.com/w/cpp/language/attributes
+ // http://blog.aaronballman.com/2011/09/understanding-attributes/
+ //
+ #if !defined(EA_COMPILER_NO_CARRIES_DEPENDENCY)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402) // EDG 4.2+.
+ // supported; stricter than other compilers in its usage.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ // Currently GNUC doesn't appear to support this attribute.
+ //#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4008) // GCC 4.8+
+ // // supported.
+ #else
+ #define EA_COMPILER_NO_CARRIES_DEPENDENCY 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_FALLTHROUGH
+ //
+ // Refers to C++17 declaration attribute: fallthrough.
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ #if !defined(EA_COMPILER_NO_FALLTHROUGH)
+ #if defined(EA_COMPILER_CPP17_ENABLED)
+ // supported.
+ #else
+ #define EA_COMPILER_NO_FALLTHROUGH 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NODISCARD
+ //
+ // Refers to C++17 declaration attribute: nodiscard.
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ #if !defined(EA_COMPILER_NO_NODISCARD)
+ #if defined(EA_COMPILER_CPP17_ENABLED)
+ // supported.
+ #else
+ #define EA_COMPILER_NO_NODISCARD 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_MAYBE_UNUSED
+ //
+ // Refers to C++17 declaration attribute: maybe_unused.
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ #if !defined(EA_COMPILER_NO_MAYBE_UNUSED)
+ #if defined(EA_COMPILER_CPP17_ENABLED)
+ // supported.
+ #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1912) // VS2017 15.3+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_MAYBE_UNUSED 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_STRUCTURED_BINDING
+ //
+ // Indicates if target compiler supports the C++17 "structured binding" language feature.
+ // https://en.cppreference.com/w/cpp/language/structured_binding
+ //
+ //
+ #if !defined(EA_COMPILER_NO_STRUCTURED_BINDING)
+ #if defined(EA_COMPILER_CPP17_ENABLED)
+ // supported.
+ #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1912) // VS2017 15.3+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_STRUCTURED_BINDING 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_DESIGNATED_INITIALIZERS
+ //
+ // Indicates the target compiler supports the C++20 "designated initializer" language feature.
+ // https://en.cppreference.com/w/cpp/language/aggregate_initialization
+ //
+ // Example:
+ // struct A { int x; int y; };
+ // A a = { .y = 42, .x = 1 };
+ //
+ #if !defined(EA_COMPILER_NO_DESIGNATED_INITIALIZERS)
+ #if defined(EA_COMPILER_CPP20_ENABLED)
+ // supported.
+ #else
+ #define EA_COMPILER_NO_DESIGNATED_INITIALIZERS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NONSTATIC_MEMBER_INITIALIZERS
+ //
+ // Refers to C++11 declaration attribute: carries_dependency.
+ // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm
+ //
+ #if !defined(EA_COMPILER_NO_NONSTATIC_MEMBER_INITIALIZERS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_NONSTATIC_MEMBER_INITIALIZERS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_RIGHT_ANGLE_BRACKETS
+ //
+ // Defines if the compiler supports >> (as opposed to > >) in template
+ // declarations such as typedef eastl::list<eastl::list<int>> ListList;
+ //
+ #if !defined(EA_COMPILER_NO_RIGHT_ANGLE_BRACKETS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4003) // GCC 4.3+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_RIGHT_ANGLE_BRACKETS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_ALIGNOF
+ //
+ // Refers specifically to C++11 alignof and not old compiler extensions such as __alignof__().
+ // However, EABase provides a portable EA_ALIGN_OF which works for all compilers.
+ //
+ #if !defined(EA_COMPILER_NO_ALIGNOF)
+ // Not supported by VC++ as of VS2013, though EA_ALIGN_OF is supported on all coompilers as an alternative.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_ALIGNOF 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_ALIGNAS
+ //
+ // Refers to C++11 alignas.
+ //
+ #if !defined(EA_COMPILER_NO_ALIGNAS)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4008) // GCC 4.8+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_ALIGNAS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_DELEGATING_CONSTRUCTORS
+ //
+ // Refers to C++11 constructor delegation.
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf
+ // https://www.ibm.com/developerworks/mydeveloperworks/blogs/5894415f-be62-4bc0-81c5-3956e82276f3/entry/c_0x_delegating_constructors
+ //
+ #if !defined(EA_COMPILER_NO_DELEGATING_CONSTRUCTORS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407) // EDG 4.7+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_DELEGATING_CONSTRUCTORS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_INHERITING_CONSTRUCTORS
+ //
+ // Refers to C++11 constructor inheritance via 'using'.
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
+ //
+ #if !defined(EA_COMPILER_NO_INHERITING_CONSTRUCTORS)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && EA_COMPILER_HAS_FEATURE(cxx_inheriting_constructors) // Clang
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4008) // GCC 4.8+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_INHERITING_CONSTRUCTORS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_USER_DEFINED_LITERALS
+ //
+ // http://en.cppreference.com/w/cpp/language/user_literal
+ // http://stackoverflow.com/questions/237804/what-new-capabilities-do-user-defined-literals-add-to-c
+ //
+ #if !defined(EA_COMPILER_NO_USER_DEFINED_LITERALS)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_USER_DEFINED_LITERALS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_STANDARD_LAYOUT_TYPES
+ // a.k.a. POD relaxation
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm
+ //
+ #if !defined(EA_COMPILER_NO_STANDARD_LAYOUT_TYPES)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1700) // VS2012+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_STANDARD_LAYOUT_TYPES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_EXTENDED_SIZEOF
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html
+ // Allows you to do this: sizeof(SomeClass::mSomeMember)
+ //
+ #if !defined(EA_COMPILER_NO_EXTENDED_SIZEOF)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ // Versions of EDG prior to 4.5 only support extended sizeof in non-member functions. Full support was added in 4.5
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_EXTENDED_SIZEOF 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_INLINE_NAMESPACES
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm
+ // http://blog.aaronballman.com/2011/07/inline-namespaces/
+ //
+ #if !defined(EA_COMPILER_NO_INLINE_NAMESPACES)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_INLINE_NAMESPACES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_UNRESTRICTED_UNIONS
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
+ //
+ #if !defined(EA_COMPILER_NO_UNRESTRICTED_UNIONS)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 406) // EDG 4.6+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006) // GCC 4.6+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_UNRESTRICTED_UNIONS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_EXPLICIT_CONVERSION_OPERATORS
+ //
+ // http://en.wikipedia.org/wiki/C%2B%2B11#Explicit_conversion_operators
+ //
+ #if !defined(EA_COMPILER_NO_EXPLICIT_CONVERSION_OPERATORS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (_MSC_FULL_VER == 170051025) // VS2012 November Preview for Windows only.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404) // EDG 4.4+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_EXPLICIT_CONVERSION_OPERATORS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS
+ //
+ // The compiler does not support default template arguments for function templates.
+ // http://stackoverflow.com/questions/2447458/default-template-arguments-for-function-templates
+ //
+ #if !defined(EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403) // EDG 4.4+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4003) // GCC 4.3+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm
+ // http://stackoverflow.com/questions/5751977/local-type-as-template-arguments-in-c
+ //
+ #if !defined(EA_COMPILER_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported.
+ #if (EA_COMPILER_VERSION < 1700) // VS2010 generates a warning, but the C++ language now allows it.
+ #pragma warning(disable: 4836) // nonstandard extension used: local types or unnamed types cannot be used as template arguments.
+ #endif
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 402) // EDG 4.2+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NOEXCEPT
+ //
+ // C++11 noexcept
+ // http://en.cppreference.com/w/cpp/language/attributes
+ // http://en.cppreference.com/w/cpp/language/noexcept
+ //
+ #if !defined(EA_COMPILER_NO_NOEXCEPT)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1900) // VS2014+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 405) // EDG 4.5+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4006) // GCC 4.6+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_NOEXCEPT 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_RAW_LITERALS
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
+ // http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals
+ //
+ #if !defined(EA_COMPILER_NO_RAW_LITERALS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407) // EDG 4.7+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_RAW_LITERALS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_UNICODE_STRING_LITERALS
+ //
+ // http://en.wikipedia.org/wiki/C%2B%2B11#New_string_literals
+ //
+ #if !defined(EA_COMPILER_NO_UNICODE_STRING_LITERALS)
+ // Not supported by VC++ as of VS2013.
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407) // EDG 4.7+.
+ // supported. It's not clear if it's v4.4 or v4.7 that adds this support.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 300) && !defined(__apple_build_version__) // Clang 3.0+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 407) // EDG 4.7+.
+ // supported. It's not clear if it's v4.4 or v4.7 that adds this support.
+ #else
+ #define EA_COMPILER_NO_UNICODE_STRING_LITERALS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_NEW_CHARACTER_TYPES
+ //
+ // Refers to char16_t and char32_t as true native types (and not something simply typedef'd from uint16_t and uint32_t).
+ // http://en.cppreference.com/w/cpp/language/types
+ //
+ #if !defined(EA_COMPILER_NO_NEW_CHARACTER_TYPES)
+ #if defined(EA_COMPILER_NO_UNICODE_STRING_LITERALS) // Some compilers have had support for char16_t prior to support for u"", but it's not useful to have the former without the latter.
+ #define EA_COMPILER_NO_NEW_CHARACTER_TYPES 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS
+ //
+ // C++ 11 relaxed \u\U sequences in strings.
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html
+ //
+ #if !defined(EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS)
+ // VC++ up till at least VS2013 supports \u and \U but supports them wrong with respect to the C++11 Standard.
+
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005) // GCC 4.5+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_UNIFIED_INITIALIZATION_SYNTAX
+ //
+ // http://en.wikipedia.org/wiki/C%2B%2B11#Uniform_initialization
+ //
+ #if !defined(EA_COMPILER_NO_UNIFIED_INITIALIZATION_SYNTAX)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1800) // VS2013+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 401) && defined(__apple_build_version__) // Apple clang 4.1+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 301) && !defined(__apple_build_version__) // Clang 3.1+, not including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4004) // GCC 4.4+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_UNIFIED_INITIALIZATION_SYNTAX 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_EXTENDED_FRIEND_DECLARATIONS
+ //
+ // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf
+ //
+ #if !defined(EA_COMPILER_NO_EXTENDED_FRIEND_DECLARATIONS)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1600) // VS2010+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) // EDG 4.1+.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && (EA_COMPILER_VERSION >= 209) // Clang 2.9+, including Apple's Clang.
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4007) // GCC 4.7+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_EXTENDED_FRIEND_DECLARATIONS 1
+ #endif
+ #endif
+
+
+ // EA_COMPILER_NO_THREAD_LOCAL
+ //
+ // Refers specifically to C++ thread_local, which is like compiler __thread implementations except
+ // that it also supports non-trivial classes (e.g. with ctors). EA_COMPILER_NO_THREAD_LOCAL refers
+ // specifically to full C++11 thread_local support. The EAThread package provides a wrapper for
+ // __thread via EA_THREAD_LOCAL (which unfortunately sounds like C++ thread_local).
+ //
+ // https://en.cppreference.com/w/cpp/keyword/thread_local
+ //
+ #if !defined(EA_COMPILER_NO_THREAD_LOCAL)
+ #if defined(EA_COMPILER_CPP11_ENABLED) && defined(__clang__) && EA_COMPILER_HAS_FEATURE(cxx_thread_local)
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(_MSC_VER) && (EA_COMPILER_VERSION >= 1900) // VS2015+
+ // supported.
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(__GNUC__) && (EA_COMPILER_VERSION >= 4008) // GCC 4.8+
+ // supported.
+ #else
+ #define EA_COMPILER_NO_THREAD_LOCAL 1
+ #endif
+ #endif
+
+
+#endif // INCLUDED_eacompiler_H
+
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/config/eacompilertraits.h b/EASTL/test/packages/EABase/include/Common/EABase/config/eacompilertraits.h
new file mode 100644
index 0000000..1d8bcb4
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/config/eacompilertraits.h
@@ -0,0 +1,2561 @@
+/*-----------------------------------------------------------------------------
+ * config/eacompilertraits.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *-----------------------------------------------------------------------------
+ * Currently supported defines include:
+ * EA_PREPROCESSOR_JOIN
+ *
+ * EA_COMPILER_IS_ANSIC
+ * EA_COMPILER_IS_C99
+ * EA_COMPILER_IS_C11
+ * EA_COMPILER_HAS_C99_TYPES
+ * EA_COMPILER_IS_CPLUSPLUS
+ * EA_COMPILER_MANAGED_CPP
+ * EA_COMPILER_INTMAX_SIZE
+ * EA_OFFSETOF
+ * EA_SIZEOF_MEMBER
+ *
+ * EA_ALIGN_OF()
+ * EA_ALIGN_MAX_STATIC / EA_ALIGN_MAX_AUTOMATIC
+ * EA_ALIGN() / EA_PREFIX_ALIGN() / EA_POSTFIX_ALIGN()
+ * EA_ALIGNED()
+ * EA_PACKED()
+ *
+ * EA_LIKELY()
+ * EA_UNLIKELY()
+ * EA_INIT_PRIORITY()
+ * EA_MAY_ALIAS()
+ * EA_ASSUME()
+ * EA_ANALYSIS_ASSUME()
+ * EA_PURE
+ * EA_WEAK
+ * EA_UNUSED()
+ * EA_EMPTY()
+ *
+ * EA_WCHAR_T_NON_NATIVE
+ * EA_WCHAR_SIZE = <n bytes>
+ *
+ * EA_RESTRICT
+ * EA_DEPRECATED / EA_PREFIX_DEPRECATED / EA_POSTFIX_DEPRECATED
+ * EA_FORCE_INLINE / EA_PREFIX_FORCE_INLINE / EA_POSTFIX_FORCE_INLINE
+ * EA_NO_INLINE / EA_PREFIX_NO_INLINE / EA_POSTFIX_NO_INLINE
+ * EA_NO_VTABLE / EA_CLASS_NO_VTABLE / EA_STRUCT_NO_VTABLE
+ * EA_PASCAL
+ * EA_PASCAL_FUNC()
+ * EA_SSE = [0 | 1]
+ * EA_IMPORT
+ * EA_EXPORT
+ * EA_PRAGMA_ONCE_SUPPORTED
+ * EA_ONCE
+ * EA_OVERRIDE
+ * EA_INHERITANCE_FINAL
+ * EA_SEALED
+ * EA_ABSTRACT
+ * EA_CONSTEXPR / EA_CONSTEXPR_OR_CONST
+ * EA_CONSTEXPR_IF
+ * EA_EXTERN_TEMPLATE
+ * EA_NOEXCEPT
+ * EA_NORETURN
+ * EA_CARRIES_DEPENDENCY
+ * EA_NON_COPYABLE / struct EANonCopyable
+ * EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+ * EA_SIGNED_RIGHT_SHIFT_IS_UNSIGNED
+ *
+ * EA_DISABLE_VC_WARNING / EA_RESTORE_VC_WARNING / EA_DISABLE_ALL_VC_WARNINGS / EA_RESTORE_ALL_VC_WARNINGS
+ * EA_DISABLE_GCC_WARNING / EA_RESTORE_GCC_WARNING
+ * EA_DISABLE_CLANG_WARNING / EA_RESTORE_CLANG_WARNING
+ * EA_DISABLE_SN_WARNING / EA_RESTORE_SN_WARNING / EA_DISABLE_ALL_SN_WARNINGS / EA_RESTORE_ALL_SN_WARNINGS
+ * EA_DISABLE_GHS_WARNING / EA_RESTORE_GHS_WARNING
+ * EA_DISABLE_EDG_WARNING / EA_RESTORE_EDG_WARNING
+ * EA_DISABLE_CW_WARNING / EA_RESTORE_CW_WARNING
+ *
+ * EA_DISABLE_DEFAULT_CTOR
+ * EA_DISABLE_COPY_CTOR
+ * EA_DISABLE_MOVE_CTOR
+ * EA_DISABLE_ASSIGNMENT_OPERATOR
+ * EA_DISABLE_MOVE_OPERATOR
+ *
+ * Todo:
+ * Find a way to reliably detect wchar_t size at preprocessor time and
+ * implement it below for EA_WCHAR_SIZE.
+ *
+ * Todo:
+ * Find out how to support EA_PASCAL and EA_PASCAL_FUNC for systems in
+ * which it hasn't yet been found out for.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_eacompilertraits_H
+#define INCLUDED_eacompilertraits_H
+
+ #include <EABase/config/eaplatform.h>
+ #include <EABase/config/eacompiler.h>
+
+
+ // Metrowerks uses #defines in its core C header files to define
+ // the kind of information we need below (e.g. C99 compatibility)
+
+
+
+ // Determine if this compiler is ANSI C compliant and if it is C99 compliant.
+ #if defined(__STDC__)
+ #define EA_COMPILER_IS_ANSIC 1 // The compiler claims to be ANSI C
+
+ // Is the compiler a C99 compiler or equivalent?
+ // From ISO/IEC 9899:1999:
+ // 6.10.8 Predefined macro names
+ // __STDC_VERSION__ The integer constant 199901L. (150)
+ //
+ // 150) This macro was not specified in ISO/IEC 9899:1990 and was
+ // specified as 199409L in ISO/IEC 9899/AMD1:1995. The intention
+ // is that this will remain an integer constant of type long int
+ // that is increased with each revision of this International Standard.
+ //
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+ #define EA_COMPILER_IS_C99 1
+ #endif
+
+ // Is the compiler a C11 compiler?
+ // From ISO/IEC 9899:2011:
+ // Page 176, 6.10.8.1 (Predefined macro names) :
+ // __STDC_VERSION__ The integer constant 201112L. (178)
+ //
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+ #define EA_COMPILER_IS_C11 1
+ #endif
+ #endif
+
+ // Some compilers (e.g. GCC) define __USE_ISOC99 if they are not
+ // strictly C99 compilers (or are simply C++ compilers) but are set
+ // to use C99 functionality. Metrowerks defines _MSL_C99 as 1 in
+ // this case, but 0 otherwise.
+ #if (defined(__USE_ISOC99) || (defined(_MSL_C99) && (_MSL_C99 == 1))) && !defined(EA_COMPILER_IS_C99)
+ #define EA_COMPILER_IS_C99 1
+ #endif
+
+ // Metrowerks defines C99 types (e.g. intptr_t) instrinsically when in C99 mode (-lang C99 on the command line).
+ #if (defined(_MSL_C99) && (_MSL_C99 == 1))
+ #define EA_COMPILER_HAS_C99_TYPES 1
+ #endif
+
+ #if defined(__GNUC__)
+ #if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 302) // Also, GCC defines _HAS_C9X.
+ #define EA_COMPILER_HAS_C99_TYPES 1 // The compiler is not necessarily a C99 compiler, but it defines C99 types.
+
+ #ifndef __STDC_LIMIT_MACROS
+ #define __STDC_LIMIT_MACROS 1
+ #endif
+
+ #ifndef __STDC_CONSTANT_MACROS
+ #define __STDC_CONSTANT_MACROS 1 // This tells the GCC compiler that we want it to use its native C99 types.
+ #endif
+ #endif
+ #endif
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1600)
+ #define EA_COMPILER_HAS_C99_TYPES 1
+ #endif
+
+ #ifdef __cplusplus
+ #define EA_COMPILER_IS_CPLUSPLUS 1
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_PREPROCESSOR_JOIN
+ //
+ // This macro joins the two arguments together, even when one of
+ // the arguments is itself a macro (see 16.3.1 in C++98 standard).
+ // This is often used to create a unique name with __LINE__.
+ //
+ // For example, this declaration:
+ // char EA_PREPROCESSOR_JOIN(unique_, __LINE__);
+ // expands to this:
+ // char unique_73;
+ //
+ // Note that all versions of MSVC++ up to at least version 7.1
+ // fail to properly compile macros that use __LINE__ in them
+ // when the "program database for edit and continue" option
+ // is enabled. The result is that __LINE__ gets converted to
+ // something like __LINE__(Var+37).
+ //
+ #ifndef EA_PREPROCESSOR_JOIN
+ #define EA_PREPROCESSOR_JOIN(a, b) EA_PREPROCESSOR_JOIN1(a, b)
+ #define EA_PREPROCESSOR_JOIN1(a, b) EA_PREPROCESSOR_JOIN2(a, b)
+ #define EA_PREPROCESSOR_JOIN2(a, b) a##b
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_STRINGIFY
+ //
+ // Example usage:
+ // printf("Line: %s", EA_STRINGIFY(__LINE__));
+ //
+ #ifndef EA_STRINGIFY
+ #define EA_STRINGIFY(x) EA_STRINGIFYIMPL(x)
+ #define EA_STRINGIFYIMPL(x) #x
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_IDENTITY
+ //
+ #ifndef EA_IDENTITY
+ #define EA_IDENTITY(x) x
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_COMPILER_MANAGED_CPP
+ // Defined if this is being compiled with Managed C++ extensions
+ #ifdef EA_COMPILER_MSVC
+ #if EA_COMPILER_VERSION >= 1300
+ #ifdef _MANAGED
+ #define EA_COMPILER_MANAGED_CPP 1
+ #endif
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_COMPILER_INTMAX_SIZE
+ //
+ // This is related to the concept of intmax_t uintmax_t, but is available
+ // in preprocessor form as opposed to compile-time form. At compile-time
+ // you can use intmax_t and uintmax_t to use the actual types.
+ //
+ #if defined(__GNUC__) && defined(__x86_64__)
+ #define EA_COMPILER_INTMAX_SIZE 16 // intmax_t is __int128_t (GCC extension) and is 16 bytes.
+ #else
+ #define EA_COMPILER_INTMAX_SIZE 8 // intmax_t is int64_t and is 8 bytes.
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_LPAREN / EA_RPAREN / EA_COMMA / EA_SEMI
+ //
+ // These are used for using special characters in macro-using expressions.
+ // Note that this macro intentionally uses (), as in some cases it can't
+ // work unless it does.
+ //
+ // Example usage:
+ // int x = SOME_MACRO(SomeTemplate<int EA_COMMA() int EACOMMA() char>);
+ //
+ #ifndef EA_LPAREN
+ #define EA_LPAREN() (
+ #endif
+ #ifndef EA_RPAREN
+ #define EA_RPAREN() )
+ #endif
+ #ifndef EA_COMMA
+ #define EA_COMMA() ,
+ #endif
+ #ifndef EA_SEMI
+ #define EA_SEMI() ;
+ #endif
+
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_OFFSETOF
+ // Implements a portable version of the non-standard offsetof macro.
+ //
+ // The offsetof macro is guaranteed to only work with POD types. However, we wish to use
+ // it for non-POD types but where we know that offsetof will still work for the cases
+ // in which we use it. GCC unilaterally gives a warning when using offsetof with a non-POD,
+ // even if the given usage happens to work. So we make a workaround version of offsetof
+ // here for GCC which has the same effect but tricks the compiler into not issuing the warning.
+ // The 65536 does the compiler fooling; the reinterpret_cast prevents the possibility of
+ // an overloaded operator& for the class getting in the way.
+ //
+ // Example usage:
+ // struct A{ int x; int y; };
+ // size_t n = EA_OFFSETOF(A, y);
+ //
+ #if defined(__GNUC__) // We can't use GCC 4's __builtin_offsetof because it mistakenly complains about non-PODs that are really PODs.
+ #define EA_OFFSETOF(struct_, member_) ((size_t)(((uintptr_t)&reinterpret_cast<const volatile char&>((((struct_*)65536)->member_))) - 65536))
+ #else
+ #define EA_OFFSETOF(struct_, member_) offsetof(struct_, member_)
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_SIZEOF_MEMBER
+ // Implements a portable way to determine the size of a member.
+ //
+ // The EA_SIZEOF_MEMBER simply returns the size of a member within a class or struct; member
+ // access rules still apply. We offer two approaches depending on the compiler's support for non-static member
+ // initializers although most C++11 compilers support this.
+ //
+ // Example usage:
+ // struct A{ int x; int y; };
+ // size_t n = EA_SIZEOF_MEMBER(A, y);
+ //
+ #ifndef EA_COMPILER_NO_EXTENDED_SIZEOF
+ #define EA_SIZEOF_MEMBER(struct_, member_) (sizeof(struct_::member_))
+ #else
+ #define EA_SIZEOF_MEMBER(struct_, member_) (sizeof(((struct_*)0)->member_))
+ #endif
+
+ // ------------------------------------------------------------------------
+ // alignment expressions
+ //
+ // Here we define
+ // EA_ALIGN_OF(type) // Returns size_t.
+ // EA_ALIGN_MAX_STATIC // The max align value that the compiler will respect for EA_ALIGN for static data (global and static variables). Some compilers allow high values, some allow no more than 8. EA_ALIGN_MIN is assumed to be 1.
+ // EA_ALIGN_MAX_AUTOMATIC // The max align value for automatic variables (variables declared as local to a function).
+ // EA_ALIGN(n) // Used as a prefix. n is byte alignment, with being a power of two. Most of the time you can use this and avoid using EA_PREFIX_ALIGN/EA_POSTFIX_ALIGN.
+ // EA_ALIGNED(t, v, n) // Type, variable, alignment. Used to align an instance. You should need this only for unusual compilers.
+ // EA_PACKED // Specifies that the given structure be packed (and not have its members aligned).
+ //
+ // Also we define the following for rare cases that it's needed.
+ // EA_PREFIX_ALIGN(n) // n is byte alignment, with being a power of two. You should need this only for unusual compilers.
+ // EA_POSTFIX_ALIGN(n) // Valid values for n are 1, 2, 4, 8, etc. You should need this only for unusual compilers.
+ //
+ // Example usage:
+ // size_t x = EA_ALIGN_OF(int); Non-aligned equivalents. Meaning
+ // EA_PREFIX_ALIGN(8) int x = 5; int x = 5; Align x on 8 for compilers that require prefix attributes. Can just use EA_ALIGN instead.
+ // EA_ALIGN(8) int x; int x; Align x on 8 for compilers that allow prefix attributes.
+ // int x EA_POSTFIX_ALIGN(8); int x; Align x on 8 for compilers that require postfix attributes.
+ // int x EA_POSTFIX_ALIGN(8) = 5; int x = 5; Align x on 8 for compilers that require postfix attributes.
+ // int x EA_POSTFIX_ALIGN(8)(5); int x(5); Align x on 8 for compilers that require postfix attributes.
+ // struct EA_PREFIX_ALIGN(8) X { int x; } EA_POSTFIX_ALIGN(8); struct X { int x; }; Define X as a struct which is aligned on 8 when used.
+ // EA_ALIGNED(int, x, 8) = 5; int x = 5; Align x on 8.
+ // EA_ALIGNED(int, x, 16)(5); int x(5); Align x on 16.
+ // EA_ALIGNED(int, x[3], 16); int x[3]; Align x array on 16.
+ // EA_ALIGNED(int, x[3], 16) = { 1, 2, 3 }; int x[3] = { 1, 2, 3 }; Align x array on 16.
+ // int x[3] EA_PACKED; int x[3]; Pack the 3 ints of the x array. GCC doesn't seem to support packing of int arrays.
+ // struct EA_ALIGN(32) X { int x; int y; }; struct X { int x; }; Define A as a struct which is aligned on 32 when used.
+ // EA_ALIGN(32) struct X { int x; int y; } Z; struct X { int x; } Z; Define A as a struct, and align the instance Z on 32.
+ // struct X { int x EA_PACKED; int y EA_PACKED; }; struct X { int x; int y; }; Pack the x and y members of struct X.
+ // struct X { int x; int y; } EA_PACKED; struct X { int x; int y; }; Pack the members of struct X.
+ // 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_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).
+ #elif defined(EA_PLATFORM_APPLE)
+ #define EA_ALIGN_MAX_STATIC 1048576
+ #define EA_ALIGN_MAX_AUTOMATIC 16
+ #else
+ #define EA_ALIGN_MAX_STATIC 1048576 // Arbitrarily high value. What is the actual max?
+ #define EA_ALIGN_MAX_AUTOMATIC 1048576
+ #endif
+ #endif
+
+ // EDG intends to be compatible with GCC but has a bug whereby it
+ // fails to support calling a constructor in an aligned declaration when
+ // using postfix alignment attributes. Prefix works for alignment, but does not align
+ // the size like postfix does. Prefix also fails on templates. So gcc style post fix
+ // is still used, but the user will need to use EA_POSTFIX_ALIGN before the constructor parameters.
+ #if defined(__GNUC__) && (__GNUC__ < 3)
+ #define EA_ALIGN_OF(type) ((size_t)__alignof__(type))
+ #define EA_ALIGN(n)
+ #define EA_PREFIX_ALIGN(n)
+ #define EA_POSTFIX_ALIGN(n) __attribute__((aligned(n)))
+ #define EA_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((aligned(n)))
+ #define EA_PACKED __attribute__((packed))
+
+ // GCC 3.x+, IBM, and clang support prefix attributes.
+ #elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__xlC__) || defined(__clang__)
+ #define EA_ALIGN_OF(type) ((size_t)__alignof__(type))
+ #define EA_ALIGN(n) __attribute__((aligned(n)))
+ #define EA_PREFIX_ALIGN(n)
+ #define EA_POSTFIX_ALIGN(n) __attribute__((aligned(n)))
+ #define EA_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((aligned(n)))
+ #define EA_PACKED __attribute__((packed))
+
+ // Metrowerks supports prefix attributes.
+ // Metrowerks does not support packed alignment attributes.
+ #elif defined(EA_COMPILER_INTEL) || defined(CS_UNDEFINED_STRING) || (defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1300))
+ #define EA_ALIGN_OF(type) ((size_t)__alignof(type))
+ #define EA_ALIGN(n) __declspec(align(n))
+ #define EA_PREFIX_ALIGN(n) EA_ALIGN(n)
+ #define EA_POSTFIX_ALIGN(n)
+ #define EA_ALIGNED(variable_type, variable, n) EA_ALIGN(n) variable_type variable
+ #define EA_PACKED // See EA_PRAGMA_PACK_VC for an alternative.
+
+ // Arm brand compiler
+ #elif defined(EA_COMPILER_ARM)
+ #define EA_ALIGN_OF(type) ((size_t)__ALIGNOF__(type))
+ #define EA_ALIGN(n) __align(n)
+ #define EA_PREFIX_ALIGN(n) __align(n)
+ #define EA_POSTFIX_ALIGN(n)
+ #define EA_ALIGNED(variable_type, variable, n) __align(n) variable_type variable
+ #define EA_PACKED __packed
+
+ #else // Unusual compilers
+ // There is nothing we can do about some of these. This is not as bad a problem as it seems.
+ // If the given platform/compiler doesn't support alignment specifications, then it's somewhat
+ // likely that alignment doesn't matter for that platform. Otherwise they would have defined
+ // functionality to manipulate alignment.
+ #define EA_ALIGN(n)
+ #define EA_PREFIX_ALIGN(n)
+ #define EA_POSTFIX_ALIGN(n)
+ #define EA_ALIGNED(variable_type, variable, n) variable_type variable
+ #define EA_PACKED
+
+ #ifdef __cplusplus
+ template <typename T> struct EAAlignOf1 { enum { s = sizeof (T), value = s ^ (s & (s - 1)) }; };
+ template <typename T> struct EAAlignOf2;
+ template <int size_diff> struct helper { template <typename T> struct Val { enum { value = size_diff }; }; };
+ template <> struct helper<0> { template <typename T> struct Val { enum { value = EAAlignOf2<T>::value }; }; };
+ template <typename T> struct EAAlignOf2 { struct Big { T x; char c; };
+ enum { diff = sizeof (Big) - sizeof (T), value = helper<diff>::template Val<Big>::value }; };
+ template <typename T> struct EAAlignof3 { enum { x = EAAlignOf2<T>::value, y = EAAlignOf1<T>::value, value = x < y ? x : y }; };
+ #define EA_ALIGN_OF(type) ((size_t)EAAlignof3<type>::value)
+
+ #else
+ // C implementation of EA_ALIGN_OF
+ // This implementation works for most cases, but doesn't directly work
+ // for types such as function pointer declarations. To work with those
+ // types you need to typedef the type and then use the typedef in EA_ALIGN_OF.
+ #define EA_ALIGN_OF(type) ((size_t)offsetof(struct { char c; type m; }, m))
+ #endif
+ #endif
+
+ // EA_PRAGMA_PACK_VC
+ //
+ // Wraps #pragma pack in a way that allows for cleaner code.
+ //
+ // Example usage:
+ // EA_PRAGMA_PACK_VC(push, 1)
+ // struct X{ char c; int i; };
+ // EA_PRAGMA_PACK_VC(pop)
+ //
+ #if !defined(EA_PRAGMA_PACK_VC)
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_PRAGMA_PACK_VC(...) __pragma(pack(__VA_ARGS__))
+ #elif !defined(EA_COMPILER_NO_VARIADIC_MACROS)
+ #define EA_PRAGMA_PACK_VC(...)
+ #else
+ // No support. However, all compilers of significance to us support variadic macros.
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_LIKELY / EA_UNLIKELY
+ //
+ // Defined as a macro which gives a hint to the compiler for branch
+ // prediction. GCC gives you the ability to manually give a hint to
+ // the compiler about the result of a comparison, though it's often
+ // best to compile shipping code with profiling feedback under both
+ // GCC (-fprofile-arcs) and VC++ (/LTCG:PGO, etc.). However, there
+ // are times when you feel very sure that a boolean expression will
+ // usually evaluate to either true or false and can help the compiler
+ // by using an explicity directive...
+ //
+ // Example usage:
+ // if(EA_LIKELY(a == 0)) // Tell the compiler that a will usually equal 0.
+ // { ... }
+ //
+ // Example usage:
+ // if(EA_UNLIKELY(a == 0)) // Tell the compiler that a will usually not equal 0.
+ // { ... }
+ //
+ #ifndef EA_LIKELY
+ #if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__)
+ #if defined(__cplusplus)
+ #define EA_LIKELY(x) __builtin_expect(!!(x), true)
+ #define EA_UNLIKELY(x) __builtin_expect(!!(x), false)
+ #else
+ #define EA_LIKELY(x) __builtin_expect(!!(x), 1)
+ #define EA_UNLIKELY(x) __builtin_expect(!!(x), 0)
+ #endif
+ #else
+ #define EA_LIKELY(x) (x)
+ #define EA_UNLIKELY(x) (x)
+ #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
+ //
+ // This value is either not defined, or defined to 1.
+ // Defines if the GCC attribute init_priority is supported by the compiler.
+ //
+ #if !defined(EA_INIT_PRIORITY_AVAILABLE)
+ #if defined(__GNUC__) && !defined(__EDG__) // EDG typically #defines __GNUC__ but doesn't implement init_priority.
+ #define EA_INIT_PRIORITY_AVAILABLE 1
+ #elif defined(__clang__)
+ #define EA_INIT_PRIORITY_AVAILABLE 1 // Clang implements init_priority
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_INIT_PRIORITY
+ //
+ // This is simply a wrapper for the GCC init_priority attribute that allows
+ // multiplatform code to be easier to read. This attribute doesn't apply
+ // to VC++ because VC++ uses file-level pragmas to control init ordering.
+ //
+ // Example usage:
+ // SomeClass gSomeClass EA_INIT_PRIORITY(2000);
+ //
+ #if !defined(EA_INIT_PRIORITY)
+ #if defined(EA_INIT_PRIORITY_AVAILABLE)
+ #define EA_INIT_PRIORITY(x) __attribute__ ((init_priority (x)))
+ #else
+ #define EA_INIT_PRIORITY(x)
+ #endif
+ #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
+ //
+ // Defined as 0, 1, or 2.
+ // Defines if the GCC attribute may_alias is supported by the compiler.
+ // Consists of a value 0 (unsupported, shouldn't be used), 1 (some support),
+ // or 2 (full proper support).
+ //
+ #ifndef EA_MAY_ALIAS_AVAILABLE
+ #if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
+ #if !defined(__EDG__) // define it as 1 while defining GCC's support as 2.
+ #define EA_MAY_ALIAS_AVAILABLE 2
+ #else
+ #define EA_MAY_ALIAS_AVAILABLE 0
+ #endif
+ #else
+ #define EA_MAY_ALIAS_AVAILABLE 0
+ #endif
+ #endif
+
+
+ // EA_MAY_ALIAS
+ //
+ // Defined as a macro that wraps the GCC may_alias attribute. This attribute
+ // has no significance for VC++ because VC++ doesn't support the concept of
+ // strict aliasing. Users should avoid writing code that breaks strict
+ // aliasing rules; EA_MAY_ALIAS is for cases with no alternative.
+ //
+ // Example usage:
+ // void* EA_MAY_ALIAS gPtr = NULL;
+ //
+ // Example usage:
+ // typedef void* EA_MAY_ALIAS pvoid_may_alias;
+ // pvoid_may_alias gPtr = NULL;
+ //
+ #if EA_MAY_ALIAS_AVAILABLE
+ #define EA_MAY_ALIAS __attribute__((__may_alias__))
+ #else
+ #define EA_MAY_ALIAS
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_ASSUME
+ //
+ // This acts the same as the VC++ __assume directive and is implemented
+ // simply as a wrapper around it to allow portable usage of it and to take
+ // advantage of it if and when it appears in other compilers.
+ //
+ // Example usage:
+ // void Function(int a) {
+ // switch(a) {
+ // case 1:
+ // DoSomething(1);
+ // break;
+ // case 2:
+ // DoSomething(-1);
+ // break;
+ // default:
+ // EA_ASSUME(0); // This tells the optimizer that the default cannot be reached.
+ // }
+ // }
+ //
+ #ifndef EA_ASSUME
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300) // If VC7.0 and later
+ #define EA_ASSUME(x) __assume(x)
+ #else
+ #define EA_ASSUME(x)
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_ANALYSIS_ASSUME
+ //
+ // This acts the same as the VC++ __analysis_assume directive and is implemented
+ // simply as a wrapper around it to allow portable usage of it and to take
+ // advantage of it if and when it appears in other compilers.
+ //
+ // Example usage:
+ // char Function(char* p) {
+ // EA_ANALYSIS_ASSUME(p != NULL);
+ // return *p;
+ // }
+ //
+ #ifndef EA_ANALYSIS_ASSUME
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300) // If VC7.0 and later
+ #define EA_ANALYSIS_ASSUME(x) __analysis_assume(!!(x)) // !! because that allows for convertible-to-bool in addition to bool.
+ #else
+ #define EA_ANALYSIS_ASSUME(x)
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_VC_WARNING / EA_RESTORE_VC_WARNING
+ //
+ // Disable and re-enable warning(s) within code.
+ // This is simply a wrapper for VC++ #pragma warning(disable: nnnn) for the
+ // purpose of making code easier to read due to avoiding nested compiler ifdefs
+ // directly in code.
+ //
+ // Example usage:
+ // EA_DISABLE_VC_WARNING(4127 3244)
+ // <code>
+ // EA_RESTORE_VC_WARNING()
+ //
+ #ifndef EA_DISABLE_VC_WARNING
+ #if defined(_MSC_VER)
+ #define EA_DISABLE_VC_WARNING(w) \
+ __pragma(warning(push)) \
+ __pragma(warning(disable:w))
+ #else
+ #define EA_DISABLE_VC_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_RESTORE_VC_WARNING
+ #if defined(_MSC_VER)
+ #define EA_RESTORE_VC_WARNING() \
+ __pragma(warning(pop))
+ #else
+ #define EA_RESTORE_VC_WARNING()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_ENABLE_VC_WARNING_AS_ERROR / EA_DISABLE_VC_WARNING_AS_ERROR
+ //
+ // Disable and re-enable treating a warning as error within code.
+ // This is simply a wrapper for VC++ #pragma warning(error: nnnn) for the
+ // purpose of making code easier to read due to avoiding nested compiler ifdefs
+ // directly in code.
+ //
+ // Example usage:
+ // EA_ENABLE_VC_WARNING_AS_ERROR(4996)
+ // <code>
+ // EA_DISABLE_VC_WARNING_AS_ERROR()
+ //
+ #ifndef EA_ENABLE_VC_WARNING_AS_ERROR
+ #if defined(_MSC_VER)
+ #define EA_ENABLE_VC_WARNING_AS_ERROR(w) \
+ __pragma(warning(push)) \
+ __pragma(warning(error:w))
+ #else
+ #define EA_ENABLE_VC_WARNING_AS_ERROR(w)
+ #endif
+ #endif
+
+ #ifndef EA_DISABLE_VC_WARNING_AS_ERROR
+ #if defined(_MSC_VER)
+ #define EA_DISABLE_VC_WARNING_AS_ERROR() \
+ __pragma(warning(pop))
+ #else
+ #define EA_DISABLE_VC_WARNING_AS_ERROR()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_GCC_WARNING / EA_RESTORE_GCC_WARNING
+ //
+ // Example usage:
+ // // Only one warning can be ignored per statement, due to how GCC works.
+ // EA_DISABLE_GCC_WARNING(-Wuninitialized)
+ // EA_DISABLE_GCC_WARNING(-Wunused)
+ // <code>
+ // EA_RESTORE_GCC_WARNING()
+ // EA_RESTORE_GCC_WARNING()
+ //
+ #ifndef EA_DISABLE_GCC_WARNING
+ #if defined(EA_COMPILER_GNUC)
+ #define EAGCCWHELP0(x) #x
+ #define EAGCCWHELP1(x) EAGCCWHELP0(GCC diagnostic ignored x)
+ #define EAGCCWHELP2(x) EAGCCWHELP1(#x)
+ #endif
+
+ #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006) // Can't test directly for __GNUC__ because some compilers lie.
+ #define EA_DISABLE_GCC_WARNING(w) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma(EAGCCWHELP2(w))
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
+ #define EA_DISABLE_GCC_WARNING(w) \
+ _Pragma(EAGCCWHELP2(w))
+ #else
+ #define EA_DISABLE_GCC_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_RESTORE_GCC_WARNING
+ #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
+ #define EA_RESTORE_GCC_WARNING() \
+ _Pragma("GCC diagnostic pop")
+ #else
+ #define EA_RESTORE_GCC_WARNING()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_GCC_WARNINGS / EA_RESTORE_ALL_GCC_WARNINGS
+ //
+ // This isn't possible except via using _Pragma("GCC system_header"), though
+ // that has some limitations in how it works. Another means is to manually
+ // disable individual warnings within a GCC diagnostic push statement.
+ // GCC doesn't have as many warnings as VC++ and EDG and so this may be feasible.
+ // ------------------------------------------------------------------------
+
+
+ // ------------------------------------------------------------------------
+ // EA_ENABLE_GCC_WARNING_AS_ERROR / EA_DISABLE_GCC_WARNING_AS_ERROR
+ //
+ // Example usage:
+ // // Only one warning can be treated as an error per statement, due to how GCC works.
+ // EA_ENABLE_GCC_WARNING_AS_ERROR(-Wuninitialized)
+ // EA_ENABLE_GCC_WARNING_AS_ERROR(-Wunused)
+ // <code>
+ // EA_DISABLE_GCC_WARNING_AS_ERROR()
+ // EA_DISABLE_GCC_WARNING_AS_ERROR()
+ //
+ #ifndef EA_ENABLE_GCC_WARNING_AS_ERROR
+ #if defined(EA_COMPILER_GNUC)
+ #define EAGCCWERRORHELP0(x) #x
+ #define EAGCCWERRORHELP1(x) EAGCCWERRORHELP0(GCC diagnostic error x)
+ #define EAGCCWERRORHELP2(x) EAGCCWERRORHELP1(#x)
+ #endif
+
+ #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006) // Can't test directly for __GNUC__ because some compilers lie.
+ #define EA_ENABLE_GCC_WARNING_AS_ERROR(w) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma(EAGCCWERRORHELP2(w))
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
+ #define EA_DISABLE_GCC_WARNING(w) \
+ _Pragma(EAGCCWERRORHELP2(w))
+ #else
+ #define EA_DISABLE_GCC_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_DISABLE_GCC_WARNING_AS_ERROR
+ #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
+ #define EA_DISABLE_GCC_WARNING_AS_ERROR() \
+ _Pragma("GCC diagnostic pop")
+ #else
+ #define EA_DISABLE_GCC_WARNING_AS_ERROR()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_CLANG_WARNING / EA_RESTORE_CLANG_WARNING
+ //
+ // Example usage:
+ // // Only one warning can be ignored per statement, due to how clang works.
+ // EA_DISABLE_CLANG_WARNING(-Wuninitialized)
+ // EA_DISABLE_CLANG_WARNING(-Wunused)
+ // <code>
+ // EA_RESTORE_CLANG_WARNING()
+ // EA_RESTORE_CLANG_WARNING()
+ //
+ #ifndef EA_DISABLE_CLANG_WARNING
+ #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
+ #define EACLANGWHELP0(x) #x
+ #define EACLANGWHELP1(x) EACLANGWHELP0(clang diagnostic ignored x)
+ #define EACLANGWHELP2(x) EACLANGWHELP1(#x)
+
+ #define EA_DISABLE_CLANG_WARNING(w) \
+ _Pragma("clang diagnostic push") \
+ _Pragma(EACLANGWHELP2(-Wunknown-warning-option))\
+ _Pragma(EACLANGWHELP2(w))
+ #else
+ #define EA_DISABLE_CLANG_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_RESTORE_CLANG_WARNING
+ #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
+ #define EA_RESTORE_CLANG_WARNING() \
+ _Pragma("clang diagnostic pop")
+ #else
+ #define EA_RESTORE_CLANG_WARNING()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_CLANG_WARNINGS / EA_RESTORE_ALL_CLANG_WARNINGS
+ //
+ // The situation for clang is the same as for GCC. See above.
+ // ------------------------------------------------------------------------
+
+
+ // ------------------------------------------------------------------------
+ // EA_ENABLE_CLANG_WARNING_AS_ERROR / EA_DISABLE_CLANG_WARNING_AS_ERROR
+ //
+ // Example usage:
+ // // Only one warning can be treated as an error per statement, due to how clang works.
+ // EA_ENABLE_CLANG_WARNING_AS_ERROR(-Wuninitialized)
+ // EA_ENABLE_CLANG_WARNING_AS_ERROR(-Wunused)
+ // <code>
+ // EA_DISABLE_CLANG_WARNING_AS_ERROR()
+ // EA_DISABLE_CLANG_WARNING_AS_ERROR()
+ //
+ #ifndef EA_ENABLE_CLANG_WARNING_AS_ERROR
+ #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
+ #define EACLANGWERRORHELP0(x) #x
+ #define EACLANGWERRORHELP1(x) EACLANGWERRORHELP0(clang diagnostic error x)
+ #define EACLANGWERRORHELP2(x) EACLANGWERRORHELP1(#x)
+
+ #define EA_ENABLE_CLANG_WARNING_AS_ERROR(w) \
+ _Pragma("clang diagnostic push") \
+ _Pragma(EACLANGWERRORHELP2(w))
+ #else
+ #define EA_DISABLE_CLANG_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_DISABLE_CLANG_WARNING_AS_ERROR
+ #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
+ #define EA_DISABLE_CLANG_WARNING_AS_ERROR() \
+ _Pragma("clang diagnostic pop")
+ #else
+ #define EA_DISABLE_CLANG_WARNING_AS_ERROR()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_SN_WARNING / EA_RESTORE_SN_WARNING
+ //
+ // Note that we define this macro specifically for the SN compiler instead of
+ // having a generic one for EDG-based compilers. The reason for this is that
+ // while SN is indeed based on EDG, SN has different warning value mappings
+ // and thus warning 1234 for SN is not the same as 1234 for all other EDG compilers.
+ //
+ // Example usage:
+ // // Currently we are limited to one warning per line.
+ // EA_DISABLE_SN_WARNING(1787)
+ // EA_DISABLE_SN_WARNING(552)
+ // <code>
+ // EA_RESTORE_SN_WARNING()
+ // EA_RESTORE_SN_WARNING()
+ //
+ #ifndef EA_DISABLE_SN_WARNING
+ #define EA_DISABLE_SN_WARNING(w)
+ #endif
+
+ #ifndef EA_RESTORE_SN_WARNING
+ #define EA_RESTORE_SN_WARNING()
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_SN_WARNINGS / EA_RESTORE_ALL_SN_WARNINGS
+ //
+ // Example usage:
+ // EA_DISABLE_ALL_SN_WARNINGS()
+ // <code>
+ // EA_RESTORE_ALL_SN_WARNINGS()
+ //
+ #ifndef EA_DISABLE_ALL_SN_WARNINGS
+ #define EA_DISABLE_ALL_SN_WARNINGS()
+ #endif
+
+ #ifndef EA_RESTORE_ALL_SN_WARNINGS
+ #define EA_RESTORE_ALL_SN_WARNINGS()
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_GHS_WARNING / EA_RESTORE_GHS_WARNING
+ //
+ // Disable warnings from the Green Hills compiler.
+ //
+ // Example usage:
+ // EA_DISABLE_GHS_WARNING(193)
+ // EA_DISABLE_GHS_WARNING(236, 5323)
+ // <code>
+ // EA_RESTORE_GHS_WARNING()
+ // EA_RESTORE_GHS_WARNING()
+ //
+ #ifndef EA_DISABLE_GHS_WARNING
+ #define EA_DISABLE_GHS_WARNING(w)
+ #endif
+
+ #ifndef EA_RESTORE_GHS_WARNING
+ #define EA_RESTORE_GHS_WARNING()
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_GHS_WARNINGS / EA_RESTORE_ALL_GHS_WARNINGS
+ //
+ // #ifndef EA_DISABLE_ALL_GHS_WARNINGS
+ // #if defined(EA_COMPILER_GREEN_HILLS)
+ // #define EA_DISABLE_ALL_GHS_WARNINGS(w) \_
+ // _Pragma("_________")
+ // #else
+ // #define EA_DISABLE_ALL_GHS_WARNINGS(w)
+ // #endif
+ // #endif
+ //
+ // #ifndef EA_RESTORE_ALL_GHS_WARNINGS
+ // #if defined(EA_COMPILER_GREEN_HILLS)
+ // #define EA_RESTORE_ALL_GHS_WARNINGS() \_
+ // _Pragma("_________")
+ // #else
+ // #define EA_RESTORE_ALL_GHS_WARNINGS()
+ // #endif
+ // #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_EDG_WARNING / EA_RESTORE_EDG_WARNING
+ //
+ // Example usage:
+ // // Currently we are limited to one warning per line.
+ // EA_DISABLE_EDG_WARNING(193)
+ // EA_DISABLE_EDG_WARNING(236)
+ // <code>
+ // EA_RESTORE_EDG_WARNING()
+ // EA_RESTORE_EDG_WARNING()
+ //
+ #ifndef EA_DISABLE_EDG_WARNING
+ // EDG-based compilers are inconsistent in how the implement warning pragmas.
+ #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_INTEL) && !defined(EA_COMPILER_RVCT)
+ #define EAEDGWHELP0(x) #x
+ #define EAEDGWHELP1(x) EAEDGWHELP0(diag_suppress x)
+
+ #define EA_DISABLE_EDG_WARNING(w) \
+ _Pragma("control %push diag") \
+ _Pragma(EAEDGWHELP1(w))
+ #else
+ #define EA_DISABLE_EDG_WARNING(w)
+ #endif
+ #endif
+
+ #ifndef EA_RESTORE_EDG_WARNING
+ #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_INTEL) && !defined(EA_COMPILER_RVCT)
+ #define EA_RESTORE_EDG_WARNING() \
+ _Pragma("control %pop diag")
+ #else
+ #define EA_RESTORE_EDG_WARNING()
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_EDG_WARNINGS / EA_RESTORE_ALL_EDG_WARNINGS
+ //
+ //#ifndef EA_DISABLE_ALL_EDG_WARNINGS
+ // #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_SN)
+ // #define EA_DISABLE_ALL_EDG_WARNINGS(w) \_
+ // _Pragma("_________")
+ // #else
+ // #define EA_DISABLE_ALL_EDG_WARNINGS(w)
+ // #endif
+ //#endif
+ //
+ //#ifndef EA_RESTORE_ALL_EDG_WARNINGS
+ // #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_SN)
+ // #define EA_RESTORE_ALL_EDG_WARNINGS() \_
+ // _Pragma("_________")
+ // #else
+ // #define EA_RESTORE_ALL_EDG_WARNINGS()
+ // #endif
+ //#endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_CW_WARNING / EA_RESTORE_CW_WARNING
+ //
+ // Note that this macro can only control warnings via numbers and not by
+ // names. The reason for this is that the compiler's syntax for such
+ // warnings is not the same as for numbers.
+ //
+ // Example usage:
+ // // Currently we are limited to one warning per line and must also specify the warning in the restore macro.
+ // EA_DISABLE_CW_WARNING(10317)
+ // EA_DISABLE_CW_WARNING(10324)
+ // <code>
+ // EA_RESTORE_CW_WARNING(10317)
+ // EA_RESTORE_CW_WARNING(10324)
+ //
+ #ifndef EA_DISABLE_CW_WARNING
+ #define EA_DISABLE_CW_WARNING(w)
+ #endif
+
+ #ifndef EA_RESTORE_CW_WARNING
+
+ #define EA_RESTORE_CW_WARNING(w)
+
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ALL_CW_WARNINGS / EA_RESTORE_ALL_CW_WARNINGS
+ //
+ #ifndef EA_DISABLE_ALL_CW_WARNINGS
+ #define EA_DISABLE_ALL_CW_WARNINGS()
+
+ #endif
+
+ #ifndef EA_RESTORE_ALL_CW_WARNINGS
+ #define EA_RESTORE_ALL_CW_WARNINGS()
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_PURE
+ //
+ // This acts the same as the GCC __attribute__ ((pure)) directive and is
+ // implemented simply as a wrapper around it to allow portable usage of
+ // it and to take advantage of it if and when it appears in other compilers.
+ //
+ // A "pure" function is one that has no effects except its return value and
+ // its return value is a function of only the function's parameters or
+ // non-volatile global variables. Any parameter or global variable access
+ // must be read-only. Loop optimization and subexpression elimination can be
+ // applied to such functions. A common example is strlen(): Given identical
+ // inputs, the function's return value (its only effect) is invariant across
+ // multiple invocations and thus can be pulled out of a loop and called but once.
+ //
+ // Example usage:
+ // EA_PURE void Function();
+ //
+ #ifndef EA_PURE
+ #if defined(EA_COMPILER_GNUC)
+ #define EA_PURE __attribute__((pure))
+ #elif defined(EA_COMPILER_ARM) // Arm brand compiler for ARM CPU
+ #define EA_PURE __pure
+ #else
+ #define EA_PURE
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_WEAK
+ // EA_WEAK_SUPPORTED -- defined as 0 or 1.
+ //
+ // GCC
+ // The weak attribute causes the declaration to be emitted as a weak
+ // symbol rather than a global. This is primarily useful in defining
+ // library functions which can be overridden in user code, though it
+ // can also be used with non-function declarations.
+ //
+ // VC++
+ // At link time, if multiple definitions of a COMDAT are seen, the linker
+ // picks one and discards the rest. If the linker option /OPT:REF
+ // is selected, then COMDAT elimination will occur to remove all the
+ // unreferenced data items in the linker output.
+ //
+ // Example usage:
+ // EA_WEAK void Function();
+ //
+ #ifndef EA_WEAK
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300) // If VC7.0 and later
+ #define EA_WEAK __declspec(selectany)
+ #define EA_WEAK_SUPPORTED 1
+ #elif defined(_MSC_VER) || (defined(__GNUC__) && defined(__CYGWIN__))
+ #define EA_WEAK
+ #define EA_WEAK_SUPPORTED 0
+ #elif defined(EA_COMPILER_ARM) // Arm brand compiler for ARM CPU
+ #define EA_WEAK __weak
+ #define EA_WEAK_SUPPORTED 1
+ #else // GCC and IBM compilers, others.
+ #define EA_WEAK __attribute__((weak))
+ #define EA_WEAK_SUPPORTED 1
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_UNUSED
+ //
+ // Makes compiler warnings about unused variables go away.
+ //
+ // Example usage:
+ // void Function(int x)
+ // {
+ // int y;
+ // EA_UNUSED(x);
+ // EA_UNUSED(y);
+ // }
+ //
+ #ifndef EA_UNUSED
+ // The EDG solution below is pretty weak and needs to be augmented or replaced.
+ // It can't handle the C language, is limited to places where template declarations
+ // can be used, and requires the type x to be usable as a functions reference argument.
+ #if defined(__cplusplus) && defined(__EDG__)
+ template <typename T>
+ inline void EABaseUnused(T const volatile & x) { (void)x; }
+ #define EA_UNUSED(x) EABaseUnused(x)
+ #else
+ #define EA_UNUSED(x) (void)x
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_EMPTY
+ //
+ // Allows for a null statement, usually for the purpose of avoiding compiler warnings.
+ //
+ // Example usage:
+ // #ifdef EA_DEBUG
+ // #define MyDebugPrintf(x, y) printf(x, y)
+ // #else
+ // #define MyDebugPrintf(x, y) EA_EMPTY
+ // #endif
+ //
+ #ifndef EA_EMPTY
+ #define EA_EMPTY (void)0
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_CURRENT_FUNCTION
+ //
+ // Provides a consistent way to get the current function name as a macro
+ // like the __FILE__ and __LINE__ macros work. The C99 standard specifies
+ // that __func__ be provided by the compiler, but most compilers don't yet
+ // follow that convention. However, many compilers have an alternative.
+ //
+ // We also define EA_CURRENT_FUNCTION_SUPPORTED for when it is not possible
+ // to have EA_CURRENT_FUNCTION work as expected.
+ //
+ // Defined inside a function because otherwise the macro might not be
+ // defined and code below might not compile. This happens with some
+ // compilers.
+ //
+ #ifndef EA_CURRENT_FUNCTION
+ #if defined __GNUC__ || (defined __ICC && __ICC >= 600)
+ #define EA_CURRENT_FUNCTION __PRETTY_FUNCTION__
+ #elif defined(__FUNCSIG__)
+ #define EA_CURRENT_FUNCTION __FUNCSIG__
+ #elif (defined __INTEL_COMPILER && __INTEL_COMPILER >= 600) || (defined __IBMCPP__ && __IBMCPP__ >= 500) || (defined CS_UNDEFINED_STRING && CS_UNDEFINED_STRING >= 0x4200)
+ #define EA_CURRENT_FUNCTION __FUNCTION__
+ #elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901
+ #define EA_CURRENT_FUNCTION __func__
+ #else
+ #define EA_CURRENT_FUNCTION "(unknown function)"
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // wchar_t
+ // Here we define:
+ // EA_WCHAR_T_NON_NATIVE
+ // EA_WCHAR_SIZE = <sizeof(wchar_t)>
+ //
+ #ifndef EA_WCHAR_T_NON_NATIVE
+ // Compilers that always implement wchar_t as native include:
+ // COMEAU, new SN, and other EDG-based compilers.
+ // GCC
+ // Borland
+ // SunPro
+ // IBM Visual Age
+ #if defined(EA_COMPILER_INTEL)
+ #if (EA_COMPILER_VERSION < 700)
+ #define EA_WCHAR_T_NON_NATIVE 1
+ #else
+ #if (!defined(_WCHAR_T_DEFINED) && !defined(_WCHAR_T))
+ #define EA_WCHAR_T_NON_NATIVE 1
+ #endif
+ #endif
+ #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
+ #elif defined(__EDG_VERSION__) && (!defined(_WCHAR_T) && (__EDG_VERSION__ < 400)) // EDG prior to v4 uses _WCHAR_T to indicate if wchar_t is native. v4+ may define something else, but we're not currently aware of it.
+ #define EA_WCHAR_T_NON_NATIVE 1
+ #endif
+ #endif
+
+ #ifndef EA_WCHAR_SIZE // If the user hasn't specified that it is a given size...
+ #if defined(__WCHAR_MAX__) // GCC defines this for most platforms.
+ #if (__WCHAR_MAX__ == 2147483647) || (__WCHAR_MAX__ == 4294967295)
+ #define EA_WCHAR_SIZE 4
+ #elif (__WCHAR_MAX__ == 32767) || (__WCHAR_MAX__ == 65535)
+ #define EA_WCHAR_SIZE 2
+ #elif (__WCHAR_MAX__ == 127) || (__WCHAR_MAX__ == 255)
+ #define EA_WCHAR_SIZE 1
+ #else
+ #define EA_WCHAR_SIZE 4
+ #endif
+ #elif defined(WCHAR_MAX) // The SN and Arm compilers define this.
+ #if (WCHAR_MAX == 2147483647) || (WCHAR_MAX == 4294967295)
+ #define EA_WCHAR_SIZE 4
+ #elif (WCHAR_MAX == 32767) || (WCHAR_MAX == 65535)
+ #define EA_WCHAR_SIZE 2
+ #elif (WCHAR_MAX == 127) || (WCHAR_MAX == 255)
+ #define EA_WCHAR_SIZE 1
+ #else
+ #define EA_WCHAR_SIZE 4
+ #endif
+ #elif defined(__WCHAR_BIT) // Green Hills (and other versions of EDG?) uses this.
+ #if (__WCHAR_BIT == 16)
+ #define EA_WCHAR_SIZE 2
+ #elif (__WCHAR_BIT == 32)
+ #define EA_WCHAR_SIZE 4
+ #elif (__WCHAR_BIT == 8)
+ #define EA_WCHAR_SIZE 1
+ #else
+ #define EA_WCHAR_SIZE 4
+ #endif
+ #elif defined(_WCMAX) // The SN and Arm compilers define this.
+ #if (_WCMAX == 2147483647) || (_WCMAX == 4294967295)
+ #define EA_WCHAR_SIZE 4
+ #elif (_WCMAX == 32767) || (_WCMAX == 65535)
+ #define EA_WCHAR_SIZE 2
+ #elif (_WCMAX == 127) || (_WCMAX == 255)
+ #define EA_WCHAR_SIZE 1
+ #else
+ #define EA_WCHAR_SIZE 4
+ #endif
+ #elif defined(EA_PLATFORM_UNIX)
+ // It is standard on Unix to have wchar_t be int32_t or uint32_t.
+ // All versions of GNUC default to a 32 bit wchar_t, but EA has used
+ // the -fshort-wchar GCC command line option to force it to 16 bit.
+ // If you know that the compiler is set to use a wchar_t of other than
+ // the default, you need to manually define EA_WCHAR_SIZE for the build.
+ #define EA_WCHAR_SIZE 4
+ #else
+ // It is standard on Windows to have wchar_t be uint16_t. GCC
+ // defines wchar_t as int by default. Electronic Arts has
+ // standardized on wchar_t being an unsigned 16 bit value on all
+ // console platforms. Given that there is currently no known way to
+ // tell at preprocessor time what the size of wchar_t is, we declare
+ // it to be 2, as this is the Electronic Arts standard. If you have
+ // EA_WCHAR_SIZE != sizeof(wchar_t), then your code might not be
+ // broken, but it also won't work with wchar libraries and data from
+ // other parts of EA. Under GCC, you can force wchar_t to two bytes
+ // with the -fshort-wchar compiler argument.
+ #define EA_WCHAR_SIZE 2
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_RESTRICT
+ //
+ // The C99 standard defines a new keyword, restrict, which allows for the
+ // improvement of code generation regarding memory usage. Compilers can
+ // generate significantly faster code when you are able to use restrict.
+ //
+ // Example usage:
+ // void DoSomething(char* EA_RESTRICT p1, char* EA_RESTRICT p2);
+ //
+ #ifndef EA_RESTRICT
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400) // If VC8 (VS2005) or later...
+ #define EA_RESTRICT __restrict
+ #elif defined(EA_COMPILER_CLANG)
+ #define EA_RESTRICT __restrict
+ #elif defined(EA_COMPILER_GNUC) // Includes GCC and other compilers emulating GCC.
+ #define EA_RESTRICT __restrict // GCC defines 'restrict' (as opposed to __restrict) in C99 mode only.
+ #elif defined(EA_COMPILER_ARM)
+ #define EA_RESTRICT __restrict
+ #elif defined(EA_COMPILER_IS_C99)
+ #define EA_RESTRICT restrict
+ #else
+ // If the compiler didn't support restricted pointers, defining EA_RESTRICT
+ // away would result in compiling and running fine but you just wouldn't
+ // the same level of optimization. On the other hand, all the major compilers
+ // support restricted pointers.
+ #define EA_RESTRICT
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_DEPRECATED // Used as a prefix.
+ // EA_PREFIX_DEPRECATED // You should need this only for unusual compilers.
+ // EA_POSTFIX_DEPRECATED // You should need this only for unusual compilers.
+ // EA_DEPRECATED_MESSAGE // Used as a prefix and provides a deprecation message.
+ //
+ // Example usage:
+ // EA_DEPRECATED void Function();
+ // EA_DEPRECATED_MESSAGE("Use 1.0v API instead") void Function();
+ //
+ // or for maximum portability:
+ // EA_PREFIX_DEPRECATED void Function() EA_POSTFIX_DEPRECATED;
+ //
+
+ #ifndef EA_DEPRECATED
+ #if defined(EA_COMPILER_CPP14_ENABLED)
+ #define EA_DEPRECATED [[deprecated]]
+ #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION > 1300) // If VC7 (VS2003) or later...
+ #define EA_DEPRECATED __declspec(deprecated)
+ #elif defined(EA_COMPILER_MSVC)
+ #define EA_DEPRECATED
+ #else
+ #define EA_DEPRECATED __attribute__((deprecated))
+ #endif
+ #endif
+
+ #ifndef EA_PREFIX_DEPRECATED
+ #if defined(EA_COMPILER_CPP14_ENABLED)
+ #define EA_PREFIX_DEPRECATED [[deprecated]]
+ #define EA_POSTFIX_DEPRECATED
+ #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION > 1300) // If VC7 (VS2003) or later...
+ #define EA_PREFIX_DEPRECATED __declspec(deprecated)
+ #define EA_POSTFIX_DEPRECATED
+ #elif defined(EA_COMPILER_MSVC)
+ #define EA_PREFIX_DEPRECATED
+ #define EA_POSTFIX_DEPRECATED
+ #else
+ #define EA_PREFIX_DEPRECATED
+ #define EA_POSTFIX_DEPRECATED __attribute__((deprecated))
+ #endif
+ #endif
+
+ #ifndef EA_DEPRECATED_MESSAGE
+ #if defined(EA_COMPILER_CPP14_ENABLED)
+ #define EA_DEPRECATED_MESSAGE(msg) [[deprecated(#msg)]]
+ #else
+ // Compiler does not support depreaction messages, explicitly drop the msg but still mark the function as deprecated
+ #define EA_DEPRECATED_MESSAGE(msg) EA_DEPRECATED
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_FORCE_INLINE // Used as a prefix.
+ // EA_PREFIX_FORCE_INLINE // You should need this only for unusual compilers.
+ // EA_POSTFIX_FORCE_INLINE // You should need this only for unusual compilers.
+ //
+ // Example usage:
+ // EA_FORCE_INLINE void Foo(); // Implementation elsewhere.
+ // EA_PREFIX_FORCE_INLINE void Foo() EA_POSTFIX_FORCE_INLINE; // Implementation elsewhere.
+ //
+ // Note that when the prefix version of this function is used, it replaces
+ // the regular C++ 'inline' statement. Thus you should not use both the
+ // C++ inline statement and this macro with the same function declaration.
+ //
+ // To force inline usage under GCC 3.1+, you use this:
+ // inline void Foo() __attribute__((always_inline));
+ // or
+ // inline __attribute__((always_inline)) void Foo();
+ //
+ // The CodeWarrior compiler doesn't have the concept of forcing inlining per function.
+ //
+ #ifndef EA_FORCE_INLINE
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_FORCE_INLINE __forceinline
+ #elif defined(EA_COMPILER_GNUC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 301) || defined(EA_COMPILER_CLANG)
+ #if defined(__cplusplus)
+ #define EA_FORCE_INLINE inline __attribute__((always_inline))
+ #else
+ #define EA_FORCE_INLINE __inline__ __attribute__((always_inline))
+ #endif
+ #else
+ #if defined(__cplusplus)
+ #define EA_FORCE_INLINE inline
+ #else
+ #define EA_FORCE_INLINE __inline
+ #endif
+ #endif
+ #endif
+
+ #if defined(EA_COMPILER_GNUC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 301) || defined(EA_COMPILER_CLANG)
+ #define EA_PREFIX_FORCE_INLINE inline
+ #define EA_POSTFIX_FORCE_INLINE __attribute__((always_inline))
+ #else
+ #define EA_PREFIX_FORCE_INLINE inline
+ #define EA_POSTFIX_FORCE_INLINE
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_FORCE_INLINE_LAMBDA
+ //
+ // EA_FORCE_INLINE_LAMBDA is used to force inline a call to a lambda when possible.
+ // Force inlining a lambda can be useful to reduce overhead in situations where a lambda may
+ // may only be called once, or inlining allows the compiler to apply other optimizations that wouldn't
+ // otherwise be possible.
+ //
+ // The ability to force inline a lambda is currently only available on a subset of compilers.
+ //
+ // Example usage:
+ //
+ // auto lambdaFunction = []() EA_FORCE_INLINE_LAMBDA
+ // {
+ // };
+ //
+ #ifndef EA_FORCE_INLINE_LAMBDA
+ #if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG)
+ #define EA_FORCE_INLINE_LAMBDA __attribute__((always_inline))
+ #else
+ #define EA_FORCE_INLINE_LAMBDA
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NO_INLINE // Used as a prefix.
+ // EA_PREFIX_NO_INLINE // You should need this only for unusual compilers.
+ // EA_POSTFIX_NO_INLINE // You should need this only for unusual compilers.
+ //
+ // Example usage:
+ // EA_NO_INLINE void Foo(); // Implementation elsewhere.
+ // EA_PREFIX_NO_INLINE void Foo() EA_POSTFIX_NO_INLINE; // Implementation elsewhere.
+ //
+ // That this declaration is incompatbile with C++ 'inline' and any
+ // variant of EA_FORCE_INLINE.
+ //
+ // To disable inline usage under VC++ priof to VS2005, you need to use this:
+ // #pragma inline_depth(0) // Disable inlining.
+ // void Foo() { ... }
+ // #pragma inline_depth() // Restore to default.
+ //
+ // Since there is no easy way to disable inlining on a function-by-function
+ // basis in VC++ prior to VS2005, the best strategy is to write platform-specific
+ // #ifdefs in the code or to disable inlining for a given module and enable
+ // functions individually with EA_FORCE_INLINE.
+ //
+ #ifndef EA_NO_INLINE
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400) // If VC8 (VS2005) or later...
+ #define EA_NO_INLINE __declspec(noinline)
+ #elif defined(EA_COMPILER_MSVC)
+ #define EA_NO_INLINE
+ #else
+ #define EA_NO_INLINE __attribute__((noinline))
+ #endif
+ #endif
+
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400) // If VC8 (VS2005) or later...
+ #define EA_PREFIX_NO_INLINE __declspec(noinline)
+ #define EA_POSTFIX_NO_INLINE
+ #elif defined(EA_COMPILER_MSVC)
+ #define EA_PREFIX_NO_INLINE
+ #define EA_POSTFIX_NO_INLINE
+ #else
+ #define EA_PREFIX_NO_INLINE
+ #define EA_POSTFIX_NO_INLINE __attribute__((noinline))
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NO_VTABLE
+ //
+ // Example usage:
+ // class EA_NO_VTABLE X {
+ // virtual void InterfaceFunction();
+ // };
+ //
+ // EA_CLASS_NO_VTABLE(X) {
+ // virtual void InterfaceFunction();
+ // };
+ //
+ #ifdef EA_COMPILER_MSVC
+ #define EA_NO_VTABLE __declspec(novtable)
+ #define EA_CLASS_NO_VTABLE(x) class __declspec(novtable) x
+ #define EA_STRUCT_NO_VTABLE(x) struct __declspec(novtable) x
+ #else
+ #define EA_NO_VTABLE
+ #define EA_CLASS_NO_VTABLE(x) class x
+ #define EA_STRUCT_NO_VTABLE(x) struct x
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_PASCAL
+ //
+ // Also known on PC platforms as stdcall.
+ // This convention causes the compiler to assume that the called function
+ // will pop off the stack space used to pass arguments, unless it takes a
+ // variable number of arguments.
+ //
+ // Example usage:
+ // this:
+ // void DoNothing(int x);
+ // void DoNothing(int x){}
+ // would be written as this:
+ // void EA_PASCAL_FUNC(DoNothing(int x));
+ // void EA_PASCAL_FUNC(DoNothing(int x)){}
+ //
+ #ifndef EA_PASCAL
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_PASCAL __stdcall
+ #elif defined(EA_COMPILER_GNUC) && defined(EA_PROCESSOR_X86)
+ #define EA_PASCAL __attribute__((stdcall))
+ #else
+ // Some compilers simply don't support pascal calling convention.
+ // As a result, there isn't an issue here, since the specification of
+ // pascal calling convention is for the purpose of disambiguating the
+ // calling convention that is applied.
+ #define EA_PASCAL
+ #endif
+ #endif
+
+ #ifndef EA_PASCAL_FUNC
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_PASCAL_FUNC(funcname_and_paramlist) __stdcall funcname_and_paramlist
+ #elif defined(EA_COMPILER_GNUC) && defined(EA_PROCESSOR_X86)
+ #define EA_PASCAL_FUNC(funcname_and_paramlist) __attribute__((stdcall)) funcname_and_paramlist
+ #else
+ #define EA_PASCAL_FUNC(funcname_and_paramlist) funcname_and_paramlist
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_SSE
+ // Visual C Processor Packs define _MSC_FULL_VER and are needed for SSE
+ // Intel C also has SSE support.
+ // EA_SSE is used to select FPU or SSE versions in hw_select.inl
+ //
+ // EA_SSE defines the level of SSE support:
+ // 0 indicates no SSE support
+ // 1 indicates SSE1 is supported
+ // 2 indicates SSE2 is supported
+ // 3 indicates SSE3 (or greater) is supported
+ //
+ // Note: SSE support beyond SSE3 can't be properly represented as a single
+ // version number. Instead users should use specific SSE defines (e.g.
+ // EA_SSE4_2) to detect what specific support is available. EA_SSE being
+ // equal to 3 really only indicates that SSE3 or greater is supported.
+ #ifndef EA_SSE
+ #if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG)
+ #if defined(__SSE3__)
+ #define EA_SSE 3
+ #elif defined(__SSE2__)
+ #define EA_SSE 2
+ #elif defined(__SSE__) && __SSE__
+ #define EA_SSE 1
+ #else
+ #define EA_SSE 0
+ #endif
+ #elif (defined(EA_SSE3) && EA_SSE3) || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_SSE 3
+ #elif defined(EA_SSE2) && EA_SSE2
+ #define EA_SSE 2
+ #elif defined(EA_PROCESSOR_X86) && defined(_MSC_FULL_VER) && !defined(__NOSSE__) && defined(_M_IX86_FP)
+ #define EA_SSE _M_IX86_FP
+ #elif defined(EA_PROCESSOR_X86) && defined(EA_COMPILER_INTEL) && !defined(__NOSSE__)
+ #define EA_SSE 1
+ #elif defined(EA_PROCESSOR_X86_64)
+ // All x64 processors support SSE2 or higher
+ #define EA_SSE 2
+ #else
+ #define EA_SSE 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // We define separate defines for SSE support beyond SSE1. These defines
+ // are particularly useful for detecting SSE4.x features since there isn't
+ // a single concept of SSE4.
+ //
+ // The following SSE defines are always defined. 0 indicates the
+ // feature/level of SSE is not supported, and 1 indicates support is
+ // available.
+ #ifndef EA_SSE2
+ #if EA_SSE >= 2
+ #define EA_SSE2 1
+ #else
+ #define EA_SSE2 0
+ #endif
+ #endif
+ #ifndef EA_SSE3
+ #if EA_SSE >= 3
+ #define EA_SSE3 1
+ #else
+ #define EA_SSE3 0
+ #endif
+ #endif
+ #ifndef EA_SSSE3
+ #if defined __SSSE3__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_SSSE3 1
+ #else
+ #define EA_SSSE3 0
+ #endif
+ #endif
+ #ifndef EA_SSE4_1
+ #if defined __SSE4_1__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_SSE4_1 1
+ #else
+ #define EA_SSE4_1 0
+ #endif
+ #endif
+ #ifndef EA_SSE4_2
+ #if defined __SSE4_2__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_SSE4_2 1
+ #else
+ #define EA_SSE4_2 0
+ #endif
+ #endif
+ #ifndef EA_SSE4A
+ #if defined __SSE4A__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_SSE4A 1
+ #else
+ #define EA_SSE4A 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_AVX
+ // EA_AVX may be used to determine if Advanced Vector Extensions are available for the target architecture
+ //
+ // EA_AVX defines the level of AVX support:
+ // 0 indicates no AVX support
+ // 1 indicates AVX1 is supported
+ // 2 indicates AVX2 is supported
+ #ifndef EA_AVX
+ #if defined __AVX2__
+ #define EA_AVX 2
+ #elif defined __AVX__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_AVX 1
+ #else
+ #define EA_AVX 0
+ #endif
+ #endif
+ #ifndef EA_AVX2
+ #if EA_AVX >= 2
+ #define EA_AVX2 1
+ #else
+ #define EA_AVX2 0
+ #endif
+ #endif
+
+ // EA_FP16C may be used to determine the existence of float <-> half conversion operations on an x86 CPU.
+ // (For example to determine if _mm_cvtph_ps or _mm_cvtps_ph could be used.)
+ #ifndef EA_FP16C
+ #if defined __F16C__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
+ #define EA_FP16C 1
+ #else
+ #define EA_FP16C 0
+ #endif
+ #endif
+
+ // EA_FP128 may be used to determine if __float128 is a supported type for use. This type is enabled by a GCC extension (_GLIBCXX_USE_FLOAT128)
+ // but has support by some implementations of clang (__FLOAT128__)
+ // PS4 does not support __float128 as of SDK 5.500 https://ps4.siedev.net/resources/documents/SDK/5.500/CPU_Compiler_ABI-Overview/0003.html
+ #ifndef EA_FP128
+ #if (defined __FLOAT128__ || defined _GLIBCXX_USE_FLOAT128) && !defined(EA_PLATFORM_SONY)
+ #define EA_FP128 1
+ #else
+ #define EA_FP128 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_ABM
+ // EA_ABM may be used to determine if Advanced Bit Manipulation sets are available for the target architecture (POPCNT, LZCNT)
+ //
+ #ifndef EA_ABM
+ #if defined(__ABM__) || defined(EA_PLATFORM_XBOXONE) || defined(EA_PLATFORM_SONY) || defined(CS_UNDEFINED_STRING)
+ #define EA_ABM 1
+ #else
+ #define EA_ABM 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_NEON
+ // EA_NEON may be used to determine if NEON is supported.
+ #ifndef EA_NEON
+ #if defined(__ARM_NEON__) || defined(__ARM_NEON)
+ #define EA_NEON 1
+ #else
+ #define EA_NEON 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_BMI
+ // EA_BMI may be used to determine if Bit Manipulation Instruction sets are available for the target architecture
+ //
+ // EA_BMI defines the level of BMI support:
+ // 0 indicates no BMI support
+ // 1 indicates BMI1 is supported
+ // 2 indicates BMI2 is supported
+ #ifndef EA_BMI
+ #if defined(__BMI2__)
+ #define EA_BMI 2
+ #elif defined(__BMI__) || defined(EA_PLATFORM_XBOXONE) || defined(CS_UNDEFINED_STRING)
+ #define EA_BMI 1
+ #else
+ #define EA_BMI 0
+ #endif
+ #endif
+ #ifndef EA_BMI2
+ #if EA_BMI >= 2
+ #define EA_BMI2 1
+ #else
+ #define EA_BMI2 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_FMA3
+ // EA_FMA3 may be used to determine if Fused Multiply Add operations are available for the target architecture
+ // __FMA__ is defined only by GCC, Clang, and ICC; MSVC only defines __AVX__ and __AVX2__
+ // FMA3 was introduced alongside AVX2 on Intel Haswell
+ // All AMD processors support FMA3 if AVX2 is also supported
+ //
+ // EA_FMA3 defines the level of FMA3 support:
+ // 0 indicates no FMA3 support
+ // 1 indicates FMA3 is supported
+ #ifndef EA_FMA3
+ #if defined(__FMA__) || EA_AVX2 >= 1
+ #define EA_FMA3 1
+ #else
+ #define EA_FMA3 0
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_TBM
+ // EA_TBM may be used to determine if Trailing Bit Manipulation instructions are available for the target architecture
+ #ifndef EA_TBM
+ #if defined(__TBM__)
+ #define EA_TBM 1
+ #else
+ #define EA_TBM 0
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_IMPORT
+ // import declaration specification
+ // specifies that the declared symbol is imported from another dynamic library.
+ #ifndef EA_IMPORT
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_IMPORT __declspec(dllimport)
+ #else
+ #define EA_IMPORT
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_EXPORT
+ // export declaration specification
+ // specifies that the declared symbol is exported from the current dynamic library.
+ // this is not the same as the C++ export keyword. The C++ export keyword has been
+ // removed from the language as of C++11.
+ #ifndef EA_EXPORT
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_EXPORT __declspec(dllexport)
+ #else
+ #define EA_EXPORT
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_PRAGMA_ONCE_SUPPORTED
+ //
+ // This is a wrapper for the #pragma once preprocessor directive.
+ // It allows for some compilers (in particular VC++) to implement signifcantly
+ // faster include file preprocessing. #pragma once can be used to replace
+ // header include guards or to augment them. However, #pragma once isn't
+ // necessarily supported by all compilers and isn't guaranteed to be so in
+ // the future, so using #pragma once to replace traditional include guards
+ // is not strictly portable. Note that a direct #define for #pragma once is
+ // impossible with VC++, due to limitations, but can be done with other
+ // compilers/preprocessors via _Pragma("once").
+ //
+ // Example usage (which includes traditional header guards for portability):
+ // #ifndef SOMEPACKAGE_SOMEHEADER_H
+ // #define SOMEPACKAGE_SOMEHEADER_H
+ //
+ // #if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ // #pragma once
+ // #endif
+ //
+ // <user code>
+ //
+ // #endif
+ //
+ #if defined(_MSC_VER) || defined(__GNUC__) || defined(__EDG__) || defined(__APPLE__)
+ #define EA_PRAGMA_ONCE_SUPPORTED 1
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_ONCE
+ //
+ // Example usage (which includes traditional header guards for portability):
+ // #ifndef SOMEPACKAGE_SOMEHEADER_H
+ // #define SOMEPACKAGE_SOMEHEADER_H
+ //
+ // EA_ONCE()
+ //
+ // <user code>
+ //
+ // #endif
+ //
+ #if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #if defined(_MSC_VER)
+ #define EA_ONCE() __pragma(once)
+ #else
+ #define EA_ONCE() // _Pragma("once") It turns out that _Pragma("once") isn't supported by many compilers.
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_OVERRIDE
+ //
+ // C++11 override
+ // See http://msdn.microsoft.com/en-us/library/jj678987.aspx for more information.
+ // You can use EA_FINAL_OVERRIDE to combine usage of EA_OVERRIDE and EA_INHERITANCE_FINAL in a single statement.
+ //
+ // Example usage:
+ // struct B { virtual void f(int); };
+ // struct D : B { void f(int) EA_OVERRIDE; };
+ //
+ #ifndef EA_OVERRIDE
+ #if defined(EA_COMPILER_NO_OVERRIDE)
+ #define EA_OVERRIDE
+ #else
+ #define EA_OVERRIDE override
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_INHERITANCE_FINAL
+ //
+ // Portably wraps the C++11 final specifier.
+ // See http://msdn.microsoft.com/en-us/library/jj678985.aspx for more information.
+ // You can use EA_FINAL_OVERRIDE to combine usage of EA_OVERRIDE and EA_INHERITANCE_FINAL in a single statement.
+ // This is not called EA_FINAL because that term is used within EA to denote debug/release/final builds.
+ //
+ // Example usage:
+ // struct B { virtual void f() EA_INHERITANCE_FINAL; };
+ //
+ #ifndef EA_INHERITANCE_FINAL
+ #if defined(EA_COMPILER_NO_INHERITANCE_FINAL)
+ #define EA_INHERITANCE_FINAL
+ #elif (defined(_MSC_VER) && (EA_COMPILER_VERSION < 1700)) // Pre-VS2012
+ #define EA_INHERITANCE_FINAL sealed
+ #else
+ #define EA_INHERITANCE_FINAL final
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_FINAL_OVERRIDE
+ //
+ // Portably wraps the C++11 override final specifiers combined.
+ //
+ // Example usage:
+ // struct A { virtual void f(); };
+ // struct B : public A { virtual void f() EA_FINAL_OVERRIDE; };
+ //
+ #ifndef EA_FINAL_OVERRIDE
+ #define EA_FINAL_OVERRIDE EA_OVERRIDE EA_INHERITANCE_FINAL
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_SEALED
+ //
+ // This is deprecated, as the C++11 Standard has final (EA_INHERITANCE_FINAL) instead.
+ // See http://msdn.microsoft.com/en-us/library/0w2w91tf.aspx for more information.
+ // Example usage:
+ // struct B { virtual void f() EA_SEALED; };
+ //
+ #ifndef EA_SEALED
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400) // VS2005 (VC8) and later
+ #define EA_SEALED sealed
+ #else
+ #define EA_SEALED
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_ABSTRACT
+ //
+ // This is a Microsoft language extension.
+ // See http://msdn.microsoft.com/en-us/library/b0z6b513.aspx for more information.
+ // Example usage:
+ // struct X EA_ABSTRACT { virtual void f(){} };
+ //
+ #ifndef EA_ABSTRACT
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400) // VS2005 (VC8) and later
+ #define EA_ABSTRACT abstract
+ #else
+ #define EA_ABSTRACT
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_CONSTEXPR
+ // EA_CONSTEXPR_OR_CONST
+ //
+ // Portable wrapper for C++11's 'constexpr' support.
+ //
+ // See http://www.cprogramming.com/c++11/c++11-compile-time-processing-with-constexpr.html for more information.
+ // Example usage:
+ // EA_CONSTEXPR int GetValue() { return 37; }
+ // EA_CONSTEXPR_OR_CONST double gValue = std::sin(kTwoPi);
+ //
+ #if !defined(EA_CONSTEXPR)
+ #if defined(EA_COMPILER_NO_CONSTEXPR)
+ #define EA_CONSTEXPR
+ #else
+ #define EA_CONSTEXPR constexpr
+ #endif
+ #endif
+
+ #if !defined(EA_CONSTEXPR_OR_CONST)
+ #if defined(EA_COMPILER_NO_CONSTEXPR)
+ #define EA_CONSTEXPR_OR_CONST const
+ #else
+ #define EA_CONSTEXPR_OR_CONST constexpr
+ #endif
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_CONSTEXPR_IF
+ //
+ // Portable wrapper for C++17's 'constexpr if' support.
+ //
+ // https://en.cppreference.com/w/cpp/language/if
+ //
+ // Example usage:
+ //
+ // EA_CONSTEXPR_IF(eastl::is_copy_constructible_v<T>)
+ // { ... }
+ //
+ #if !defined(EA_CONSTEXPR_IF)
+ #if defined(EA_COMPILER_NO_CONSTEXPR_IF)
+ #define EA_CONSTEXPR_IF(predicate) if ((predicate))
+ #else
+ #define EA_CONSTEXPR_IF(predicate) if constexpr ((predicate))
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_EXTERN_TEMPLATE
+ //
+ // Portable wrapper for C++11's 'extern template' support.
+ //
+ // Example usage:
+ // EA_EXTERN_TEMPLATE(class basic_string<char>);
+ //
+ #if !defined(EA_EXTERN_TEMPLATE)
+ #if defined(EA_COMPILER_NO_EXTERN_TEMPLATE)
+ #define EA_EXTERN_TEMPLATE(declaration)
+ #else
+ #define EA_EXTERN_TEMPLATE(declaration) extern template declaration
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NOEXCEPT
+ // EA_NOEXCEPT_IF(predicate)
+ // EA_NOEXCEPT_EXPR(expression)
+ //
+ // Portable wrapper for C++11 noexcept
+ // http://en.cppreference.com/w/cpp/language/noexcept
+ // http://en.cppreference.com/w/cpp/language/noexcept_spec
+ //
+ // Example usage:
+ // EA_NOEXCEPT
+ // EA_NOEXCEPT_IF(predicate)
+ // EA_NOEXCEPT_EXPR(expression)
+ //
+ // This function never throws an exception.
+ // void DoNothing() EA_NOEXCEPT
+ // { }
+ //
+ // This function throws an exception of T::T() throws an exception.
+ // template <class T>
+ // void DoNothing() EA_NOEXCEPT_IF(EA_NOEXCEPT_EXPR(T()))
+ // { T t; }
+ //
+ #if !defined(EA_NOEXCEPT)
+ #if defined(EA_COMPILER_NO_NOEXCEPT)
+ #define EA_NOEXCEPT
+ #define EA_NOEXCEPT_IF(predicate)
+ #define EA_NOEXCEPT_EXPR(expression) false
+ #else
+ #define EA_NOEXCEPT noexcept
+ #define EA_NOEXCEPT_IF(predicate) noexcept((predicate))
+ #define EA_NOEXCEPT_EXPR(expression) noexcept((expression))
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NORETURN
+ //
+ // Wraps the C++11 noreturn attribute. See EA_COMPILER_NO_NORETURN
+ // http://en.cppreference.com/w/cpp/language/attributes
+ // http://msdn.microsoft.com/en-us/library/k6ktzx3s%28v=vs.80%29.aspx
+ // http://blog.aaronballman.com/2011/09/understanding-attributes/
+ //
+ // Example usage:
+ // EA_NORETURN void SomeFunction()
+ // { throw "error"; }
+ //
+ #if !defined(EA_NORETURN)
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1300) // VS2003 (VC7) and later
+ #define EA_NORETURN __declspec(noreturn)
+ #elif defined(EA_COMPILER_NO_NORETURN)
+ #define EA_NORETURN
+ #else
+ #define EA_NORETURN [[noreturn]]
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_CARRIES_DEPENDENCY
+ //
+ // Wraps the C++11 carries_dependency attribute
+ // http://en.cppreference.com/w/cpp/language/attributes
+ // http://blog.aaronballman.com/2011/09/understanding-attributes/
+ //
+ // Example usage:
+ // EA_CARRIES_DEPENDENCY int* SomeFunction()
+ // { return &mX; }
+ //
+ //
+ #if !defined(EA_CARRIES_DEPENDENCY)
+ #if defined(EA_COMPILER_NO_CARRIES_DEPENDENCY)
+ #define EA_CARRIES_DEPENDENCY
+ #else
+ #define EA_CARRIES_DEPENDENCY [[carries_dependency]]
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_FALLTHROUGH
+ //
+ // [[fallthrough] is a C++17 standard attribute that appears in switch
+ // statements to indicate that the fallthrough from the previous case in the
+ // switch statement is intentially and not a bug.
+ //
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ // Example usage:
+ // void f(int n)
+ // {
+ // switch(n)
+ // {
+ // case 1:
+ // DoCase1();
+ // // Compiler may generate a warning for fallthrough behaviour
+ //
+ // case 2:
+ // DoCase2();
+ //
+ // EA_FALLTHROUGH;
+ // case 3:
+ // DoCase3();
+ // }
+ // }
+ //
+ #if !defined(EA_FALLTHROUGH)
+ #if defined(EA_COMPILER_NO_FALLTHROUGH)
+ #define EA_FALLTHROUGH
+ #else
+ #define EA_FALLTHROUGH [[fallthrough]]
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_NODISCARD
+ //
+ // [[nodiscard]] is a C++17 standard attribute that can be applied to a
+ // function declaration, enum, or class declaration. If a any of the list
+ // previously are returned from a function (without the user explicitly
+ // casting to void) the addition of the [[nodiscard]] attribute encourages
+ // the compiler to generate a warning about the user discarding the return
+ // value. This is a useful practice to encourage client code to check API
+ // error codes.
+ //
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ // Example usage:
+ //
+ // EA_NODISCARD int baz() { return 42; }
+ //
+ // void foo()
+ // {
+ // baz(); // warning: ignoring return value of function declared with 'nodiscard' attribute
+ // }
+ //
+ #if !defined(EA_NODISCARD)
+ #if defined(EA_COMPILER_NO_NODISCARD)
+ #define EA_NODISCARD
+ #else
+ #define EA_NODISCARD [[nodiscard]]
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_MAYBE_UNUSED
+ //
+ // [[maybe_unused]] is a C++17 standard attribute that suppresses warnings
+ // on unused entities that are declared as maybe_unused.
+ //
+ // http://en.cppreference.com/w/cpp/language/attributes
+ //
+ // Example usage:
+ // void foo(EA_MAYBE_UNUSED int i)
+ // {
+ // assert(i == 42); // warning suppressed when asserts disabled.
+ // }
+ //
+ #if !defined(EA_MAYBE_UNUSED)
+ #if defined(EA_COMPILER_NO_MAYBE_UNUSED)
+ #define EA_MAYBE_UNUSED
+ #else
+ #define EA_MAYBE_UNUSED [[maybe_unused]]
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NO_UBSAN
+ //
+ // The LLVM/Clang undefined behaviour sanitizer will not analyse a function tagged with the following attribute.
+ //
+ // https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#disabling-instrumentation-with-attribute-no-sanitize-undefined
+ //
+ // Example usage:
+ // EA_NO_UBSAN int SomeFunction() { ... }
+ //
+ #ifndef EA_NO_UBSAN
+ #if defined(EA_COMPILER_CLANG)
+ #define EA_NO_UBSAN __attribute__((no_sanitize("undefined")))
+ #else
+ #define EA_NO_UBSAN
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NO_ASAN
+ //
+ // The LLVM/Clang address sanitizer will not analyse a function tagged with the following attribute.
+ //
+ // https://clang.llvm.org/docs/AddressSanitizer.html#disabling-instrumentation-with-attribute-no-sanitize-address
+ //
+ // Example usage:
+ // EA_NO_ASAN int SomeFunction() { ... }
+ //
+ #ifndef EA_NO_ASAN
+ #if defined(EA_COMPILER_CLANG)
+ #define EA_NO_ASAN __attribute__((no_sanitize("address")))
+ #else
+ #define EA_NO_ASAN
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_ASAN_ENABLED
+ //
+ // Defined as 0 or 1. It's value depends on the compile environment.
+ // Specifies whether the code is being built with Clang's Address Sanitizer.
+ //
+ #if defined(__has_feature)
+ #if __has_feature(address_sanitizer)
+ #define EA_ASAN_ENABLED 1
+ #else
+ #define EA_ASAN_ENABLED 0
+ #endif
+ #else
+ #define EA_ASAN_ENABLED 0
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_NON_COPYABLE
+ //
+ // This macro defines as a class as not being copy-constructable
+ // or assignable. This is useful for preventing class instances
+ // from being passed to functions by value, is useful for preventing
+ // compiler warnings by some compilers about the inability to
+ // auto-generate a copy constructor and assignment, and is useful
+ // for simply declaring in the interface that copy semantics are
+ // not supported by the class. Your class needs to have at least a
+ // default constructor when using this macro.
+ //
+ // Beware that this class works by declaring a private: section of
+ // the class in the case of compilers that don't support C++11 deleted
+ // functions.
+ //
+ // Note: With some pre-C++11 compilers (e.g. Green Hills), you may need
+ // to manually define an instances of the hidden functions, even
+ // though they are not used.
+ //
+ // Example usage:
+ // class Widget {
+ // Widget();
+ // . . .
+ // EA_NON_COPYABLE(Widget)
+ // };
+ //
+ #if !defined(EA_NON_COPYABLE)
+ #if defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
+ #define EA_NON_COPYABLE(EAClass_) \
+ private: \
+ EA_DISABLE_VC_WARNING(4822); /* local class member function does not have a body */ \
+ EAClass_(const EAClass_&); \
+ void operator=(const EAClass_&); \
+ EA_RESTORE_VC_WARNING();
+ #else
+ #define EA_NON_COPYABLE(EAClass_) \
+ EA_DISABLE_VC_WARNING(4822); /* local class member function does not have a body */ \
+ EAClass_(const EAClass_&) = delete; \
+ void operator=(const EAClass_&) = delete; \
+ EA_RESTORE_VC_WARNING();
+ #endif
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_FUNCTION_DELETE
+ //
+ // Semi-portable way of specifying a deleted function which allows for
+ // cleaner code in class declarations.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private: // For portability with pre-C++11 compilers, make the function private.
+ // void foo() EA_FUNCTION_DELETE;
+ // };
+ //
+ // Note: EA_FUNCTION_DELETE'd functions should be private to prevent the
+ // functions from being called even when the compiler does not support
+ // deleted functions. Some compilers (e.g. Green Hills) that don't support
+ // C++11 deleted functions can require that you define the function,
+ // which you can do in the associated source file for the class.
+ //
+ #if defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
+ #define EA_FUNCTION_DELETE
+ #else
+ #define EA_FUNCTION_DELETE = delete
+ #endif
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_DEFAULT_CTOR
+ //
+ // Disables the compiler generated default constructor. This macro is
+ // provided to improve portability and clarify intent of code.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private:
+ // EA_DISABLE_DEFAULT_CTOR(Example);
+ // };
+ //
+ #define EA_DISABLE_DEFAULT_CTOR(ClassName) ClassName() EA_FUNCTION_DELETE
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_COPY_CTOR
+ //
+ // Disables the compiler generated copy constructor. This macro is
+ // provided to improve portability and clarify intent of code.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private:
+ // EA_DISABLE_COPY_CTOR(Example);
+ // };
+ //
+ #define EA_DISABLE_COPY_CTOR(ClassName) ClassName(const ClassName &) EA_FUNCTION_DELETE
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_MOVE_CTOR
+ //
+ // Disables the compiler generated move constructor. This macro is
+ // provided to improve portability and clarify intent of code.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private:
+ // EA_DISABLE_MOVE_CTOR(Example);
+ // };
+ //
+ #define EA_DISABLE_MOVE_CTOR(ClassName) ClassName(ClassName&&) EA_FUNCTION_DELETE
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_ASSIGNMENT_OPERATOR
+ //
+ // Disables the compiler generated assignment operator. This macro is
+ // provided to improve portability and clarify intent of code.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private:
+ // EA_DISABLE_ASSIGNMENT_OPERATOR(Example);
+ // };
+ //
+ #define EA_DISABLE_ASSIGNMENT_OPERATOR(ClassName) ClassName & operator=(const ClassName &) EA_FUNCTION_DELETE
+
+ // ------------------------------------------------------------------------
+ // EA_DISABLE_MOVE_OPERATOR
+ //
+ // Disables the compiler generated move operator. This macro is
+ // provided to improve portability and clarify intent of code.
+ //
+ // Example usage:
+ //
+ // class Example
+ // {
+ // private:
+ // EA_DISABLE_MOVE_OPERATOR(Example);
+ // };
+ //
+ #define EA_DISABLE_MOVE_OPERATOR(ClassName) ClassName & operator=(ClassName&&) EA_FUNCTION_DELETE
+
+ // ------------------------------------------------------------------------
+ // EANonCopyable
+ //
+ // Declares a class as not supporting copy construction or assignment.
+ // May be more reliable with some situations that EA_NON_COPYABLE alone,
+ // though it may result in more code generation.
+ //
+ // Note that VC++ will generate warning C4625 and C4626 if you use EANonCopyable
+ // and you are compiling with /W4 and /Wall. There is no resolution but
+ // to redelare EA_NON_COPYABLE in your subclass or disable the warnings with
+ // code like this:
+ // EA_DISABLE_VC_WARNING(4625 4626)
+ // ...
+ // EA_RESTORE_VC_WARNING()
+ //
+ // Example usage:
+ // struct Widget : EANonCopyable {
+ // . . .
+ // };
+ //
+ #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).
+ #else
+ EANonCopyable() = default;
+ ~EANonCopyable() = default;
+ #endif
+
+ EA_NON_COPYABLE(EANonCopyable)
+ };
+ #endif
+
+
+ // ------------------------------------------------------------------------
+ // EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+ //
+ // Implements portable inline optimization enabling/disabling.
+ // Usage of these macros must be in order OFF then ON. This is
+ // because the OFF macro pushes a set of settings and the ON
+ // macro pops them. The nesting of OFF/ON sets (e.g. OFF, OFF, ON, ON)
+ // is not guaranteed to work on all platforms.
+ //
+ // This is often used to allow debugging of some code that's
+ // otherwise compiled with undebuggable optimizations. It's also
+ // useful for working around compiler code generation problems
+ // that occur in optimized builds.
+ //
+ // Some compilers (e.g. VC++) don't allow doing this within a function and
+ // so the usage must be outside a function, as with the example below.
+ // GCC on x86 appears to have some problem with argument passing when
+ // using EA_OPTIMIZE_OFF in optimized builds.
+ //
+ // Example usage:
+ // // Disable optimizations for SomeFunction.
+ // EA_OPTIMIZE_OFF()
+ // void SomeFunction()
+ // {
+ // ...
+ // }
+ // EA_OPTIMIZE_ON()
+ //
+ #if !defined(EA_OPTIMIZE_OFF)
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_OPTIMIZE_OFF() __pragma(optimize("", off))
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION > 4004) && (defined(__i386__) || defined(__x86_64__)) // GCC 4.4+ - Seems to work only on x86/Linux so far. However, GCC 4.4 itself appears broken and screws up parameter passing conventions.
+ #define EA_OPTIMIZE_OFF() \
+ _Pragma("GCC push_options") \
+ _Pragma("GCC optimize 0")
+ #elif defined(EA_COMPILER_CLANG) && (!defined(EA_PLATFORM_ANDROID) || (EA_COMPILER_VERSION >= 380))
+ #define EA_OPTIMIZE_OFF() \
+ EA_DISABLE_CLANG_WARNING(-Wunknown-pragmas) \
+ _Pragma("clang optimize off") \
+ EA_RESTORE_CLANG_WARNING()
+ #else
+ #define EA_OPTIMIZE_OFF()
+ #endif
+ #endif
+
+ #if !defined(EA_OPTIMIZE_ON)
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_OPTIMIZE_ON() __pragma(optimize("", on))
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION > 4004) && (defined(__i386__) || defined(__x86_64__)) // GCC 4.4+ - Seems to work only on x86/Linux so far. However, GCC 4.4 itself appears broken and screws up parameter passing conventions.
+ #define EA_OPTIMIZE_ON() _Pragma("GCC pop_options")
+ #elif defined(EA_COMPILER_CLANG) && (!defined(EA_PLATFORM_ANDROID) || (EA_COMPILER_VERSION >= 380))
+ #define EA_OPTIMIZE_ON() \
+ EA_DISABLE_CLANG_WARNING(-Wunknown-pragmas) \
+ _Pragma("clang optimize on") \
+ EA_RESTORE_CLANG_WARNING()
+ #else
+ #define EA_OPTIMIZE_ON()
+ #endif
+ #endif
+
+
+
+ // ------------------------------------------------------------------------
+ // EA_SIGNED_RIGHT_SHIFT_IS_UNSIGNED
+ //
+ // Defined if right shifts of signed integers (i.e. arithmetic shifts) fail
+ // to propogate the high bit downward, and thus preserve sign. Most hardware
+ // and their corresponding compilers do this.
+ //
+ // <No current platform fails to propogate sign bits on right signed shifts>
+
+#endif // Header include guard
+
+
+
+
+
+
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/config/eaplatform.h b/EASTL/test/packages/EABase/include/Common/EABase/config/eaplatform.h
new file mode 100644
index 0000000..37c1350
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/config/eaplatform.h
@@ -0,0 +1,738 @@
+/*-----------------------------------------------------------------------------
+ * config/eaplatform.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *-----------------------------------------------------------------------------
+ * Currently supported platform indentification defines include:
+ */
+#ifdef EA_PLATFORM_PS4 // ifdef for code stripping purposes
+// EA_PLATFORM_PS4 (EA_PLATFORM_KETTLE)
+#endif
+#ifdef EA_PLATFORM_XBOXONE // ifdef for code stripping purposes
+ // EA_PLATFORM_XBOXONE (EA_PLATFORM_CAPILANO)
+ // EA_PLATFORM_XBOXONE_XDK (EA_PLATFORM_CAPILANO_XDK), set by capilano_config package
+ // EA_PLATFORM_XBOXONE_ADK (EA_PLATFORM_CAPILANO_ADK), set by capilano_config package
+#endif
+// EA_PLATFORM_ANDROID
+// EA_PLATFORM_APPLE
+// EA_PLATFORM_IPHONE
+// EA_PLATFORM_IPHONE_SIMULATOR
+// EA_PLATFORM_OSX
+// EA_PLATFORM_LINUX
+// EA_PLATFORM_SAMSUNG_TV
+// EA_PLATFORM_WINDOWS
+// EA_PLATFORM_WIN32
+// EA_PLATFORM_WIN64
+// EA_PLATFORM_WINDOWS_PHONE
+// EA_PLATFORM_WINRT
+// EA_PLATFORM_SUN
+// EA_PLATFORM_LRB (Larrabee)
+// EA_PLATFORM_POSIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX, EA_PLATFORM_UNIX, EA_PLATFORM_QNX)
+// EA_PLATFORM_UNIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
+// EA_PLATFORM_CYGWIN (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
+// EA_PLATFORM_MINGW (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
+// EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
+//
+// EA_ABI_ARM_LINUX (a.k.a. "eabi". for all platforms that use the CodeSourcery GNU/Linux toolchain, like Android)
+// EA_ABI_ARM_APPLE (similar to eabi but not identical)
+// EA_ABI_ARM64_APPLE (similar to eabi but not identical) https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
+// EA_ABI_ARM_WINCE (similar to eabi but not identical)
+//
+// Other definitions emanated from this file inclue:
+// EA_PLATFORM_NAME = <string>
+// EA_PLATFORM_DESCRIPTION = <string>
+// EA_PROCESSOR_XXX
+// EA_MISALIGNED_SUPPORT_LEVEL=0|1|2
+// EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN
+// EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA
+// EA_PLATFORM_PTR_SIZE = <integer size in bytes>
+// EA_PLATFORM_WORD_SIZE = <integer size in bytes>
+// EA_CACHE_LINE_SIZE = <integer size in bytes>
+//---------------------------------------------------------------------------
+
+/*
+ EA_PLATFORM_MOBILE
+ EA_PLATFORM_MOBILE is a peer to EA_PLATORM_DESKTOP and EA_PLATFORM_CONSOLE. Their definition is qualitative rather
+ than quantitative, and refers to the general (usually weaker) capabilities of the machine. Mobile devices have a
+ similar set of weaknesses that are useful to generally categorize. The primary motivation is to avoid code that
+ tests for multiple mobile platforms on a line and needs to be updated every time we get a new one.
+ For example, mobile platforms tend to have weaker ARM processors, don't have full multiple processor support,
+ are hand-held, don't have mice (though may have touch screens or basic cursor controls), have writable solid
+ state permanent storage. Production user code shouldn't have too many expectations about the meaning of this define.
+
+ EA_PLATFORM_DESKTOP
+ This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are powerful.
+ For example, they nearly always have virtual memory, mapped memory, hundreds of GB of writable disk storage,
+ TCP/IP network connections, mice, keyboards, 512+ MB of RAM, multiprocessing, multiple display support.
+ Production user code shouldn't have too many expectations about the meaning of this define.
+
+ EA_PLATFORM_CONSOLE
+ This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are consoles.
+ This means platforms that are connected to TVs, are fairly powerful (especially graphics-wise), are tightly
+ controlled by vendors, tend not to have mapped memory, tend to have TCP/IP, don't have multiple process support
+ though they might have multiple CPUs, support TV output only. Production user code shouldn't have too many
+ expectations about the meaning of this define.
+
+*/
+
+
+#ifndef INCLUDED_eaplatform_H
+#define INCLUDED_eaplatform_H
+
+
+// Cygwin
+// This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when
+// using the Cygwin build environment.
+#if defined(__CYGWIN__)
+ #define EA_PLATFORM_CYGWIN 1
+ #define EA_PLATFORM_DESKTOP 1
+#endif
+
+// MinGW
+// This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when
+// using the MinGW Windows build environment.
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ #define EA_PLATFORM_MINGW 1
+ #define EA_PLATFORM_DESKTOP 1
+#endif
+
+#if defined(EA_PLATFORM_PS4) || defined(__ORBIS__) || defined(EA_PLATFORM_KETTLE)
+ // PlayStation 4
+ // Orbis was Sony's code-name for the platform, which is now obsolete.
+ // Kettle was an EA-specific code-name for the platform, which is now obsolete.
+ #if defined(EA_PLATFORM_PS4)
+ #undef EA_PLATFORM_PS4
+ #endif
+ #define EA_PLATFORM_PS4 1
+
+ // Backward compatibility:
+ #if defined(EA_PLATFORM_KETTLE)
+ #undef EA_PLATFORM_KETTLE
+ #endif
+ // End backward compatbility
+
+ #define EA_PLATFORM_KETTLE 1
+ #define EA_PLATFORM_NAME "PS4"
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "PS4 on x64"
+ #define EA_PLATFORM_CONSOLE 1
+ #define EA_PLATFORM_SONY 1
+ #define EA_PLATFORM_POSIX 1
+ // #define EA_POSIX_THREADS_AVAILABLE 1 // POSIX threading API is available but discouraged. Sony indicated use of the scePthreads* API is preferred.
+ #define EA_PROCESSOR_X86_64 1
+ #if defined(__GNUC__) || defined(__clang__)
+ #define EA_ASM_STYLE_ATT 1
+ #endif
+
+#elif defined(EA_PLATFORM_XBOXONE) || defined(_DURANGO) || defined(_XBOX_ONE) || defined(EA_PLATFORM_CAPILANO) || defined(_GAMING_XBOX)
+ // XBox One
+ // Durango was Microsoft's code-name for the platform, which is now obsolete.
+ // Microsoft uses _DURANGO instead of some variation of _XBOX, though it's not natively defined by the compiler.
+ // Capilano was an EA-specific code-name for the platform, which is now obsolete.
+ #if defined(EA_PLATFORM_XBOXONE)
+ #undef EA_PLATFORM_XBOXONE
+ #endif
+ #define EA_PLATFORM_XBOXONE 1
+
+ // Backward compatibility:
+ #if defined(EA_PLATFORM_CAPILANO)
+ #undef EA_PLATFORM_CAPILANO
+ #endif
+ #define EA_PLATFORM_CAPILANO 1
+ #if defined(EA_PLATFORM_CAPILANO_XDK) && !defined(EA_PLATFORM_XBOXONE_XDK)
+ #define EA_PLATFORM_XBOXONE_XDK 1
+ #endif
+ #if defined(EA_PLATFORM_CAPILANO_ADK) && !defined(EA_PLATFORM_XBOXONE_ADK)
+ #define EA_PLATFORM_XBOXONE_ADK 1
+ #endif
+ // End backward compatibility
+
+ #if !defined(_DURANGO)
+ #define _DURANGO
+ #endif
+ #define EA_PLATFORM_NAME "XBox One"
+ //#define EA_PROCESSOR_X86 Currently our policy is that we don't define this, even though x64 is something of a superset of x86.
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "XBox One on x64"
+ #define EA_ASM_STYLE_INTEL 1
+ #define EA_PLATFORM_CONSOLE 1
+ #define EA_PLATFORM_MICROSOFT 1
+
+ // WINAPI_FAMILY defines - mirrored from winapifamily.h
+ #define EA_WINAPI_FAMILY_APP 1000
+ #define EA_WINAPI_FAMILY_DESKTOP_APP 1001
+ #define EA_WINAPI_FAMILY_PHONE_APP 1002
+ #define EA_WINAPI_FAMILY_TV_APP 1003
+ #define EA_WINAPI_FAMILY_TV_TITLE 1004
+ #define EA_WINAPI_FAMILY_GAMES 1006
+
+ #if defined(WINAPI_FAMILY)
+ #include <winapifamily.h>
+ #if defined(WINAPI_FAMILY_TV_TITLE) && WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_TV_TITLE
+ #elif defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
+ #elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
+ #else
+ #error Unsupported WINAPI_FAMILY
+ #endif
+ #else
+ #error WINAPI_FAMILY should always be defined on Capilano.
+ #endif
+
+ // Macro to determine if a partition is enabled.
+ #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
+
+ #if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_DESKTOP_APP
+ #define EA_WINAPI_PARTITION_CORE 1
+ #define EA_WINAPI_PARTITION_DESKTOP 1
+ #define EA_WINAPI_PARTITION_APP 1
+ #define EA_WINAPI_PARTITION_PC_APP 0
+ #define EA_WIANPI_PARTITION_PHONE 0
+ #define EA_WINAPI_PARTITION_TV_APP 0
+ #define EA_WINAPI_PARTITION_TV_TITLE 0
+ #define EA_WINAPI_PARTITION_GAMES 0
+ #elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_TV_TITLE
+ #define EA_WINAPI_PARTITION_CORE 1
+ #define EA_WINAPI_PARTITION_DESKTOP 0
+ #define EA_WINAPI_PARTITION_APP 0
+ #define EA_WINAPI_PARTITION_PC_APP 0
+ #define EA_WIANPI_PARTITION_PHONE 0
+ #define EA_WINAPI_PARTITION_TV_APP 0
+ #define EA_WINAPI_PARTITION_TV_TITLE 1
+ #define EA_WINAPI_PARTITION_GAMES 0
+ #elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES
+ #define EA_WINAPI_PARTITION_CORE 1
+ #define EA_WINAPI_PARTITION_DESKTOP 0
+ #define EA_WINAPI_PARTITION_APP 0
+ #define EA_WINAPI_PARTITION_PC_APP 0
+ #define EA_WIANPI_PARTITION_PHONE 0
+ #define EA_WINAPI_PARTITION_TV_APP 0
+ #define EA_WINAPI_PARTITION_TV_TITLE 0
+ #define EA_WINAPI_PARTITION_GAMES 1
+ #else
+ #error Unsupported WINAPI_FAMILY
+ #endif
+
+ #if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_GAMES)
+ #define CS_UNDEFINED_STRING 1
+ #define CS_UNDEFINED_STRING 1
+ #endif
+
+ #if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_TV_TITLE)
+ #define EA_PLATFORM_XBOXONE_XDK 1
+ #endif
+#elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__))
+ #undef EA_PLATFORM_LRB
+ #define EA_PLATFORM_LRB 1
+ #define EA_PLATFORM_NAME "Larrabee"
+ #define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1"
+ #define EA_PROCESSOR_X86_64 1
+ #if defined(BYTE_ORDER) && (BYTE_ORDER == 4321)
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #else
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #endif
+ #define EA_PROCESSOR_LRB 1
+ #define EA_PROCESSOR_LRB1 1 // Larrabee version 1
+ #define EA_ASM_STYLE_ATT 1 // Both types of asm style
+ #define EA_ASM_STYLE_INTEL 1 // are supported.
+ #define EA_PLATFORM_DESKTOP 1
+
+// Android (Google phone OS)
+#elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__)
+ #undef EA_PLATFORM_ANDROID
+ #define EA_PLATFORM_ANDROID 1
+ #define EA_PLATFORM_LINUX 1
+ #define EA_PLATFORM_UNIX 1
+ #define EA_PLATFORM_POSIX 1
+ #define EA_PLATFORM_NAME "Android"
+ #define EA_ASM_STYLE_ATT 1
+ #if defined(__arm__)
+ #define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_PLATFORM_DESCRIPTION "Android on ARM"
+ #elif defined(__aarch64__)
+ #define EA_PROCESSOR_ARM64 1
+ #define EA_PLATFORM_DESCRIPTION "Android on ARM64"
+ #elif defined(__i386__)
+ #define EA_PROCESSOR_X86 1
+ #define EA_PLATFORM_DESCRIPTION "Android on x86"
+ #elif defined(__x86_64)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_PLATFORM_DESCRIPTION "Android on x64"
+ #else
+ #error Unknown processor
+ #endif
+ #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #endif
+ #define EA_PLATFORM_MOBILE 1
+
+// Samsung SMART TV - a Linux-based smart TV
+#elif defined(EA_PLATFORM_SAMSUNG_TV)
+ #undef EA_PLATFORM_SAMSUNG_TV
+ #define EA_PLATFORM_SAMSUNG_TV 1
+ #define EA_PLATFORM_LINUX 1
+ #define EA_PLATFORM_UNIX 1
+ #define EA_PLATFORM_POSIX 1
+ #define EA_PLATFORM_NAME "SamsungTV"
+ #define EA_PLATFORM_DESCRIPTION "Samsung SMART TV on ARM"
+ #define EA_ASM_STYLE_ATT 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
+ #define EA_PROCESSOR_ARM7 1
+
+#elif defined(__APPLE__) && __APPLE__
+ #include <TargetConditionals.h>
+
+ // Apple family of operating systems.
+ #define EA_PLATFORM_APPLE
+ #define EA_PLATFORM_POSIX 1
+
+ // iPhone
+ // TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc.
+ #if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
+ #undef EA_PLATFORM_IPHONE
+ #define EA_PLATFORM_IPHONE 1
+ #define EA_PLATFORM_NAME "iPhone"
+ #define EA_ASM_STYLE_ATT 1
+ #define EA_POSIX_THREADS_AVAILABLE 1
+ #if defined(__arm__)
+ #define EA_ABI_ARM_APPLE 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "iPhone on ARM"
+ #elif defined(__aarch64__) || defined(__AARCH64)
+ #define EA_ABI_ARM64_APPLE 1
+ #define EA_PROCESSOR_ARM64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "iPhone on ARM64"
+ #elif defined(__i386__)
+ #define EA_PLATFORM_IPHONE_SIMULATOR 1
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86"
+ #elif defined(__x86_64) || defined(__amd64)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "iPhone simulator on x64"
+ #else
+ #error Unknown processor
+ #endif
+ #define EA_PLATFORM_MOBILE 1
+
+ // Macintosh OSX
+ // TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers.
+ // Howerver, TARGET_OS_MAC is defined to be 1 in all cases.
+ // __i386__ and __intel__ are defined by the GCC compiler.
+ // __dest_os is defined by the Metrowerks compiler.
+ // __MACH__ is defined by the Metrowerks and GCC compilers.
+ // powerc and __powerc are defined by the Metrowerks and GCC compilers.
+ #elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x))
+ #undef EA_PLATFORM_OSX
+ #define EA_PLATFORM_OSX 1
+ #define EA_PLATFORM_UNIX 1
+ #define EA_PLATFORM_POSIX 1
+ //#define EA_PLATFORM_BSD 1 We don't currently define this. OSX has some BSD history but a lot of the API is different.
+ #define EA_PLATFORM_NAME "OSX"
+ #if defined(__i386__) || defined(__intel__)
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on x86"
+ #elif defined(__x86_64) || defined(__amd64)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on x64"
+ #elif defined(__arm__)
+ #define EA_ABI_ARM_APPLE 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on ARM"
+ #elif defined(__aarch64__) || defined(__AARCH64)
+ #define EA_ABI_ARM64_APPLE 1
+ #define EA_PROCESSOR_ARM64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on ARM64"
+ #elif defined(__POWERPC64__) || defined(__powerpc64__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_64 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
+ #elif defined(__POWERPC__) || defined(__powerpc__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_32 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC"
+ #else
+ #error Unknown processor
+ #endif
+ #if defined(__GNUC__)
+ #define EA_ASM_STYLE_ATT 1
+ #else
+ #define EA_ASM_STYLE_MOTOROLA 1
+ #endif
+ #define EA_PLATFORM_DESKTOP 1
+ #else
+ #error Unknown Apple Platform
+ #endif
+
+// Linux
+// __linux and __linux__ are defined by the GCC and Borland compiler.
+// __i386__ and __intel__ are defined by the GCC compiler.
+// __i386__ is defined by the Metrowerks compiler.
+// _M_IX86 is defined by the Borland compiler.
+// __sparc__ is defined by the GCC compiler.
+// __powerpc__ is defined by the GCC compiler.
+// __ARM_EABI__ is defined by GCC on an ARM v6l (Raspberry Pi 1)
+// __ARM_ARCH_7A__ is defined by GCC on an ARM v7l (Raspberry Pi 2)
+#elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__))
+ #undef EA_PLATFORM_LINUX
+ #define EA_PLATFORM_LINUX 1
+ #define EA_PLATFORM_UNIX 1
+ #define EA_PLATFORM_POSIX 1
+ #define EA_PLATFORM_NAME "Linux"
+ #if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on x86"
+ #elif defined(__ARM_ARCH_7A__) || defined(__ARM_EABI__)
+ #define EA_ABI_ARM_LINUX 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on ARM 6/7 32-bits"
+ #elif defined(__aarch64__) || defined(__AARCH64)
+ #define EA_PROCESSOR_ARM64 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on ARM64"
+ #elif defined(__x86_64__)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on x64"
+ #elif defined(__powerpc64__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_64 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
+ #elif defined(__powerpc__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_32 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC"
+ #else
+ #error Unknown processor
+ #error Unknown endianness
+ #endif
+ #if defined(__GNUC__)
+ #define EA_ASM_STYLE_ATT 1
+ #endif
+ #define EA_PLATFORM_DESKTOP 1
+
+
+#elif defined(EA_PLATFORM_BSD) || (defined(__BSD__) || defined(__FreeBSD__))
+ #undef EA_PLATFORM_BSD
+ #define EA_PLATFORM_BSD 1
+ #define EA_PLATFORM_UNIX 1
+ #define EA_PLATFORM_POSIX 1 // BSD's posix complaince is not identical to Linux's
+ #define EA_PLATFORM_NAME "BSD Unix"
+ #if defined(__i386__) || defined(__intel__)
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "BSD on x86"
+ #elif defined(__x86_64__)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "BSD on x64"
+ #elif defined(__powerpc64__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_64 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64"
+ #elif defined(__powerpc__)
+ #define EA_PROCESSOR_POWERPC 1
+ #define EA_PROCESSOR_POWERPC_32 1
+ #define EA_SYSTEM_BIG_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "BSD on PowerPC"
+ #else
+ #error Unknown processor
+ #error Unknown endianness
+ #endif
+ #if !defined(EA_PLATFORM_FREEBSD) && defined(__FreeBSD__)
+ #define EA_PLATFORM_FREEBSD 1 // This is a variation of BSD.
+ #endif
+ #if defined(__GNUC__)
+ #define EA_ASM_STYLE_ATT 1
+ #endif
+ #define EA_PLATFORM_DESKTOP 1
+
+
+#elif defined(EA_PLATFORM_WINDOWS_PHONE)
+ #undef EA_PLATFORM_WINDOWS_PHONE
+ #define EA_PLATFORM_WINDOWS_PHONE 1
+ #define EA_PLATFORM_NAME "Windows Phone"
+ #if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows Phone on x64"
+ #elif defined(_M_IX86) || defined(_X86_)
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows Phone on X86"
+ #elif defined(_M_ARM)
+ #define EA_ABI_ARM_WINCE 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows Phone on ARM"
+ #else //Possibly other Windows Phone variants
+ #error Unknown processor
+ #error Unknown endianness
+ #endif
+ #define EA_PLATFORM_MICROSOFT 1
+
+ // WINAPI_FAMILY defines - mirrored from winapifamily.h
+ #define EA_WINAPI_FAMILY_APP 1
+ #define EA_WINAPI_FAMILY_DESKTOP_APP 2
+ #define EA_WINAPI_FAMILY_PHONE_APP 3
+
+ #if defined(WINAPI_FAMILY)
+ #include <winapifamily.h>
+ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_PHONE_APP
+ #else
+ #error Unsupported WINAPI_FAMILY for Windows Phone
+ #endif
+ #else
+ #error WINAPI_FAMILY should always be defined on Windows Phone.
+ #endif
+
+ // Macro to determine if a partition is enabled.
+ #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
+
+ // Enable the appropriate partitions for the current family
+ #if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_PHONE_APP
+ # define EA_WINAPI_PARTITION_CORE 1
+ # define EA_WINAPI_PARTITION_PHONE 1
+ # define EA_WINAPI_PARTITION_APP 1
+ #else
+ # error Unsupported WINAPI_FAMILY for Windows Phone
+ #endif
+
+
+// Windows
+// _WIN32 is defined by the VC++, Intel and GCC compilers.
+// _WIN64 is defined by the VC++, Intel and GCC compilers.
+// __WIN32__ is defined by the Borland compiler.
+// __INTEL__ is defined by the Metrowerks compiler.
+// _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers.
+// _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler.
+// _M_ARM is defined by the VC++ compiler.
+#elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64))) && !defined(CS_UNDEFINED_STRING)
+ #undef EA_PLATFORM_WINDOWS
+ #define EA_PLATFORM_WINDOWS 1
+ #define EA_PLATFORM_NAME "Windows"
+ #ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64.
+ #define EA_PLATFORM_WIN64 1
+ #else
+ #define EA_PLATFORM_WIN32 1
+ #endif
+ #if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
+ #define EA_PROCESSOR_X86_64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows on x64"
+ #elif defined(_M_IX86) || defined(_X86_)
+ #define EA_PROCESSOR_X86 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows on X86"
+ #elif defined(_M_IA64) || defined(_IA64_)
+ #define EA_PROCESSOR_IA64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows on IA-64"
+ #elif defined(_M_ARM)
+ #define EA_ABI_ARM_WINCE 1
+ #define EA_PROCESSOR_ARM32 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows on ARM"
+ #elif defined(_M_ARM64)
+ #define EA_PROCESSOR_ARM64 1
+ #define EA_SYSTEM_LITTLE_ENDIAN 1
+ #define EA_PLATFORM_DESCRIPTION "Windows on ARM64"
+ #else //Possibly other Windows CE variants
+ #error Unknown processor
+ #error Unknown endianness
+ #endif
+ #if defined(__GNUC__)
+ #define EA_ASM_STYLE_ATT 1
+ #elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL)
+ #define EA_ASM_STYLE_INTEL 1
+ #endif
+ #define EA_PLATFORM_DESKTOP 1
+ #define EA_PLATFORM_MICROSOFT 1
+
+ // WINAPI_FAMILY defines to support Windows 8 Metro Apps - mirroring winapifamily.h in the Windows 8 SDK
+ #define EA_WINAPI_FAMILY_APP 1000
+ #define EA_WINAPI_FAMILY_DESKTOP_APP 1001
+ #define EA_WINAPI_FAMILY_GAMES 1006
+
+ #if defined(WINAPI_FAMILY)
+ #if defined(_MSC_VER)
+ #pragma warning(push, 0)
+ #endif
+ #include <winapifamily.h>
+ #if defined(_MSC_VER)
+ #pragma warning(pop)
+ #endif
+ #if defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
+ #elif defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_APP
+ #elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
+ #else
+ #error Unsupported WINAPI_FAMILY
+ #endif
+ #else
+ #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
+ #endif
+
+ #define EA_WINAPI_PARTITION_DESKTOP 1
+ #define EA_WINAPI_PARTITION_APP 1
+ #define EA_WINAPI_PARTITION_GAMES (EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES)
+
+ #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition)
+
+ // EA_PLATFORM_WINRT
+ // This is a subset of Windows which is used for tablets and the "Metro" (restricted) Windows user interface.
+ // WinRT doesn't doesn't have access to the Windows "desktop" API, but WinRT can nevertheless run on
+ // desktop computers in addition to tablets. The Windows Phone API is a subset of WinRT and is not included
+ // in it due to it being only a part of the API.
+ #if defined(__cplusplus_winrt)
+ #define EA_PLATFORM_WINRT 1
+ #endif
+
+// Sun (Solaris)
+// __SUNPRO_CC is defined by the Sun compiler.
+// __sun is defined by the GCC compiler.
+// __i386 is defined by the Sun and GCC compilers.
+// __sparc is defined by the Sun and GCC compilers.
+#else
+ #error Unknown platform
+ #error Unknown processor
+ #error Unknown endianness
+#endif
+
+#ifndef EA_PROCESSOR_ARM
+ #if defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) || defined(EA_PROCESSOR_ARM7)
+ #define EA_PROCESSOR_ARM
+ #endif
+#endif
+
+// EA_PLATFORM_PTR_SIZE
+// Platform pointer size; same as sizeof(void*).
+// This is not the same as sizeof(int), as int is usually 32 bits on
+// even 64 bit platforms.
+//
+// _WIN64 is defined by Win64 compilers, such as VC++.
+// _M_IA64 is defined by VC++ and Intel compilers for IA64 processors.
+// __LP64__ is defined by HP compilers for the LP64 standard.
+// _LP64 is defined by the GCC and Sun compilers for the LP64 standard.
+// __ia64__ is defined by the GCC compiler for IA64 processors.
+// __arch64__ is defined by the Sparc compiler for 64 bit processors.
+// __mips64__ is defined by the GCC compiler for MIPS processors.
+// __powerpc64__ is defined by the GCC compiler for PowerPC processors.
+// __64BIT__ is defined by the AIX compiler for 64 bit processors.
+// __sizeof_ptr is defined by the ARM compiler (armcc, armcpp).
+//
+#ifndef EA_PLATFORM_PTR_SIZE
+ #if defined(__WORDSIZE) // Defined by some variations of GCC.
+ #define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8)
+ #elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__aarch64__) || defined(__mips64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
+ #define EA_PLATFORM_PTR_SIZE 8
+ #elif defined(__CC_ARM) && (__sizeof_ptr == 8)
+ #define EA_PLATFORM_PTR_SIZE 8
+ #else
+ #define EA_PLATFORM_PTR_SIZE 4
+ #endif
+#endif
+
+
+
+// EA_PLATFORM_WORD_SIZE
+// This defines the size of a machine word. This will be the same as
+// the size of registers on the machine but not necessarily the same
+// as the size of pointers on the machine. A number of 64 bit platforms
+// have 64 bit registers but 32 bit pointers.
+//
+#ifndef EA_PLATFORM_WORD_SIZE
+ #define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE
+#endif
+
+// EA_PLATFORM_MIN_MALLOC_ALIGNMENT
+// This defines the minimal alignment that the platform's malloc
+// implementation will return. This should be used when writing custom
+// allocators to ensure that the alignment matches that of malloc
+#ifndef EA_PLATFORM_MIN_MALLOC_ALIGNMENT
+ #if defined(EA_PLATFORM_APPLE)
+ #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 16
+ #elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM)
+ #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
+ #elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_X86_64)
+ #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
+ #else
+ #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT (EA_PLATFORM_PTR_SIZE * 2)
+ #endif
+#endif
+
+
+// EA_MISALIGNED_SUPPORT_LEVEL
+// Specifies if the processor can read and write built-in types that aren't
+// naturally aligned.
+// 0 - not supported. Likely causes an exception.
+// 1 - supported but slow.
+// 2 - supported and fast.
+//
+#ifndef EA_MISALIGNED_SUPPORT_LEVEL
+ #if defined(EA_PROCESSOR_X86_64)
+ #define EA_MISALIGNED_SUPPORT_LEVEL 2
+ #else
+ #define EA_MISALIGNED_SUPPORT_LEVEL 0
+ #endif
+#endif
+
+// Macro to determine if a Windows API partition is enabled. Always false on non Microsoft platforms.
+#if !defined(EA_WINAPI_FAMILY_PARTITION)
+ #define EA_WINAPI_FAMILY_PARTITION(Partition) (0)
+#endif
+
+
+// EA_CACHE_LINE_SIZE
+// Specifies the cache line size broken down by compile target.
+// This the expected best guess values for the targets that we can make at compilation time.
+
+#ifndef EA_CACHE_LINE_SIZE
+ #if defined(EA_PROCESSOR_X86)
+ #define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value.
+ #elif defined(EA_PROCESSOR_X86_64)
+ #define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
+ #elif defined(EA_PROCESSOR_ARM32)
+ #define EA_CACHE_LINE_SIZE 32 // This varies between implementations and is usually 32 or 64.
+ #elif defined(EA_PROCESSOR_ARM64)
+ #define EA_CACHE_LINE_SIZE 64 // Cache line Cortex-A8 (64 bytes) http://shervinemami.info/armAssembly.html however this remains to be mostly an assumption at this stage
+ #elif (EA_PLATFORM_WORD_SIZE == 4)
+ #define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value
+ #else
+ #define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value
+ #endif
+#endif
+
+
+#endif // INCLUDED_eaplatform_H
+
+
+
+
+
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/eabase.h b/EASTL/test/packages/EABase/include/Common/EABase/eabase.h
new file mode 100644
index 0000000..dab9e46
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/eabase.h
@@ -0,0 +1,1011 @@
+/*-----------------------------------------------------------------------------
+ * eabase.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_eabase_H
+#define INCLUDED_eabase_H
+
+
+// Identify the compiler and declare the EA_COMPILER_xxxx defines
+#include <EABase/config/eacompiler.h>
+
+// Identify traits which this compiler supports, or does not support
+#include <EABase/config/eacompilertraits.h>
+
+// Identify the platform and declare the EA_xxxx defines
+#include <EABase/config/eaplatform.h>
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
+#endif
+
+// Always include version.h for backwards compatibility.
+#include <EABase/version.h>
+
+// Define common SI unit macros
+#include <EABase/eaunits.h>
+
+
+// ------------------------------------------------------------------------
+// The C++ standard defines size_t as a built-in type. Some compilers are
+// not standards-compliant in this respect, so we need an additional include.
+// The case is similar with wchar_t under C++.
+
+#if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_MSVC) || defined(EA_WCHAR_T_NON_NATIVE) || defined(EA_PLATFORM_SONY)
+ #if defined(EA_COMPILER_MSVC)
+ #pragma warning(push, 0)
+ #pragma warning(disable: 4265 4365 4836 4574)
+ #endif
+ #include <stddef.h>
+ #if defined(EA_COMPILER_MSVC)
+ #pragma warning(pop)
+ #endif
+#endif
+
+// ------------------------------------------------------------------------
+// Include stddef.h on Apple's clang compiler to ensure the ptrdiff_t type
+// is defined.
+#if defined(EA_COMPILER_CLANG) && defined(EA_PLATFORM_APPLE)
+ #include <stddef.h>
+#endif
+
+// ------------------------------------------------------------------------
+// Include assert.h on C11 supported compilers so we may allow static_assert usage
+// http://en.cppreference.com/w/c/error/static_assert
+// C11 standard(ISO / IEC 9899:2011) :
+// 7.2/3 Diagnostics <assert.h>(p : 186)
+#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201100L
+ #include <assert.h>
+#endif
+
+
+// ------------------------------------------------------------------------
+// By default, GCC defines NULL as ((void*)0), which is the
+// C definition. This causes all sort of problems for C++ code, so it is
+// worked around by undefining NULL.
+
+#if defined(NULL)
+ #undef NULL
+#endif
+
+
+// ------------------------------------------------------------------------
+// Define the NULL pointer. This is normally defined in <stddef.h>, but we
+// don't want to force a global dependency on that header, so the definition
+// is duplicated here.
+
+#if defined(__cplusplus)
+ #define NULL 0
+#else
+ #define NULL ((void*)0)
+#endif
+
+
+// ------------------------------------------------------------------------
+// C98/99 Standard typedefs. From the ANSI ISO/IEC 9899 standards document
+// Most recent versions of the gcc-compiler come with these defined in
+// inttypes.h or stddef.h. Determining if they are predefined can be
+// tricky, so we expect some problems on non-standard compilers
+
+//#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64)
+// #error "<inttypes.h> was #included before eabase.h, but without __STDC_FORMAT_MACROS #defined. You must #include eabase.h or an equivalent before #including C99 headers, or you must define __STDC_FORMAT_MACRO before #including system headrs."
+//#endif
+
+// ------------------------------------------------------------------------
+// We need to test this after we potentially include stddef.h, otherwise we
+// would have put this into the compilertraits header.
+#if !defined(EA_COMPILER_HAS_INTTYPES) && (!defined(_MSC_VER) || (_MSC_VER > 1500)) && (defined(EA_COMPILER_IS_C99) || defined(INT8_MIN) || defined(EA_COMPILER_HAS_C99_TYPES) || defined(_SN_STDINT_H))
+ #define EA_COMPILER_HAS_INTTYPES
+#endif
+
+#ifdef EA_COMPILER_HAS_INTTYPES // If the compiler supports inttypes...
+ // ------------------------------------------------------------------------
+ // Include the stdint header to define and derive the required types.
+ // Additionally include inttypes.h as many compilers, including variations
+ // of GCC define things in inttypes.h that the C99 standard says goes
+ // in stdint.h.
+ //
+ // The C99 standard specifies that inttypes.h only define printf/scanf
+ // format macros if __STDC_FORMAT_MACROS is defined before #including
+ // inttypes.h. For consistency, we do that here.
+ #ifndef __STDC_FORMAT_MACROS
+ #define __STDC_FORMAT_MACROS
+ #endif
+ // The GCC PSP compiler defines standard int types (e.g. uint32_t) but not PRId8, etc.
+ // MSVC added support for inttypes.h header in VS2013.
+ #if !defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1800)
+ #include <inttypes.h> // PRId8, SCNd8, etc.
+ #endif
+ #if defined(_MSC_VER)
+ #pragma warning(push, 0)
+ #endif
+ #include <stdint.h> // int32_t, INT64_C, UINT8_MAX, etc.
+ #include <math.h> // float_t, double_t, etc.
+ #include <float.h> // FLT_EVAL_METHOD.
+ #if defined(_MSC_VER)
+ #pragma warning(pop)
+ #endif
+
+ #if !defined(FLT_EVAL_METHOD) && (defined(__FLT_EVAL_METHOD__) || defined(_FEVAL)) // GCC 3.x defines __FLT_EVAL_METHOD__ instead of the C99 standard FLT_EVAL_METHOD.
+ #ifdef __FLT_EVAL_METHOD__
+ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+ #else
+ #define FLT_EVAL_METHOD _FEVAL
+ #endif
+ #endif
+
+ // MinGW GCC (up to at least v4.3.0-20080502) mistakenly neglects to define float_t and double_t.
+ // This appears to be an acknowledged bug as of March 2008 and is scheduled to be fixed.
+ // Similarly, Android uses a mix of custom standard library headers which prior to SDK API level 21
+ // don't define float_t and double_t.
+ #if defined(__MINGW32__) || (defined(EA_PLATFORM_ANDROID) && !(defined(EA_ANDROID_SDK_LEVEL) && EA_ANDROID_SDK_LEVEL >= 21))
+ #if defined(__FLT_EVAL_METHOD__)
+ #if(__FLT_EVAL_METHOD__== 0)
+ typedef float float_t;
+ typedef double double_t;
+ #elif(__FLT_EVAL_METHOD__ == 1)
+ typedef double float_t;
+ typedef double double_t;
+ #elif(__FLT_EVAL_METHOD__ == 2)
+ typedef long double float_t;
+ typedef long double double_t;
+ #endif
+ #else
+ typedef float float_t;
+ typedef double double_t;
+ #endif
+ #endif
+
+ // The CodeSourcery definitions of PRIxPTR and SCNxPTR are broken for 32 bit systems.
+ #if defined(__SIZEOF_SIZE_T__) && (__SIZEOF_SIZE_T__ == 4) && (defined(__have_long64) || defined(__have_longlong64))
+ #undef PRIdPTR
+ #define PRIdPTR "d"
+ #undef PRIiPTR
+ #define PRIiPTR "i"
+ #undef PRIoPTR
+ #define PRIoPTR "o"
+ #undef PRIuPTR
+ #define PRIuPTR "u"
+ #undef PRIxPTR
+ #define PRIxPTR "x"
+ #undef PRIXPTR
+ #define PRIXPTR "X"
+
+ #undef SCNdPTR
+ #define SCNdPTR "d"
+ #undef SCNiPTR
+ #define SCNiPTR "i"
+ #undef SCNoPTR
+ #define SCNoPTR "o"
+ #undef SCNuPTR
+ #define SCNuPTR "u"
+ #undef SCNxPTR
+ #define SCNxPTR "x"
+ #endif
+#else // else we must implement types ourselves.
+
+ #if !defined(__BIT_TYPES_DEFINED__) && !defined(__int8_t_defined)
+ typedef signed char int8_t; //< 8 bit signed integer
+ #endif
+ #if !defined( __int8_t_defined )
+ typedef signed short int16_t; //< 16 bit signed integer
+ typedef signed int int32_t; //< 32 bit signed integer. This works for both 32 bit and 64 bit platforms, as we assume the LP64 is followed.
+ #define __int8_t_defined
+ #endif
+ typedef unsigned char uint8_t; //< 8 bit unsigned integer
+ typedef unsigned short uint16_t; //< 16 bit unsigned integer
+ #if !defined( __uint32_t_defined )
+ typedef unsigned int uint32_t; //< 32 bit unsigned integer. This works for both 32 bit and 64 bit platforms, as we assume the LP64 is followed.
+ #define __uint32_t_defined
+ #endif
+
+ // According to the C98/99 standard, FLT_EVAL_METHOD defines control the
+ // width used for floating point _t types.
+ #if defined(_MSC_VER) && _MSC_VER >= 1800
+ // MSVC's math.h provides float_t, double_t under this condition.
+ #elif defined(FLT_EVAL_METHOD)
+ #if (FLT_EVAL_METHOD == 0)
+ typedef float float_t;
+ typedef double double_t;
+ #elif (FLT_EVAL_METHOD == 1)
+ typedef double float_t;
+ typedef double double_t;
+ #elif (FLT_EVAL_METHOD == 2)
+ typedef long double float_t;
+ typedef long double double_t;
+ #endif
+ #endif
+
+ #if defined(EA_COMPILER_MSVC)
+ typedef signed __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+
+ #else
+ typedef signed long long int64_t;
+ typedef unsigned long long uint64_t;
+ #endif
+#endif
+
+
+// ------------------------------------------------------------------------
+// macros for declaring constants in a portable way.
+//
+// e.g. int64_t x = INT64_C(1234567812345678);
+// e.g. int64_t x = INT64_C(0x1111111122222222);
+// e.g. uint64_t x = UINT64_C(0x1111111122222222);
+//
+// Microsoft VC++'s definitions of INT8_C/UINT8_C/INT16_C/UINT16_C are like so:
+// #define INT8_C(x) (x)
+// #define INT16_C(x) (x)
+// #define UINT8_C(x) (x)
+// #define UINT16_C(x) (x)
+// To consider: undefine Microsoft's and use the casting versions below.
+// ------------------------------------------------------------------------
+
+#ifndef INT8_C_DEFINED // If the user hasn't already defined these...
+ #define INT8_C_DEFINED
+
+ #ifndef INT8_C
+ #define INT8_C(x) int8_t(x) // For the majority of compilers and platforms, long is 32 bits and long long is 64 bits.
+ #endif
+ #ifndef UINT8_C
+ #define UINT8_C(x) uint8_t(x)
+ #endif
+ #ifndef INT16_C
+ #define INT16_C(x) int16_t(x)
+ #endif
+ #ifndef UINT16_C
+ #define UINT16_C(x) uint16_t(x) // Possibly we should make this be uint16_t(x##u). Let's see how compilers react before changing this.
+ #endif
+ #ifndef INT32_C
+ #define INT32_C(x) x##L
+ #endif
+ #ifndef UINT32_C
+ #define UINT32_C(x) x##UL
+ #endif
+ #ifndef INT64_C
+ #define INT64_C(x) x##LL // The way to deal with this is to compare ULONG_MAX to 0xffffffff and if not equal, then remove the L.
+ #endif
+ #ifndef UINT64_C
+ #define UINT64_C(x) x##ULL // We need to follow a similar approach for LL.
+ #endif
+ #ifndef UINTMAX_C
+ #define UINTMAX_C(x) UINT64_C(x)
+ #endif
+#endif
+
+// ------------------------------------------------------------------------
+// type sizes
+#ifndef INT8_MAX_DEFINED // If the user hasn't already defined these...
+ #define INT8_MAX_DEFINED
+
+ // The value must be 2^(n-1)-1
+ #ifndef INT8_MAX
+ #define INT8_MAX 127
+ #endif
+ #ifndef INT16_MAX
+ #define INT16_MAX 32767
+ #endif
+ #ifndef INT32_MAX
+ #define INT32_MAX 2147483647
+ #endif
+ #ifndef INT64_MAX
+ #define INT64_MAX INT64_C(9223372036854775807)
+ #endif
+ #ifndef INTMAX_MAX
+ #define INTMAX_MAX INT64_MAX
+ #endif
+ #ifndef INTPTR_MAX
+ #if EA_PLATFORM_PTR_SIZE == 4
+ #define INTPTR_MAX INT32_MAX
+ #else
+ #define INTPTR_MAX INT64_MAX
+ #endif
+ #endif
+
+ // The value must be either -2^(n-1) or 1-2(n-1).
+ #ifndef INT8_MIN
+ #define INT8_MIN -128
+ #endif
+ #ifndef INT16_MIN
+ #define INT16_MIN -32768
+ #endif
+ #ifndef INT32_MIN
+ #define INT32_MIN (-INT32_MAX - 1) // -2147483648
+ #endif
+ #ifndef INT64_MIN
+ #define INT64_MIN (-INT64_MAX - 1) // -9223372036854775808
+ #endif
+ #ifndef INTMAX_MIN
+ #define INTMAX_MIN INT64_MIN
+ #endif
+ #ifndef INTPTR_MIN
+ #if EA_PLATFORM_PTR_SIZE == 4
+ #define INTPTR_MIN INT32_MIN
+ #else
+ #define INTPTR_MIN INT64_MIN
+ #endif
+ #endif
+
+ // The value must be 2^n-1
+ #ifndef UINT8_MAX
+ #define UINT8_MAX 0xffU // 255
+ #endif
+ #ifndef UINT16_MAX
+ #define UINT16_MAX 0xffffU // 65535
+ #endif
+ #ifndef UINT32_MAX
+ #define UINT32_MAX UINT32_C(0xffffffff) // 4294967295
+ #endif
+ #ifndef UINT64_MAX
+ #define UINT64_MAX UINT64_C(0xffffffffffffffff) // 18446744073709551615
+ #endif
+ #ifndef UINTMAX_MAX
+ #define UINTMAX_MAX UINT64_MAX
+ #endif
+ #ifndef UINTPTR_MAX
+ #if EA_PLATFORM_PTR_SIZE == 4
+ #define UINTPTR_MAX UINT32_MAX
+ #else
+ #define UINTPTR_MAX UINT64_MAX
+ #endif
+ #endif
+#endif
+
+#ifndef FLT_EVAL_METHOD
+ #define FLT_EVAL_METHOD 0
+ typedef float float_t;
+ typedef double double_t;
+#endif
+
+#if defined(EA_COMPILER_HAS_INTTYPES) && (!defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1800))
+ #define EA_COMPILER_HAS_C99_FORMAT_MACROS
+#endif
+
+#ifndef EA_COMPILER_HAS_C99_FORMAT_MACROS
+ // ------------------------------------------------------------------------
+ // sized printf and scanf format specifiers
+ // See the C99 standard, section 7.8.1 -- Macros for format specifiers.
+ //
+ // The C99 standard specifies that inttypes.h only define printf/scanf
+ // format macros if __STDC_FORMAT_MACROS is defined before #including
+ // inttypes.h. For consistency, we define both __STDC_FORMAT_MACROS and
+ // the printf format specifiers here. We also skip the "least/most"
+ // variations of these specifiers, as we've decided to do so with
+ // basic types.
+ //
+ // For 64 bit systems, we assume the LP64 standard is followed
+ // (as opposed to ILP64, etc.) For 32 bit systems, we assume the
+ // ILP32 standard is followed. See:
+ // http://www.opengroup.org/public/tech/aspen/lp64_wp.htm
+ // for information about this. Thus, on both 32 and 64 bit platforms,
+ // %l refers to 32 bit data while %ll refers to 64 bit data.
+
+ #ifndef __STDC_FORMAT_MACROS
+ #define __STDC_FORMAT_MACROS
+ #endif
+
+ #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
+ #define EA_PRI_64_LENGTH_SPECIFIER "ll"
+ #define EA_SCN_64_LENGTH_SPECIFIER "ll"
+ #endif // It turns out that some platforms use %q to represent a 64 bit value, but these are not relevant to us at this time.
+
+ // Printf format specifiers
+ #if defined(EA_COMPILER_IS_C99) || defined(EA_COMPILER_GNUC)
+ #define PRId8 "hhd"
+ #define PRIi8 "hhi"
+ #define PRIo8 "hho"
+ #define PRIu8 "hhu"
+ #define PRIx8 "hhx"
+ #define PRIX8 "hhX"
+ #else // VC++, Borland, etc. which have no way to specify 8 bit values other than %c.
+ #define PRId8 "c" // This may not work properly but it at least will not crash. Try using 16 bit versions instead.
+ #define PRIi8 "c" // "
+ #define PRIo8 "o" // "
+ #define PRIu8 "u" // "
+ #define PRIx8 "x" // "
+ #define PRIX8 "X" // "
+ #endif
+
+ #define PRId16 "hd"
+ #define PRIi16 "hi"
+ #define PRIo16 "ho"
+ #define PRIu16 "hu"
+ #define PRIx16 "hx"
+ #define PRIX16 "hX"
+
+ #define PRId32 "d" // This works for both 32 bit and 64 bit systems, as we assume LP64 conventions.
+ #define PRIi32 "i"
+ #define PRIo32 "o"
+ #define PRIu32 "u"
+ #define PRIx32 "x"
+ #define PRIX32 "X"
+
+ #define PRId64 EA_PRI_64_LENGTH_SPECIFIER "d"
+ #define PRIi64 EA_PRI_64_LENGTH_SPECIFIER "i"
+ #define PRIo64 EA_PRI_64_LENGTH_SPECIFIER "o"
+ #define PRIu64 EA_PRI_64_LENGTH_SPECIFIER "u"
+ #define PRIx64 EA_PRI_64_LENGTH_SPECIFIER "x"
+ #define PRIX64 EA_PRI_64_LENGTH_SPECIFIER "X"
+
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ #define PRIdPTR PRId32 // Usage of pointer values will generate warnings with
+ #define PRIiPTR PRIi32 // some compilers because they are defined in terms of
+ #define PRIoPTR PRIo32 // integers. However, you can't simply use "p" because
+ #define PRIuPTR PRIu32 // 'p' is interpreted in a specific and often different
+ #define PRIxPTR PRIx32 // way by the library.
+ #define PRIXPTR PRIX32
+ #elif (EA_PLATFORM_PTR_SIZE == 8)
+ #define PRIdPTR PRId64
+ #define PRIiPTR PRIi64
+ #define PRIoPTR PRIo64
+ #define PRIuPTR PRIu64
+ #define PRIxPTR PRIx64
+ #define PRIXPTR PRIX64
+ #endif
+
+ // Scanf format specifiers
+ #if defined(EA_COMPILER_IS_C99) || defined(EA_COMPILER_GNUC)
+ #define SCNd8 "hhd"
+ #define SCNi8 "hhi"
+ #define SCNo8 "hho"
+ #define SCNu8 "hhu"
+ #define SCNx8 "hhx"
+ #else // VC++, Borland, etc. which have no way to specify 8 bit values other than %c.
+ #define SCNd8 "c" // This will not work properly but it at least will not crash. Try using 16 bit versions instead.
+ #define SCNi8 "c" // "
+ #define SCNo8 "c" // "
+ #define SCNu8 "c" // "
+ #define SCNx8 "c" // "
+ #endif
+
+ #define SCNd16 "hd"
+ #define SCNi16 "hi"
+ #define SCNo16 "ho"
+ #define SCNu16 "hu"
+ #define SCNx16 "hx"
+
+ #define SCNd32 "d" // This works for both 32 bit and 64 bit systems, as we assume LP64 conventions.
+ #define SCNi32 "i"
+ #define SCNo32 "o"
+ #define SCNu32 "u"
+ #define SCNx32 "x"
+
+ #define SCNd64 EA_SCN_64_LENGTH_SPECIFIER "d"
+ #define SCNi64 EA_SCN_64_LENGTH_SPECIFIER "i"
+ #define SCNo64 EA_SCN_64_LENGTH_SPECIFIER "o"
+ #define SCNu64 EA_SCN_64_LENGTH_SPECIFIER "u"
+ #define SCNx64 EA_SCN_64_LENGTH_SPECIFIER "x"
+
+ #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1900)
+ #define SCNdPTR PRIdPTR
+ #define SCNiPTR PRIiPTR
+ #define SCNoPTR PRIoPTR
+ #define SCNuPTR PRIuPTR
+ #define SCNxPTR PRIxPTR
+ #elif (EA_PLATFORM_PTR_SIZE == 4)
+ #define SCNdPTR SCNd32 // Usage of pointer values will generate warnings with
+ #define SCNiPTR SCNi32 // some compilers because they are defined in terms of
+ #define SCNoPTR SCNo32 // integers. However, you can't simply use "p" because
+ #define SCNuPTR SCNu32 // 'p' is interpreted in a specific and often different
+ #define SCNxPTR SCNx32 // way by the library.
+ #elif (EA_PLATFORM_PTR_SIZE == 8)
+ #define SCNdPTR SCNd64
+ #define SCNiPTR SCNi64
+ #define SCNoPTR SCNo64
+ #define SCNuPTR SCNu64
+ #define SCNxPTR SCNx64
+ #endif
+#endif
+
+
+// ------------------------------------------------------------------------
+// bool8_t
+// The definition of a bool8_t is controversial with some, as it doesn't
+// act just like built-in bool. For example, you can assign -100 to it.
+//
+#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))
+ #if defined(__cplusplus)
+ typedef bool bool8_t;
+ #else
+ typedef int8_t bool8_t;
+ #endif
+ #else // EA_COMPILER_GNUC generally uses 4 bytes per bool.
+ typedef int8_t bool8_t;
+ #endif
+#endif
+
+
+// ------------------------------------------------------------------------
+// intptr_t / uintptr_t
+// Integer type guaranteed to be big enough to hold
+// a native pointer ( intptr_t is defined in STDDEF.H )
+//
+#if !defined(_INTPTR_T_DEFINED) && !defined(_intptr_t_defined) && !defined(EA_COMPILER_HAS_C99_TYPES)
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ typedef int32_t intptr_t;
+ #elif (EA_PLATFORM_PTR_SIZE == 8)
+ typedef int64_t intptr_t;
+ #endif
+
+ #define _intptr_t_defined
+ #define _INTPTR_T_DEFINED
+#endif
+
+#if !defined(_UINTPTR_T_DEFINED) && !defined(_uintptr_t_defined) && !defined(EA_COMPILER_HAS_C99_TYPES)
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ typedef uint32_t uintptr_t;
+ #elif (EA_PLATFORM_PTR_SIZE == 8)
+ typedef uint64_t uintptr_t;
+ #endif
+
+ #define _uintptr_t_defined
+ #define _UINTPTR_T_DEFINED
+#endif
+
+#if !defined(EA_COMPILER_HAS_INTTYPES)
+ #ifndef INTMAX_T_DEFINED
+ #define INTMAX_T_DEFINED
+
+ // At this time, all supported compilers have int64_t as the max
+ // integer type. Some compilers support a 128 bit integer type,
+ // but in some cases it is not a true int128_t but rather a
+ // crippled data type. Also, it turns out that Unix 64 bit ABIs
+ // require that intmax_t be int64_t and nothing larger. So we
+ // play it safe here and set intmax_t to int64_t, even though
+ // an int128_t type may exist.
+
+ typedef int64_t intmax_t;
+ typedef uint64_t uintmax_t;
+ #endif
+#endif
+
+
+// ------------------------------------------------------------------------
+// ssize_t
+// signed equivalent to size_t.
+// This is defined by GCC (except the QNX implementation of GCC) but not by other compilers.
+//
+#if !defined(__GNUC__)
+ // As of this writing, all non-GCC compilers significant to us implement
+ // uintptr_t the same as size_t. However, this isn't guaranteed to be
+ // so for all compilers, as size_t may be based on int, long, or long long.
+ #if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
+ #define _SSIZE_T_
+ #define _SSIZE_T_DEFINED
+
+ #if defined(_MSC_VER) && (EA_PLATFORM_PTR_SIZE == 8)
+ typedef __int64 ssize_t;
+ #else
+ typedef long ssize_t;
+ #endif
+ #endif
+#else
+ #include <sys/types.h>
+#endif
+
+
+// ------------------------------------------------------------------------
+// Character types
+//
+#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.
+ #ifdef EA_COMPILER_MSVC
+ #pragma warning(push, 3)
+ #endif
+ #include <wchar.h>
+ #ifdef EA_COMPILER_MSVC
+ #pragma warning(pop)
+ #endif
+ #endif
+#endif
+
+
+// ------------------------------------------------------------------------
+// char8_t -- Guaranteed to be equal to the compiler's char data type.
+// Some compilers implement char8_t as unsigned, though char
+// is usually set to be signed.
+//
+// char16_t -- This is set to be an unsigned 16 bit value. If the compiler
+// has wchar_t as an unsigned 16 bit value, then char16_t is
+// set to be the same thing as wchar_t in order to allow the
+// user to use char16_t with standard wchar_t functions.
+//
+// char32_t -- This is set to be an unsigned 32 bit value. If the compiler
+// has wchar_t as an unsigned 32 bit value, then char32_t is
+// set to be the same thing as wchar_t in order to allow the
+// user to use char32_t with standard wchar_t functions.
+//
+// EA_CHAR8_UNIQUE
+// EA_CHAR16_NATIVE
+// EA_CHAR32_NATIVE
+// EA_WCHAR_UNIQUE
+//
+// VS2010 unilaterally defines char16_t and char32_t in its yvals.h header
+// unless _HAS_CHAR16_T_LANGUAGE_SUPPORT or _CHAR16T are defined.
+// However, VS2010 does not support the C++0x u"" and U"" string literals,
+// which makes its definition of char16_t and char32_t somewhat useless.
+// Until VC++ supports string literals, the build system should define
+// _CHAR16T and let EABase define char16_t and EA_CHAR16.
+//
+// GCC defines char16_t and char32_t in the C compiler in -std=gnu99 mode,
+// as __CHAR16_TYPE__ and __CHAR32_TYPE__, and for the C++ compiler
+// in -std=c++0x and -std=gnu++0x modes, as char16_t and char32_t too.
+//
+// The EA_WCHAR_UNIQUE symbol is defined to 1 if wchar_t is distinct from
+// char8_t, char16_t, and char32_t, and defined to 0 if not. In some cases,
+// if the compiler does not support char16_t/char32_t, one of these two types
+// is typically a typedef or define of wchar_t. For compilers that support
+// the C++11 unicode character types often overloads must be provided to
+// support existing code that passes a wide char string to a function that
+// takes a unicode string.
+//
+// The EA_CHAR8_UNIQUE symbol is defined to 1 if char8_t is distinct type
+// from char in the type system, and defined to 0 if otherwise.
+
+#if !defined(EA_CHAR16_NATIVE)
+ // To do: Change this to be based on EA_COMPILER_NO_NEW_CHARACTER_TYPES.
+ #if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT // VS2010+
+ #define EA_CHAR16_NATIVE 1
+ #elif defined(EA_COMPILER_CLANG) && defined(EA_COMPILER_CPP11_ENABLED)
+ #if __has_feature(cxx_unicode_literals)
+ #define EA_CHAR16_NATIVE 1
+ #elif (EA_COMPILER_VERSION >= 300) && !(defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX))
+ #define EA_CHAR16_NATIVE 1
+ #elif defined(EA_PLATFORM_APPLE)
+ #define EA_CHAR16_NATIVE 1
+ #else
+ #define EA_CHAR16_NATIVE 0
+ #endif
+ #elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404) && defined(__CHAR16_TYPE__) && defined(EA_COMPILER_CPP11_ENABLED)// EDG 4.4+.
+ #define EA_CHAR16_NATIVE 1
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_EDG) && (defined(EA_COMPILER_CPP11_ENABLED) || defined(__STDC_VERSION__)) // g++ (C++ compiler) 4.4+ with -std=c++0x or gcc (C compiler) 4.4+ with -std=gnu99
+ #define EA_CHAR16_NATIVE 1
+ #else
+ #define EA_CHAR16_NATIVE 0
+ #endif
+#endif
+
+#if !defined(EA_CHAR32_NATIVE) // Microsoft currently ties char32_t language support to char16_t language support. So we use CHAR16_T here.
+ // To do: Change this to be based on EA_COMPILER_NO_NEW_CHARACTER_TYPES.
+ #if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) && _HAS_CHAR16_T_LANGUAGE_SUPPORT // VS2010+
+ #define EA_CHAR32_NATIVE 1
+ #elif defined(EA_COMPILER_CLANG) && defined(EA_COMPILER_CPP11_ENABLED)
+ #if __has_feature(cxx_unicode_literals)
+ #define EA_CHAR32_NATIVE 1
+ #elif (EA_COMPILER_VERSION >= 300) && !(defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX))
+ #define EA_CHAR32_NATIVE 1
+ #elif defined(EA_PLATFORM_APPLE)
+ #define EA_CHAR32_NATIVE 1
+ #else
+ #define EA_CHAR32_NATIVE 0
+ #endif
+ #elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 404) && defined(__CHAR32_TYPE__) && defined(EA_COMPILER_CPP11_ENABLED)// EDG 4.4+.
+ #define EA_CHAR32_NATIVE 1
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_EDG) && (defined(EA_COMPILER_CPP11_ENABLED) || defined(__STDC_VERSION__)) // g++ (C++ compiler) 4.4+ with -std=c++0x or gcc (C compiler) 4.4+ with -std=gnu99
+ #define EA_CHAR32_NATIVE 1
+ #else
+ #define EA_CHAR32_NATIVE 0
+ #endif
+#endif
+
+
+#if EA_CHAR16_NATIVE || EA_CHAR32_NATIVE
+ #define EA_WCHAR_UNIQUE 1
+#else
+ #define EA_WCHAR_UNIQUE 0
+#endif
+
+
+// EA_CHAR8_UNIQUE
+//
+// Check for char8_t support in the cpp type system. Moving forward from c++20,
+// the char8_t type allows users to overload function for character encoding.
+//
+// EA_CHAR8_UNIQUE is 1 when the type is a unique in the type system and
+// can there be used as a valid overload. EA_CHAR8_UNIQUE is 0 otherwise.
+//
+// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0482r6.html
+//
+#ifdef __cpp_char8_t
+ #define CHAR8_T_DEFINED
+ #define EA_CHAR8_UNIQUE 1
+#else
+ #define EA_CHAR8_UNIQUE 0
+#endif
+
+
+#ifndef CHAR8_T_DEFINED // If the user hasn't already defined these...
+ #define CHAR8_T_DEFINED
+ #if defined(EA_PLATFORM_APPLE)
+ #define char8_t char // The Apple debugger is too stupid to realize char8_t is typedef'd to char, so we #define it.
+ #else
+ typedef char char8_t;
+ #endif
+
+ #if EA_CHAR16_NATIVE
+ // In C++, char16_t and char32_t are already defined by the compiler.
+ // In MS C, char16_t and char32_t are already defined by the compiler/standard library.
+ // In GCC C, __CHAR16_TYPE__ and __CHAR32_TYPE__ are defined instead, and we must define char16_t and char32_t from these.
+ #if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(__CHAR16_TYPE__) // If using GCC and compiling in C...
+ typedef __CHAR16_TYPE__ char16_t;
+ typedef __CHAR32_TYPE__ char32_t;
+ #endif
+ #elif (EA_WCHAR_SIZE == 2)
+ #if (defined(_MSC_VER) && (_MSC_VER >= 1600)) // if VS2010+ or using platforms that use Dinkumware under a compiler that doesn't natively support C++11 char16_t.
+ #if !defined(_CHAR16T)
+ #define _CHAR16T
+ #endif
+ #if !defined(_HAS_CHAR16_T_LANGUAGE_SUPPORT) || !_HAS_CHAR16_T_LANGUAGE_SUPPORT
+ typedef wchar_t char16_t;
+ typedef uint32_t char32_t;
+ #endif
+ #else
+ typedef wchar_t char16_t;
+ typedef uint32_t char32_t;
+ #endif
+ #else
+ typedef uint16_t char16_t;
+ #if defined(__cplusplus)
+ typedef wchar_t char32_t;
+ #else
+ typedef uint32_t char32_t;
+ #endif
+ #endif
+#endif
+
+
+// CHAR8_MIN, CHAR8_MAX, etc.
+//
+#define EA_LIMITS_DIGITS_S(T) ((sizeof(T) * 8) - 1)
+#define EA_LIMITS_DIGITS_U(T) ((sizeof(T) * 8))
+#define EA_LIMITS_DIGITS(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_DIGITS_S(T) : EA_LIMITS_DIGITS_U(T)))
+#define EA_LIMITS_IS_SIGNED(T) ((T)(-1) < 0)
+#define EA_LIMITS_MIN_S(T) ((T)((T)1 << EA_LIMITS_DIGITS_S(T)))
+#define EA_LIMITS_MIN_U(T) ((T)0)
+#define EA_LIMITS_MIN(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_MIN_S(T) : EA_LIMITS_MIN_U(T)))
+#define EA_LIMITS_MAX_S(T) ((T)(((((T)1 << (EA_LIMITS_DIGITS(T) - 1)) - 1) << 1) + 1))
+#define EA_LIMITS_MAX_U(T) ((T)~(T)0)
+#define EA_LIMITS_MAX(T) ((EA_LIMITS_IS_SIGNED(T) ? EA_LIMITS_MAX_S(T) : EA_LIMITS_MAX_U(T)))
+
+#if !defined(CHAR8_MIN)
+ #define CHAR8_MIN EA_LIMITS_MIN(char8_t)
+#endif
+
+#if !defined(CHAR8_MAX)
+ #define CHAR8_MAX EA_LIMITS_MAX(char8_t)
+#endif
+
+#if !defined(CHAR16_MIN)
+ #define CHAR16_MIN EA_LIMITS_MIN(char16_t)
+#endif
+
+#if !defined(CHAR16_MAX)
+ #define CHAR16_MAX EA_LIMITS_MAX(char16_t)
+#endif
+
+#if !defined(CHAR32_MIN)
+ #define CHAR32_MIN EA_LIMITS_MIN(char32_t)
+#endif
+
+#if !defined(CHAR32_MAX)
+ #define CHAR32_MAX EA_LIMITS_MAX(char32_t)
+#endif
+
+
+
+// EA_CHAR8 / EA_CHAR16 / EA_CHAR32 / EA_WCHAR
+//
+// Supports usage of portable string constants.
+//
+// Example usage:
+// const char16_t* str = EA_CHAR16("Hello world");
+// const char32_t* str = EA_CHAR32("Hello world");
+// const char16_t c = EA_CHAR16('\x3001');
+// const char32_t c = EA_CHAR32('\x3001');
+//
+#ifndef EA_CHAR8
+ #if EA_CHAR8_UNIQUE
+ #define EA_CHAR8(s) u8 ## s
+ #else
+ #define EA_CHAR8(s) s
+ #endif
+#endif
+
+#ifndef EA_WCHAR
+ #define EA_WCHAR_(s) L ## s
+ #define EA_WCHAR(s) EA_WCHAR_(s)
+#endif
+
+#ifndef EA_CHAR16
+ #if EA_CHAR16_NATIVE && !defined(_MSC_VER) // Microsoft doesn't support char16_t string literals.
+ #define EA_CHAR16_(s) u ## s
+ #define EA_CHAR16(s) EA_CHAR16_(s)
+ #elif (EA_WCHAR_SIZE == 2)
+ #if defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(__cplusplus) // VS2015 supports u"" string literals.
+ #define EA_CHAR16_(s) u ## s
+ #define EA_CHAR16(s) EA_CHAR16_(s)
+ #else
+ #define EA_CHAR16_(s) L ## s
+ #define EA_CHAR16(s) EA_CHAR16_(s)
+ #endif
+ #else
+ //#define EA_CHAR16(s) // Impossible to implement efficiently.
+ #endif
+#endif
+
+#ifndef EA_CHAR32
+ #if EA_CHAR32_NATIVE && !defined(_MSC_VER) // Microsoft doesn't support char32_t string literals.
+ #define EA_CHAR32_(s) U ## s
+ #define EA_CHAR32(s) EA_CHAR32_(s)
+ #elif (EA_WCHAR_SIZE == 2)
+ #if defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(__cplusplus) // VS2015 supports u"" string literals.
+ #define EA_CHAR32_(s) U ## s
+ #define EA_CHAR32(s) EA_CHAR32_(s)
+ #else
+ //#define EA_CHAR32(s) // Impossible to implement.
+ #endif
+ #elif (EA_WCHAR_SIZE == 4)
+ #define EA_CHAR32_(s) L ## s
+ #define EA_CHAR32(s) EA_CHAR32_(s)
+ #else
+ #error Unexpected size of wchar_t
+ #endif
+#endif
+
+// EAText8 / EAText16
+//
+// Provided for backwards compatibility with older code.
+//
+#if defined(EABASE_ENABLE_EATEXT_MACROS)
+ #define EAText8(x) x
+ #define EAChar8(x) x
+
+ #define EAText16(x) EA_CHAR16(x)
+ #define EAChar16(x) EA_CHAR16(x)
+#endif
+
+
+
+
+// ------------------------------------------------------------------------
+// EAArrayCount
+//
+// Returns the count of items in a built-in C array. This is a common technique
+// which is often used to help properly calculate the number of items in an
+// array at runtime in order to prevent overruns, etc.
+//
+// Example usage:
+// int array[75];
+// size_t arrayCount = EAArrayCount(array); // arrayCount is 75.
+//
+#if defined(EA_COMPILER_NO_CONSTEXPR)
+ #ifndef EAArrayCount
+ #define EAArrayCount(x) (sizeof(x) / sizeof(x[0]))
+ #endif
+#else
+ // This C++11 version is a little smarter than the macro version above;
+ // it can tell the difference between arrays and pointers. Other simpler
+ // templated versions have failed in various subtle ways.
+
+ template <typename T, size_t N>
+ char (&EAArraySizeHelper(T (&x)[N]))[N];
+
+ template <typename T, size_t N>
+ char (&EAArraySizeHelper(T (&&x)[N]))[N];
+
+ #define EAArrayCount(x) (sizeof(EAArraySizeHelper(x)))
+#endif
+
+
+// ------------------------------------------------------------------------
+// static_assert
+//
+// C++11 static_assert (a.k.a. compile-time assert).
+//
+// Specification:
+// void static_assert(bool const_expression, const char* description);
+//
+// Example usage:
+// static_assert(sizeof(int) == 4, "int must be 32 bits");
+//
+#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) && ((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)
+ // We need to separate these checks on a new line, as the pre-processor on other compilers will fail on the _has_feature macros
+ #if !(__has_feature(cxx_static_assert) || __has_extension(cxx_static_assert))
+ #define NEED_CUSTOM_STATIC_ASSERT
+ #endif
+#elif defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && (__cplusplus >= 201103L)))
+ // static_assert is defined by the compiler.
+#elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 401) && defined(EA_COMPILER_CPP11_ENABLED)
+ // static_assert is defined by the compiler.
+#elif !defined(__cplusplus) && defined(__GLIBC__) && defined(__USE_ISOC11)
+ // static_assert is defined by the compiler.
+#elif !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201100L
+ // static_assert is defined by the compiler.
+#else
+ #define NEED_CUSTOM_STATIC_ASSERT
+#endif
+
+#ifdef NEED_CUSTOM_STATIC_ASSERT
+ #ifdef __GNUC__
+ // On GCC the 'unused' attribute can be used to indicate a typedef is not actually used
+ // (such as in the static_assert implementation below). New versions of GCC generate
+ // warnings for unused typedefs in function/method scopes.
+ #define EA_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
+ #else
+ #define EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
+ #endif
+ #define EA_STATIC_ASSERT_TOKEN_PASTE(a,b) a ## b
+ #define EA_STATIC_ASSERT_CONCATENATE_HELPER(a,b) EA_STATIC_ASSERT_TOKEN_PASTE(a,b)
+
+ #if defined(__COUNTER__) // If this extension is available, which allows multiple statements per line...
+ #define static_assert(expression, description) typedef char EA_STATIC_ASSERT_CONCATENATE_HELPER(compileTimeAssert,__COUNTER__) [((expression) != 0) ? 1 : -1] EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
+ #else
+ #define static_assert(expression, description) typedef char EA_STATIC_ASSERT_CONCATENATE_HELPER(compileTimeAssert,__LINE__) [((expression) != 0) ? 1 : -1] EA_STATIC_ASSERT_UNUSED_ATTRIBUTE
+ #endif
+
+ #undef NEED_CUSTOM_STATIC_ASSERT
+#endif
+
+// ------------------------------------------------------------------------
+// EA_IS_ENABLED
+//
+// EA_IS_ENABLED is intended to be used for detecting if compile time features are enabled or disabled.
+//
+// It has some advantages over using a standard #if or #ifdef tests:
+// 1) Fails to compile when passes numeric macro values. Valid options are strictly enabled or disabled.
+// 2) Fails to compile when passed undefined macro values rather than disabling by default
+// 3) Fails to compile when the passed macro is defined to but empty
+//
+// To use the macro, the calling code should create a define for the feature to enable or disable. This feature define
+// must be set to either EA_ENABLED or EA_DISABLED. (Do not try to set the feature define directly to some other
+// value.)
+//
+// Note: These macros are analogous to the Frostbite macro FB_USING used in combination with FB_OFF / FB_ON and are
+// designed to be compatible to support gradual migration.
+//
+// Example usage:
+//
+// // The USER_PROVIDED_FEATURE_DEFINE should be defined as either
+// // EA_ENABLED or EA_DISABLED.
+// #define USER_PROVIDED_FEATURE_DEFINE EA_ENABLED
+//
+// #if EA_IS_ENABLED(USER_PROVIDED_FEATURE_DEFINE)
+// // USER_PROVIDED_FEATURE_DEFINE is enabled
+// #else
+// // USER_PROVIDED_FEATURE_DEFINE is disabled
+// #endif
+//
+#define EA_ENABLED 111-
+#define EA_DISABLED 333-
+// NOTE: Numeric values for x will produce a parse error while empty values produce a divide by zero, and the test is a bool for proper negation behavior
+#define EA_IS_ENABLED(x) (333 == 333 * 111 / ((x 0) * (((x 0) == 333 ? 1 : 0) + ((x 0) == 111 ? 1 : 0))))
+
+
+
+// Define int128_t / uint128_t types.
+// NOTE(rparolin): include file at the end because we want all the signed integral types defined.
+#ifdef __cplusplus
+ #include <EABase/int128.h>
+#endif
+
+#endif // Header include guard
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/eahave.h b/EASTL/test/packages/EABase/include/Common/EABase/eahave.h
new file mode 100644
index 0000000..b0987be
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/eahave.h
@@ -0,0 +1,877 @@
+/*-----------------------------------------------------------------------------
+ * eahave.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------------
+ This file's functionality is preliminary and won't be considered stable until
+ a future EABase version.
+ *---------------------------------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------------
+ This header identifies if the given facilities are available in the
+ standard build environment the current compiler/linker/standard library/
+ operating system combination. This file may in some cases #include standard
+ headers in order to make availability determinations, such as to check
+ compiler or SDK version numbers. However, it cannot be perfect.
+ This header does not identify compiler features, as those are defined in
+ eacompiler.h and eacompilertraits.h. Rather this header is about library support.
+ This header does not identify platform or library conventions either, such
+ as whether the file paths use \ or / for directory separators.
+
+ We provide three types of HAVE features here:
+
+ - EA_HAVE_XXX_FEATURE - Have compiler feature.
+ Identifies if the compiler has or lacks some feature in the
+ current build. Sometimes you need to check to see if the
+ compiler is running in some mode in able to write portable code
+ against it. For example, some compilers (e.g. VC++) have a
+ mode in which all language extensions are disabled. If you want
+ to write code that works with that but still uses the extensions
+ when available then you can check #if defined(EA_HAVE_EXTENSIONS_FEATURE).
+ Features can be forcibly cancelled via EA_NO_HAVE_XXX_FEATURE.
+ EA_NO_HAVE is useful for a build system or user to override the
+ defaults because it happens to know better.
+
+ - EA_HAVE_XXX_H - Have header file information.
+ Identifies if a given header file is available to the current
+ compile configuration. For example, some compilers provide a
+ malloc.h header, while others don't. For the former we define
+ EA_HAVE_MALLOC_H, while for the latter it remains undefined.
+ If a header is missing then it may still be that the functions
+ the header usually declares are declared in some other header.
+ EA_HAVE_XXX does not include the possibility that our own code
+ provides versions of these headers, and in fact a purpose of
+ EA_HAVE_XXX is to decide if we should be using our own because
+ the system doesn't provide one.
+ Header availability can be forcibly cancelled via EA_NO_HAVE_XXX_H.
+ EA_NO_HAVE is useful for a build system or user to override the
+ defaults because it happens to know better.
+
+ - EA_HAVE_XXX_DECL - Have function declaration information.
+ Identifies if a given function declaration is provided by
+ the current compile configuration. For example, some compiler
+ standard libraries declare a wcslen function, while others
+ don't. For the former we define EA_HAVE_WCSLEN_DECL, while for
+ the latter it remains undefined. If a declaration of a function
+ is missing then we assume the implementation is missing as well.
+ EA_HAVE_XXX_DECL does not include the possibility that our
+ own code provides versions of these declarations, and in fact a
+ purpose of EA_HAVE_XXX_DECL is to decide if we should be using
+ our own because the system doesn't provide one.
+ Declaration availability can be forcibly cancelled via EA_NO_HAVE_XXX_DECL.
+ EA_NO_HAVE is useful for a build system or user to override the
+ defaults because it happens to know better.
+
+ - EA_HAVE_XXX_IMPL - Have function implementation information.
+ Identifies if a given function implementation is provided by
+ the current compile and link configuration. For example, it's
+ commonly the case that console platforms declare a getenv function
+ but don't provide a linkable implementation.
+ In this case the user needs to provide such a function manually
+ as part of the link. If the implementation is available then
+ we define EA_HAVE_GETENV_IMPL, otherwise it remains undefined.
+ Beware that sometimes a function may not seem to be present in
+ the Standard Library but in reality you need to link some auxiliary
+ provided library for it. An example of this is the Unix real-time
+ functions such as clock_gettime.
+ EA_HAVE_XXX_IMPL does not include the possibility that our
+ own code provides versions of these implementations, and in fact a
+ purpose of EA_HAVE_XXX_IMPL is to decide if we should be using
+ our own because the system doesn't provide one.
+ Implementation availability can be forcibly cancelled via EA_NO_HAVE_XXX_IMPL.
+ EA_NO_HAVE is useful for a build system or user to override the
+ defaults because it happens to know better.
+
+ It's not practical to define EA_HAVE macros for every possible header,
+ declaration, and implementation, and so the user must simply know that
+ some headers, declarations, and implementations tend to require EA_HAVE
+ checking. Nearly every C Standard Library we've seen has a <string.h>
+ header, a strlen declaration, and a linkable strlen implementation,
+ so there's no need to provide EA_HAVE support for this. On the other hand
+ it's commonly the case that the C Standard Library doesn't have a malloc.h
+ header or an inet_ntop declaration.
+
+---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_eahave_H
+#define INCLUDED_eahave_H
+
+
+#include <EABase/eabase.h>
+
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
+#endif
+
+/* EA_HAVE_XXX_FEATURE */
+
+#if !defined(EA_HAVE_EXTENSIONS_FEATURE) && !defined(EA_NO_HAVE_EXTENSIONS_FEATURE)
+ #define EA_HAVE_EXTENSIONS_FEATURE 1
+#endif
+
+
+/* EA_HAVE_XXX_LIBRARY */
+
+// Dinkumware
+#if !defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && !defined(EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY)
+ #if defined(__cplusplus)
+ EA_DISABLE_ALL_VC_WARNINGS()
+ #include <cstddef> // Need to trigger the compilation of yvals.h without directly using <yvals.h> because it might not exist.
+ EA_RESTORE_ALL_VC_WARNINGS()
+ #endif
+
+ #if defined(__cplusplus) && defined(_CPPLIB_VER) /* If using the Dinkumware Standard library... */
+ #define EA_HAVE_DINKUMWARE_CPP_LIBRARY 1
+ #else
+ #define EA_NO_HAVE_DINKUMWARE_CPP_LIBRARY 1
+ #endif
+#endif
+
+// GCC libstdc++
+#if !defined(EA_HAVE_LIBSTDCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBSTDCPP_LIBRARY)
+ #if defined(__GLIBCXX__) /* If using libstdc++ ... */
+ #define EA_HAVE_LIBSTDCPP_LIBRARY 1
+ #else
+ #define EA_NO_HAVE_LIBSTDCPP_LIBRARY 1
+ #endif
+#endif
+
+// Clang libc++
+#if !defined(EA_HAVE_LIBCPP_LIBRARY) && !defined(EA_NO_HAVE_LIBCPP_LIBRARY)
+ #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
+
+ #if !defined(EA_HAVE_LIBCPP_LIBRARY)
+ #define EA_NO_HAVE_LIBCPP_LIBRARY 1
+ #endif
+#endif
+
+
+/* EA_HAVE_XXX_H */
+
+// #include <sys/types.h>
+#if !defined(EA_HAVE_SYS_TYPES_H) && !defined(EA_NO_HAVE_SYS_TYPES_H)
+ #define EA_HAVE_SYS_TYPES_H 1
+#endif
+
+// #include <io.h> (and not sys/io.h or asm/io.h)
+#if !defined(EA_HAVE_IO_H) && !defined(EA_NO_HAVE_IO_H)
+ // Unix doesn't have Microsoft's <io.h> but has the same functionality in <fcntl.h> and <sys/stat.h>.
+ #if defined(EA_PLATFORM_MICROSOFT)
+ #define EA_HAVE_IO_H 1
+ #else
+ #define EA_NO_HAVE_IO_H 1
+ #endif
+#endif
+
+// #include <inttypes.h>
+#if !defined(EA_HAVE_INTTYPES_H) && !defined(EA_NO_HAVE_INTTYPES_H)
+ #if !defined(EA_PLATFORM_MICROSOFT)
+ #define EA_HAVE_INTTYPES_H 1
+ #else
+ #define EA_NO_HAVE_INTTYPES_H 1
+ #endif
+#endif
+
+// #include <unistd.h>
+#if !defined(EA_HAVE_UNISTD_H) && !defined(EA_NO_HAVE_UNISTD_H)
+ #if defined(EA_PLATFORM_UNIX)
+ #define EA_HAVE_UNISTD_H 1
+ #else
+ #define EA_NO_HAVE_UNISTD_H 1
+ #endif
+#endif
+
+// #include <sys/time.h>
+#if !defined(EA_HAVE_SYS_TIME_H) && !defined(EA_NO_HAVE_SYS_TIME_H)
+ #if !defined(EA_PLATFORM_MICROSOFT) && !defined(_CPPLIB_VER) /* _CPPLIB_VER indicates Dinkumware. */
+ #define EA_HAVE_SYS_TIME_H 1 /* defines struct timeval */
+ #else
+ #define EA_NO_HAVE_SYS_TIME_H 1
+ #endif
+#endif
+
+// #include <ptrace.h>
+#if !defined(EA_HAVE_SYS_PTRACE_H) && !defined(EA_NO_HAVE_SYS_PTRACE_H)
+ #if defined(EA_PLATFORM_UNIX) && !defined(__CYGWIN__) && (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_SERVER))
+ #define EA_HAVE_SYS_PTRACE_H 1 /* declares the ptrace function */
+ #else
+ #define EA_NO_HAVE_SYS_PTRACE_H 1
+ #endif
+#endif
+
+// #include <sys/stat.h>
+#if !defined(EA_HAVE_SYS_STAT_H) && !defined(EA_NO_HAVE_SYS_STAT_H)
+ #if (defined(EA_PLATFORM_UNIX) && !(defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_CONSOLE))) || defined(__APPLE__) || defined(EA_PLATFORM_ANDROID)
+ #define EA_HAVE_SYS_STAT_H 1 /* declares the stat struct and function */
+ #else
+ #define EA_NO_HAVE_SYS_STAT_H 1
+ #endif
+#endif
+
+// #include <locale.h>
+#if !defined(EA_HAVE_LOCALE_H) && !defined(EA_NO_HAVE_LOCALE_H)
+ #define EA_HAVE_LOCALE_H 1
+#endif
+
+// #include <signal.h>
+#if !defined(EA_HAVE_SIGNAL_H) && !defined(EA_NO_HAVE_SIGNAL_H)
+ #if !defined(EA_PLATFORM_BSD) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
+ #define EA_HAVE_SIGNAL_H 1
+ #else
+ #define EA_NO_HAVE_SIGNAL_H 1
+ #endif
+#endif
+
+// #include <sys/signal.h>
+#if !defined(EA_HAVE_SYS_SIGNAL_H) && !defined(EA_NO_HAVE_SYS_SIGNAL_H)
+ #if defined(EA_PLATFORM_BSD) || defined(EA_PLATFORM_SONY)
+ #define EA_HAVE_SYS_SIGNAL_H 1
+ #else
+ #define EA_NO_HAVE_SYS_SIGNAL_H 1
+ #endif
+#endif
+
+// #include <pthread.h>
+#if !defined(EA_HAVE_PTHREAD_H) && !defined(EA_NO_HAVE_PTHREAD_H)
+ #if defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_APPLE) || defined(EA_PLATFORM_POSIX)
+ #define EA_HAVE_PTHREAD_H 1 /* It can be had under Microsoft/Windows with the http://sourceware.org/pthreads-win32/ library */
+ #else
+ #define EA_NO_HAVE_PTHREAD_H 1
+ #endif
+#endif
+
+// #include <wchar.h>
+#if !defined(EA_HAVE_WCHAR_H) && !defined(EA_NO_HAVE_WCHAR_H)
+ #if defined(EA_PLATFORM_DESKTOP) && defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_SONY) && defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_WCHAR_H 1
+ #else
+ #define EA_NO_HAVE_WCHAR_H 1
+ #endif
+#endif
+
+// #include <malloc.h>
+#if !defined(EA_HAVE_MALLOC_H) && !defined(EA_NO_HAVE_MALLOC_H)
+ #if defined(_MSC_VER) || defined(__MINGW32__)
+ #define EA_HAVE_MALLOC_H 1
+ #else
+ #define EA_NO_HAVE_MALLOC_H 1
+ #endif
+#endif
+
+// #include <alloca.h>
+#if !defined(EA_HAVE_ALLOCA_H) && !defined(EA_NO_HAVE_ALLOCA_H)
+ #if !defined(EA_HAVE_MALLOC_H) && !defined(EA_PLATFORM_SONY)
+ #define EA_HAVE_ALLOCA_H 1
+ #else
+ #define EA_NO_HAVE_ALLOCA_H 1
+ #endif
+#endif
+
+// #include <execinfo.h>
+#if !defined(EA_HAVE_EXECINFO_H) && !defined(EA_NO_HAVE_EXECINFO_H)
+ #if (defined(EA_PLATFORM_LINUX) || defined(EA_PLATFORM_OSX)) && !defined(EA_PLATFORM_ANDROID)
+ #define EA_HAVE_EXECINFO_H 1
+ #else
+ #define EA_NO_HAVE_EXECINFO_H 1
+ #endif
+#endif
+
+// #include <semaphore.h> (Unix semaphore support)
+#if !defined(EA_HAVE_SEMAPHORE_H) && !defined(EA_NO_HAVE_SEMAPHORE_H)
+ #if defined(EA_PLATFORM_UNIX)
+ #define EA_HAVE_SEMAPHORE_H 1
+ #else
+ #define EA_NO_HAVE_SEMAPHORE_H 1
+ #endif
+#endif
+
+// #include <dirent.h> (Unix semaphore support)
+#if !defined(EA_HAVE_DIRENT_H) && !defined(EA_NO_HAVE_DIRENT_H)
+ #if defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_CONSOLE)
+ #define EA_HAVE_DIRENT_H 1
+ #else
+ #define EA_NO_HAVE_DIRENT_H 1
+ #endif
+#endif
+
+// #include <array>, <forward_list>, <ununordered_set>, <unordered_map>
+#if !defined(EA_HAVE_CPP11_CONTAINERS) && !defined(EA_NO_HAVE_CPP11_CONTAINERS)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_CONTAINERS 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) // Actually GCC 4.3 supports array and unordered_
+ #define EA_HAVE_CPP11_CONTAINERS 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_CONTAINERS 1
+ #else
+ #define EA_NO_HAVE_CPP11_CONTAINERS 1
+ #endif
+#endif
+
+// #include <atomic>
+#if !defined(EA_HAVE_CPP11_ATOMIC) && !defined(EA_NO_HAVE_CPP11_ATOMIC)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_ATOMIC 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
+ #define EA_HAVE_CPP11_ATOMIC 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_ATOMIC 1
+ #else
+ #define EA_NO_HAVE_CPP11_ATOMIC 1
+ #endif
+#endif
+
+// #include <condition_variable>
+#if !defined(EA_HAVE_CPP11_CONDITION_VARIABLE) && !defined(EA_NO_HAVE_CPP11_CONDITION_VARIABLE)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_CONDITION_VARIABLE 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
+ #define EA_HAVE_CPP11_CONDITION_VARIABLE 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_CONDITION_VARIABLE 1
+ #else
+ #define EA_NO_HAVE_CPP11_CONDITION_VARIABLE 1
+ #endif
+#endif
+
+// #include <mutex>
+#if !defined(EA_HAVE_CPP11_MUTEX) && !defined(EA_NO_HAVE_CPP11_MUTEX)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_MUTEX 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
+ #define EA_HAVE_CPP11_MUTEX 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_MUTEX 1
+ #else
+ #define EA_NO_HAVE_CPP11_MUTEX 1
+ #endif
+#endif
+
+// #include <thread>
+#if !defined(EA_HAVE_CPP11_THREAD) && !defined(EA_NO_HAVE_CPP11_THREAD)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_THREAD 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
+ #define EA_HAVE_CPP11_THREAD 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_THREAD 1
+ #else
+ #define EA_NO_HAVE_CPP11_THREAD 1
+ #endif
+#endif
+
+// #include <future>
+#if !defined(EA_HAVE_CPP11_FUTURE) && !defined(EA_NO_HAVE_CPP11_FUTURE)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_FUTURE 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
+ #define EA_HAVE_CPP11_FUTURE 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_FUTURE 1
+ #else
+ #define EA_NO_HAVE_CPP11_FUTURE 1
+ #endif
+#endif
+
+
+// #include <type_traits>
+#if !defined(EA_HAVE_CPP11_TYPE_TRAITS) && !defined(EA_NO_HAVE_CPP11_TYPE_TRAITS)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_TYPE_TRAITS 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // Prior versions of libstdc++ have incomplete support for C++11 type traits.
+ #define EA_HAVE_CPP11_TYPE_TRAITS 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_TYPE_TRAITS 1
+ #else
+ #define EA_NO_HAVE_CPP11_TYPE_TRAITS 1
+ #endif
+#endif
+
+// #include <tuple>
+#if !defined(EA_HAVE_CPP11_TUPLES) && !defined(EA_NO_HAVE_CPP11_TUPLES)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_TUPLES 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
+ #define EA_HAVE_CPP11_TUPLES 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_TUPLES 1
+ #else
+ #define EA_NO_HAVE_CPP11_TUPLES 1
+ #endif
+#endif
+
+// #include <regex>
+#if !defined(EA_HAVE_CPP11_REGEX) && !defined(EA_NO_HAVE_CPP11_REGEX)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) && (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_REGEX 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4003)
+ #define EA_HAVE_CPP11_REGEX 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_REGEX 1
+ #else
+ #define EA_NO_HAVE_CPP11_REGEX 1
+ #endif
+#endif
+
+// #include <random>
+#if !defined(EA_HAVE_CPP11_RANDOM) && !defined(EA_NO_HAVE_CPP11_RANDOM)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_RANDOM 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4005)
+ #define EA_HAVE_CPP11_RANDOM 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_RANDOM 1
+ #else
+ #define EA_NO_HAVE_CPP11_RANDOM 1
+ #endif
+#endif
+
+// #include <chrono>
+#if !defined(EA_HAVE_CPP11_CHRONO) && !defined(EA_NO_HAVE_CPP11_CHRONO)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_CHRONO 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007) // chrono was broken in glibc prior to 4.7.
+ #define EA_HAVE_CPP11_CHRONO 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_CHRONO 1
+ #else
+ #define EA_NO_HAVE_CPP11_CHRONO 1
+ #endif
+#endif
+
+// #include <scoped_allocator>
+#if !defined(EA_HAVE_CPP11_SCOPED_ALLOCATOR) && !defined(EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 540) // Dinkumware. VS2012+
+ #define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4007)
+ #define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_SCOPED_ALLOCATOR 1
+ #else
+ #define EA_NO_HAVE_CPP11_SCOPED_ALLOCATOR 1
+ #endif
+#endif
+
+// #include <initializer_list>
+#if !defined(EA_HAVE_CPP11_INITIALIZER_LIST) && !defined(EA_NO_HAVE_CPP11_INITIALIZER_LIST)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_INITIALIZER_LIST 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_CPP11_INITIALIZER_LIST 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_CPP11_INITIALIZER_LIST 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS) && !defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_CPP11_INITIALIZER_LIST 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1) && !defined(EA_COMPILER_NO_INITIALIZER_LISTS)
+ #define EA_HAVE_CPP11_INITIALIZER_LIST 1
+ #else
+ #define EA_NO_HAVE_CPP11_INITIALIZER_LIST 1
+ #endif
+#endif
+
+// #include <system_error>
+#if !defined(EA_HAVE_CPP11_SYSTEM_ERROR) && !defined(EA_NO_HAVE_CPP11_SYSTEM_ERROR)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_SYSTEM_ERROR 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION >= 301) && !defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_CPP11_SYSTEM_ERROR 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004) && !defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_CPP11_SYSTEM_ERROR 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_SYSTEM_ERROR 1
+ #else
+ #define EA_NO_HAVE_CPP11_SYSTEM_ERROR 1
+ #endif
+#endif
+
+// #include <codecvt>
+#if !defined(EA_HAVE_CPP11_CODECVT) && !defined(EA_NO_HAVE_CPP11_CODECVT)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_CODECVT 1
+ // Future versions of libc++ may support this header. However, at the moment there isn't
+ // a reliable way of detecting if this header is available.
+ //#elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4008)
+ // #define EA_HAVE_CPP11_CODECVT 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_CODECVT 1
+ #else
+ #define EA_NO_HAVE_CPP11_CODECVT 1
+ #endif
+#endif
+
+// #include <typeindex>
+#if !defined(EA_HAVE_CPP11_TYPEINDEX) && !defined(EA_NO_HAVE_CPP11_TYPEINDEX)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_TYPEINDEX 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
+ #define EA_HAVE_CPP11_TYPEINDEX 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_TYPEINDEX 1
+ #else
+ #define EA_NO_HAVE_CPP11_TYPEINDEX 1
+ #endif
+#endif
+
+
+
+
+/* EA_HAVE_XXX_DECL */
+
+#if !defined(EA_HAVE_mkstemps_DECL) && !defined(EA_NO_HAVE_mkstemps_DECL)
+ #if defined(EA_PLATFORM_APPLE) || defined(CS_UNDEFINED_STRING)
+ #define EA_HAVE_mkstemps_DECL 1
+ #else
+ #define EA_NO_HAVE_mkstemps_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_gettimeofday_DECL) && !defined(EA_NO_HAVE_gettimeofday_DECL)
+ #if defined(EA_PLATFORM_POSIX) /* Posix means Linux, Unix, and Macintosh OSX, among others (including Linux-based mobile platforms). */
+ #define EA_HAVE_gettimeofday_DECL 1
+ #else
+ #define EA_NO_HAVE_gettimeofday_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_strcasecmp_DECL) && !defined(EA_NO_HAVE_strcasecmp_DECL)
+ #if !defined(EA_PLATFORM_MICROSOFT)
+ #define EA_HAVE_strcasecmp_DECL 1 /* This is found as stricmp when not found as strcasecmp */
+ #define EA_HAVE_strncasecmp_DECL 1
+ #else
+ #define EA_HAVE_stricmp_DECL 1
+ #define EA_HAVE_strnicmp_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_mmap_DECL) && !defined(EA_NO_HAVE_mmap_DECL)
+ #if defined(EA_PLATFORM_POSIX)
+ #define EA_HAVE_mmap_DECL 1 /* mmap functionality varies significantly between systems. */
+ #else
+ #define EA_NO_HAVE_mmap_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_fopen_DECL) && !defined(EA_NO_HAVE_fopen_DECL)
+ #define EA_HAVE_fopen_DECL 1 /* C FILE functionality such as fopen */
+#endif
+
+#if !defined(EA_HAVE_ISNAN) && !defined(EA_NO_HAVE_ISNAN)
+ #if defined(EA_PLATFORM_MICROSOFT) && !defined(EA_PLATFORM_MINGW)
+ #define EA_HAVE_ISNAN(x) _isnan(x) /* declared in <math.h> */
+ #define EA_HAVE_ISINF(x) !_finite(x)
+ #elif defined(EA_PLATFORM_APPLE)
+ #define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
+ #define EA_HAVE_ISINF(x) std::isinf(x)
+ #elif defined(EA_PLATFORM_ANDROID)
+ #define EA_HAVE_ISNAN(x) __builtin_isnan(x) /* There are a number of standard libraries for Android and it's hard to tell them apart, so just go with builtins */
+ #define EA_HAVE_ISINF(x) __builtin_isinf(x)
+ #elif defined(__GNUC__) && defined(__CYGWIN__)
+ #define EA_HAVE_ISNAN(x) __isnand(x) /* declared nowhere, it seems. */
+ #define EA_HAVE_ISINF(x) __isinfd(x)
+ #else
+ #define EA_HAVE_ISNAN(x) std::isnan(x) /* declared in <cmath> */
+ #define EA_HAVE_ISINF(x) std::isinf(x)
+ #endif
+#endif
+
+#if !defined(EA_HAVE_itoa_DECL) && !defined(EA_NO_HAVE_itoa_DECL)
+ #if defined(EA_COMPILER_MSVC)
+ #define EA_HAVE_itoa_DECL 1
+ #else
+ #define EA_NO_HAVE_itoa_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_nanosleep_DECL) && !defined(EA_NO_HAVE_nanosleep_DECL)
+ #if (defined(EA_PLATFORM_UNIX) && !defined(EA_PLATFORM_SONY)) || defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_OSX) || defined(EA_PLATFORM_SONY) || defined(CS_UNDEFINED_STRING)
+ #define EA_HAVE_nanosleep_DECL 1
+ #else
+ #define EA_NO_HAVE_nanosleep_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_utime_DECL) && !defined(EA_NO_HAVE_utime_DECL)
+ #if defined(EA_PLATFORM_MICROSOFT)
+ #define EA_HAVE_utime_DECL _utime
+ #elif EA_PLATFORM_UNIX
+ #define EA_HAVE_utime_DECL utime
+ #else
+ #define EA_NO_HAVE_utime_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_ftruncate_DECL) && !defined(EA_NO_HAVE_ftruncate_DECL)
+ #if !defined(__MINGW32__)
+ #define EA_HAVE_ftruncate_DECL 1
+ #else
+ #define EA_NO_HAVE_ftruncate_DECL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_localtime_DECL) && !defined(EA_NO_HAVE_localtime_DECL)
+ #define EA_HAVE_localtime_DECL 1
+#endif
+
+#if !defined(EA_HAVE_pthread_getattr_np_DECL) && !defined(EA_NO_HAVE_pthread_getattr_np_DECL)
+ #if defined(EA_PLATFORM_LINUX)
+ #define EA_HAVE_pthread_getattr_np_DECL 1
+ #else
+ #define EA_NO_HAVE_pthread_getattr_np_DECL 1
+ #endif
+#endif
+
+
+
+/* EA_HAVE_XXX_IMPL*/
+
+#if !defined(EA_HAVE_WCHAR_IMPL) && !defined(EA_NO_HAVE_WCHAR_IMPL)
+ #if defined(EA_PLATFORM_DESKTOP)
+ #define EA_HAVE_WCHAR_IMPL 1 /* Specifies if wchar_t string functions are provided, such as wcslen, wprintf, etc. Implies EA_HAVE_WCHAR_H */
+ #else
+ #define EA_NO_HAVE_WCHAR_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_getenv_IMPL) && !defined(EA_NO_HAVE_getenv_IMPL)
+ #if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
+ #define EA_HAVE_getenv_IMPL 1
+ #else
+ #define EA_NO_HAVE_getenv_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_setenv_IMPL) && !defined(EA_NO_HAVE_setenv_IMPL)
+ #if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
+ #define EA_HAVE_setenv_IMPL 1
+ #else
+ #define EA_NO_HAVE_setenv_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_unsetenv_IMPL) && !defined(EA_NO_HAVE_unsetenv_IMPL)
+ #if defined(EA_PLATFORM_UNIX) && defined(EA_PLATFORM_POSIX)
+ #define EA_HAVE_unsetenv_IMPL 1
+ #else
+ #define EA_NO_HAVE_unsetenv_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_putenv_IMPL) && !defined(EA_NO_HAVE_putenv_IMPL)
+ #if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_WINRT)
+ #define EA_HAVE_putenv_IMPL 1 /* With Microsoft compilers you may need to use _putenv, as they have deprecated putenv. */
+ #else
+ #define EA_NO_HAVE_putenv_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_time_IMPL) && !defined(EA_NO_HAVE_time_IMPL)
+ #define EA_HAVE_time_IMPL 1
+ #define EA_HAVE_clock_IMPL 1
+#endif
+
+// <cstdio> fopen()
+#if !defined(EA_HAVE_fopen_IMPL) && !defined(EA_NO_HAVE_fopen_IMPL)
+ #define EA_HAVE_fopen_IMPL 1 /* C FILE functionality such as fopen */
+#endif
+
+// <arpa/inet.h> inet_ntop()
+#if !defined(EA_HAVE_inet_ntop_IMPL) && !defined(EA_NO_HAVE_inet_ntop_IMPL)
+ #if (defined(EA_PLATFORM_UNIX) || defined(EA_PLATFORM_POSIX)) && !defined(EA_PLATFORM_SONY) && !defined(CS_UNDEFINED_STRING)
+ #define EA_HAVE_inet_ntop_IMPL 1 /* This doesn't identify if the platform SDK has some alternative function that does the same thing; */
+ #define EA_HAVE_inet_pton_IMPL 1 /* it identifies strictly the <arpa/inet.h> inet_ntop and inet_pton functions. For example, Microsoft has InetNtop in <Ws2tcpip.h> */
+ #else
+ #define EA_NO_HAVE_inet_ntop_IMPL 1
+ #define EA_NO_HAVE_inet_pton_IMPL 1
+ #endif
+#endif
+
+// <time.h> clock_gettime()
+#if !defined(EA_HAVE_clock_gettime_IMPL) && !defined(EA_NO_HAVE_clock_gettime_IMPL)
+ #if defined(EA_PLATFORM_LINUX) || defined(__CYGWIN__) || (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || (defined(EA_PLATFORM_POSIX) && defined(_CPPLIB_VER) /*Dinkumware*/)
+ #define EA_HAVE_clock_gettime_IMPL 1 /* You need to link the 'rt' library to get this */
+ #else
+ #define EA_NO_HAVE_clock_gettime_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_getcwd_IMPL) && !defined(EA_NO_HAVE_getcwd_IMPL)
+ #if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID) && !defined(EA_PLATFORM_WINRT)
+ #define EA_HAVE_getcwd_IMPL 1 /* With Microsoft compilers you may need to use _getcwd, as they have deprecated getcwd. And in any case it's present at <direct.h> */
+ #else
+ #define EA_NO_HAVE_getcwd_IMPL 1
+ #endif
+#endif
+
+#if !defined(EA_HAVE_tmpnam_IMPL) && !defined(EA_NO_HAVE_tmpnam_IMPL)
+ #if (defined(EA_PLATFORM_DESKTOP) || defined(EA_PLATFORM_UNIX)) && !defined(EA_PLATFORM_ANDROID)
+ #define EA_HAVE_tmpnam_IMPL 1
+ #else
+ #define EA_NO_HAVE_tmpnam_IMPL 1
+ #endif
+#endif
+
+// nullptr, the built-in C++11 type.
+// This EA_HAVE is deprecated, as EA_COMPILER_NO_NULLPTR is more appropriate, given that nullptr is a compiler-level feature and not a library feature.
+#if !defined(EA_HAVE_nullptr_IMPL) && !defined(EA_NO_HAVE_nullptr_IMPL)
+ #if defined(EA_COMPILER_NO_NULLPTR)
+ #define EA_NO_HAVE_nullptr_IMPL 1
+ #else
+ #define EA_HAVE_nullptr_IMPL 1
+ #endif
+#endif
+
+// <cstddef> std::nullptr_t
+// Note that <EABase/nullptr.h> implements a portable nullptr implementation, but this
+// EA_HAVE specifically refers to std::nullptr_t from the standard libraries.
+#if !defined(EA_HAVE_nullptr_t_IMPL) && !defined(EA_NO_HAVE_nullptr_t_IMPL)
+ #if defined(EA_COMPILER_CPP11_ENABLED)
+ // VS2010+ with its default Dinkumware standard library.
+ #if defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY)
+ #define EA_HAVE_nullptr_t_IMPL 1
+
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) // clang/llvm libc++
+ #define EA_HAVE_nullptr_t_IMPL 1
+
+ #elif defined(EA_HAVE_LIBSTDCPP_LIBRARY) // GNU libstdc++
+ // Unfortunately __GLIBCXX__ date values don't go strictly in version ordering.
+ #if (__GLIBCXX__ >= 20110325) && (__GLIBCXX__ != 20120702) && (__GLIBCXX__ != 20110428)
+ #define EA_HAVE_nullptr_t_IMPL 1
+ #else
+ #define EA_NO_HAVE_nullptr_t_IMPL 1
+ #endif
+
+ // We simply assume that the standard library (e.g. Dinkumware) provides std::nullptr_t.
+ #elif defined(__clang__)
+ #define EA_HAVE_nullptr_t_IMPL 1
+
+ // With GCC compiler >= 4.6, std::nullptr_t is always defined in <cstddef>, in practice.
+ #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
+ #define EA_HAVE_nullptr_t_IMPL 1
+
+ // The EDG compiler provides nullptr, but uses an older standard library that doesn't support std::nullptr_t.
+ #elif defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 403)
+ #define EA_HAVE_nullptr_t_IMPL 1
+
+ #else
+ #define EA_NO_HAVE_nullptr_t_IMPL 1
+ #endif
+ #else
+ #define EA_NO_HAVE_nullptr_t_IMPL 1
+ #endif
+#endif
+
+// <exception> std::terminate
+#if !defined(EA_HAVE_std_terminate_IMPL) && !defined(EA_NO_HAVE_std_terminate_IMPL)
+ #if !defined(EA_PLATFORM_IPHONE) && !defined(EA_PLATFORM_ANDROID)
+ #define EA_HAVE_std_terminate_IMPL 1 /* iOS doesn't appear to provide an implementation for std::terminate under the armv6 target. */
+ #else
+ #define EA_NO_HAVE_std_terminate_IMPL 1
+ #endif
+#endif
+
+// <iterator>: std::begin, std::end, std::prev, std::next, std::move_iterator.
+#if !defined(EA_HAVE_CPP11_ITERATOR_IMPL) && !defined(EA_NO_HAVE_CPP11_ITERATOR_IMPL)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_ITERATOR_IMPL 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
+ #define EA_HAVE_CPP11_ITERATOR_IMPL 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_ITERATOR_IMPL 1
+ #else
+ #define EA_NO_HAVE_CPP11_ITERATOR_IMPL 1
+ #endif
+#endif
+
+// <memory>: std::weak_ptr, std::shared_ptr, std::unique_ptr, std::bad_weak_ptr, std::owner_less
+#if !defined(EA_HAVE_CPP11_SMART_POINTER_IMPL) && !defined(EA_NO_HAVE_CPP11_SMART_POINTER_IMPL)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
+ #define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_SMART_POINTER_IMPL 1
+ #else
+ #define EA_NO_HAVE_CPP11_SMART_POINTER_IMPL 1
+ #endif
+#endif
+
+// <functional>: std::function, std::mem_fn, std::bad_function_call, std::is_bind_expression, std::is_placeholder, std::reference_wrapper, std::hash, std::bind, std::ref, std::cref.
+#if !defined(EA_HAVE_CPP11_FUNCTIONAL_IMPL) && !defined(EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
+ #define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_FUNCTIONAL_IMPL 1
+ #else
+ #define EA_NO_HAVE_CPP11_FUNCTIONAL_IMPL 1
+ #endif
+#endif
+
+// <exception> std::current_exception, std::rethrow_exception, std::exception_ptr, std::make_exception_ptr
+#if !defined(EA_HAVE_CPP11_EXCEPTION_IMPL) && !defined(EA_NO_HAVE_CPP11_EXCEPTION_IMPL)
+ #if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY) && (_CPPLIB_VER >= 520) && !(defined(_HAS_CPP0X) && _HAS_CPP0X) // Dinkumware. VS2010+
+ #define EA_HAVE_CPP11_EXCEPTION_IMPL 1
+ #elif defined(EA_COMPILER_CPP11_ENABLED) && defined(EA_HAVE_LIBSTDCPP_LIBRARY) && defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
+ #define EA_HAVE_CPP11_EXCEPTION_IMPL 1
+ #elif defined(EA_HAVE_LIBCPP_LIBRARY) && (_LIBCPP_VERSION >= 1)
+ #define EA_HAVE_CPP11_EXCEPTION_IMPL 1
+ #else
+ #define EA_NO_HAVE_CPP11_EXCEPTION_IMPL 1
+ #endif
+#endif
+
+
+
+
+/* Implementations that all platforms seem to have: */
+/*
+ alloca
+ malloc
+ calloc
+ strtoll
+ strtoull
+ vsprintf
+ vsnprintf
+*/
+
+/* Implementations that we don't care about: */
+/*
+ bcopy -- Just use memmove or some customized equivalent. bcopy offers no practical benefit.
+ strlcpy -- So few platforms have this built-in that we get no benefit from using it. Use EA::StdC::Strlcpy instead.
+ strlcat -- "
+*/
+
+
+
+/*-----------------------------------------------------------------------------
+ EABASE_USER_HAVE_HEADER
+
+ This allows the user to define a header file to be #included after the
+ eahave.h's contents are compiled. A primary use of this is to override
+ the contents of this header file. You can define the overhead header
+ file name in-code or define it globally as part of your build file.
+
+ Example usage:
+ #define EABASE_USER_HAVE_HEADER "MyHaveOverrides.h"
+ #include <EABase/eahave.h>
+---------------------------------------------------------------------------*/
+
+#ifdef EABASE_USER_HAVE_HEADER
+ #include EABASE_USER_HAVE_HEADER
+#endif
+
+
+#endif /* Header include guard */
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/earesult.h b/EASTL/test/packages/EABase/include/Common/EABase/earesult.h
new file mode 100644
index 0000000..d08b346
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/earesult.h
@@ -0,0 +1,62 @@
+/*-----------------------------------------------------------------------------
+ * earesult.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_earesult_H
+#define INCLUDED_earesult_H
+
+
+#include <EABase/eabase.h>
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
+#endif
+
+
+
+/* This result type is width-compatible with most systems. */
+typedef int32_t ea_result_type;
+
+
+namespace EA
+{
+ typedef int32_t result_type;
+
+ enum
+ {
+#ifndef SUCCESS
+ // Deprecated
+ // Note: a public MS header has created a define of this name which causes a build error. Fortunately they
+ // define it to 0 which is compatible.
+ // see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h
+ SUCCESS = 0,
+#endif
+ // Deprecated
+ FAILURE = -1,
+
+ // These values are now the preferred constants
+ EA_SUCCESS = 0,
+ EA_FAILURE = -1,
+ };
+}
+
+
+/* Macro to simplify testing for success. */
+#ifndef EA_SUCCEEDED
+ #define EA_SUCCEEDED(result) ((result) >= 0)
+#endif
+
+/* Macro to simplfify testing for general failure. */
+#ifndef EA_FAILED
+ #define EA_FAILED(result) ((result) < 0)
+#endif
+
+
+#endif
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/eastdarg.h b/EASTL/test/packages/EABase/include/Common/EABase/eastdarg.h
new file mode 100644
index 0000000..2c613eb
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/eastdarg.h
@@ -0,0 +1,99 @@
+/*-----------------------------------------------------------------------------
+ * eastdarg.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_eastdarg_H
+#define INCLUDED_eastdarg_H
+
+
+#include <EABase/eabase.h>
+#include <stdarg.h>
+
+
+// VA_ARG_COUNT
+//
+// Returns the number of arguments passed to a macro's ... argument.
+// This applies to macros only and not functions.
+//
+// Example usage:
+// assert(VA_ARG_COUNT() == 0);
+// assert(VA_ARG_COUNT(a) == 1);
+// assert(VA_ARG_COUNT(a, b) == 2);
+// assert(VA_ARG_COUNT(a, b, c) == 3);
+//
+#if !defined(VA_ARG_COUNT)
+ #define VA_ARG_COUNT(...) VA_ARG_COUNT_II((VA_ARG_COUNT_PREFIX_ ## __VA_ARGS__ ## _VA_ARG_COUNT_POSTFIX,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
+ #define VA_ARG_COUNT_II(__args) VA_ARG_COUNT_I __args
+ #define VA_ARG_COUNT_PREFIX__VA_ARG_COUNT_POSTFIX ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0
+ #define VA_ARG_COUNT_I(_0,_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,N,...) N
+#endif
+
+
+// va_copy
+//
+// va_copy is required by C++11
+// C++11 and C99 require va_copy to be #defined and implemented.
+// http://en.cppreference.com/w/cpp/utility/variadic/va_copy
+//
+// Example usage:
+// void Func(char* p, ...){
+// va_list args, argsCopy;
+// va_start(args, p);
+// va_copy(argsCopy, args);
+// (use args)
+// (use argsCopy, which acts the same as args)
+// va_end(args);
+// va_end(argsCopy);
+// }
+//
+#ifndef va_copy
+ #if defined(__va_copy) // GCC and others define this for non-C99 compatibility.
+ #define va_copy(dest, src) __va_copy((dest), (src))
+ #else
+ // This may not work for some platforms, depending on their ABI.
+ // It works for Microsoft x86,x64, and PowerPC-based platforms.
+ #define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
+ #endif
+#endif
+
+
+
+// va_list_reference
+//
+// va_list_reference is not part of the C or C++ standards.
+// It allows you to pass a va_list by reference to another
+// function instead of by value. You cannot simply use va_list&
+// as that won't work with many va_list implementations because
+// they are implemented as arrays (which can't be passed by
+// reference to a function without decaying to a pointer).
+//
+// Example usage:
+// void Test(va_list_reference args){
+// printf("%d", va_arg(args, int));
+// }
+// void Func(char* p, ...){
+// va_list args;
+// va_start(args, p);
+// Test(args); // Upon return args will be modified.
+// va_end(args);
+// }
+#ifndef va_list_reference
+ #if defined(EA_PLATFORM_MICROSOFT) || (EA_PLATFORM_PTR_SIZE == 4) || (defined(EA_PLATFORM_APPLE) && defined(EA_PROCESSOR_ARM64)) || defined(CS_UNDEFINED_STRING) || (defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM64))
+ // This is required for platform ABIs in which va_list is a struct or pointer.
+ #define va_list_reference va_list&
+ #else
+ // This is required for platform ABIs in which va_list is defined to be an array.
+ #define va_list_reference va_list
+ #endif
+#endif
+
+
+
+
+#endif /* Header include guard */
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/eaunits.h b/EASTL/test/packages/EABase/include/Common/EABase/eaunits.h
new file mode 100644
index 0000000..2235723
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/eaunits.h
@@ -0,0 +1,54 @@
+/*-----------------------------------------------------------------------------
+ * eaunits.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_eaunits_h
+#define INCLUDED_eaunits_h
+
+#include <EABase/eabase.h>
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result.
+#endif
+
+// Defining common SI unit macros.
+//
+// The mebibyte is a multiple of the unit byte for digital information. Technically a
+// megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two,
+// appropriate for binary machines. Many Linux distributions use the unit, but it is
+// not widely acknowledged within the industry or media.
+// Reference: https://en.wikipedia.org/wiki/Mebibyte
+//
+// Examples:
+// auto size1 = EA_KILOBYTE(16);
+// auto size2 = EA_MEGABYTE(128);
+// auto size3 = EA_MEBIBYTE(8);
+// auto size4 = EA_GIBIBYTE(8);
+
+// define byte for completeness
+#define EA_BYTE(x) (x)
+
+// Decimal SI units
+#define EA_KILOBYTE(x) (size_t(x) * 1000)
+#define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000)
+#define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000)
+#define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000)
+#define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000)
+#define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)
+
+// Binary SI units
+#define EA_KIBIBYTE(x) (size_t(x) * 1024)
+#define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024)
+#define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024)
+#define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024)
+#define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024)
+#define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)
+
+#endif // INCLUDED_earesult_H
+
+
+
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/int128.h b/EASTL/test/packages/EABase/include/Common/EABase/int128.h
new file mode 100644
index 0000000..068d557
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/int128.h
@@ -0,0 +1,1268 @@
+/*-----------------------------------------------------------------------------
+ * eaint128_t.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#ifndef INCLUDED_int128_h
+#define INCLUDED_int128_h
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// EA_INT128_INTRINSIC_AVAILABLE
+//
+#if (EA_COMPILER_INTMAX_SIZE >= 16) && (defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG))
+ // __int128_t/__uint128_t is supported
+ #define EA_INT128_INTRINSIC_AVAILABLE 1
+#else
+ #define EA_INT128_INTRINSIC_AVAILABLE 0
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// EA_INT128_ALIGNAS
+//
+#if EA_INT128_INTRINSIC_AVAILABLE && !defined(EA_COMPILER_NO_ALIGNAS)
+ #define EA_INT128_ALIGNAS alignas(unsigned __int128)
+#else
+ #define EA_INT128_ALIGNAS
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// EA_HAVE_INT128
+//
+// Indicates that EABase implements 128-bit integer types
+//
+#define EA_HAVE_INT128 1
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// uint128_t_base
+//
+struct EA_INT128_ALIGNAS int128_t_base
+{
+ // Constructors / destructors
+ int128_t_base() = default;
+ int128_t_base(uint32_t nPart0, uint32_t nPart1, uint32_t nPart2, uint32_t nPart3);
+ int128_t_base(uint64_t nPart0, uint64_t nPart1);
+ int128_t_base(uint8_t value);
+ int128_t_base(uint16_t value);
+ int128_t_base(uint32_t value);
+ int128_t_base(uint64_t value);
+ int128_t_base(const int128_t_base& value) = default;
+
+ // Assignment operator
+ int128_t_base& operator=(const int128_t_base& value) = default;
+
+ // Explicit operators to convert back to basic types
+ EA_CONSTEXPR explicit operator bool() const;
+ EA_CONSTEXPR explicit operator char() const;
+ EA_CONSTEXPR explicit operator int() const;
+ EA_CONSTEXPR explicit operator long() const;
+ EA_CONSTEXPR explicit operator long long() const;
+ EA_CONSTEXPR explicit operator short() const;
+ EA_CONSTEXPR explicit operator signed char() const;
+ EA_CONSTEXPR explicit operator unsigned char() const;
+ EA_CONSTEXPR explicit operator unsigned int() const;
+ EA_CONSTEXPR explicit operator unsigned long long() const;
+ EA_CONSTEXPR explicit operator unsigned long() const;
+ EA_CONSTEXPR explicit operator unsigned short() const;
+#if EA_WCHAR_UNIQUE
+ // EA_CONSTEXPR explicit operator char16_t() const;
+ // EA_CONSTEXPR explicit operator char32_t() const;
+ // EA_CONSTEXPR explicit operator wchar_t() const;
+#endif
+ EA_CONSTEXPR explicit operator float() const;
+ EA_CONSTEXPR explicit operator double() const;
+ EA_CONSTEXPR explicit operator long double() const;
+#if EA_INT128_INTRINSIC_AVAILABLE
+ EA_CONSTEXPR explicit operator __int128() const;
+ EA_CONSTEXPR explicit operator unsigned __int128() const;
+#endif
+
+ // Math operators
+ static void OperatorPlus (const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+ static void OperatorMinus(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+ static void OperatorMul (const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+
+ // Shift operators
+ static void OperatorShiftRight(const int128_t_base& value, int nShift, int128_t_base& result);
+ static void OperatorShiftLeft (const int128_t_base& value, int nShift, int128_t_base& result);
+
+ // Unary arithmetic/logic operators
+ bool operator!() const;
+
+ // Logical operators
+ static void OperatorXOR(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+ static void OperatorOR (const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+ static void OperatorAND(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result);
+
+ bool IsZero() const;
+ void SetZero();
+ void TwosComplement();
+ void InverseTwosComplement();
+
+ int GetBit(int nIndex) const;
+ void SetBit(int nIndex, int value);
+
+protected:
+ void DoubleToUint128(double value);
+
+ EA_CONSTEXPR uint64_t Low() const
+ {
+ return mPart0;
+ }
+
+ EA_CONSTEXPR uint64_t High() const
+ {
+ return mPart1;
+ }
+
+protected:
+ #ifdef EA_SYSTEM_BIG_ENDIAN
+ uint64_t mPart1; // Most significant byte.
+ uint64_t mPart0; // Least significant byte.
+ #else
+ uint64_t mPart0; // Most significant byte.
+ uint64_t mPart1; // Least significant byte.
+ #endif
+};
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// int128_t
+//
+// Implements signed 128 bit integer.
+//
+struct int128_t : public int128_t_base
+{
+ // Constructors / destructors
+ using int128_t_base::int128_t_base;
+
+ // Assignment operator
+ using int128_t_base::operator=;
+
+ // Unary arithmetic/logic operators
+ int128_t operator-() const;
+ int128_t& operator++();
+ int128_t& operator--();
+ int128_t operator++(int);
+ int128_t operator--(int);
+ int128_t operator~() const;
+ int128_t operator+() const;
+
+ // Math operators
+ int128_t operator+ (const int128_t& other);
+ int128_t operator- (const int128_t& other);
+ int128_t operator* (const int128_t& other);
+ int128_t operator/ (const int128_t& other);
+ int128_t operator% (const int128_t& other);
+ int128_t& operator+=(const int128_t& other);
+ int128_t& operator-=(const int128_t& other);
+ int128_t& operator*=(const int128_t& other);
+ int128_t& operator/=(const int128_t& other);
+ int128_t& operator%=(const int128_t& other);
+
+ // Shift operators
+ int128_t operator>> (int nShift) const;
+ int128_t operator<< (int nShift) const;
+ int128_t& operator>>=(int nShift);
+ int128_t& operator<<=(int nShift);
+
+ // Logical operators
+ int128_t operator^ (const int128_t& other) const;
+ int128_t operator| (const int128_t& other) const;
+ int128_t operator& (const int128_t& other) const;
+ int128_t& operator^=(const int128_t& other);
+ int128_t& operator|=(const int128_t& other);
+ int128_t& operator&=(const int128_t& other);
+
+ // Equality operators
+ bool operator==(const int128_t& other) const;
+ bool operator!=(const int128_t& other) const;
+ bool operator> (const int128_t& other) const;
+ bool operator>=(const int128_t& other) const;
+ bool operator< (const int128_t& other) const;
+ bool operator<=(const int128_t& other) const;
+
+protected:
+ int compare(const int128_t& other) const;
+ void Negate();
+ void Modulus(const int128_t& divisor, int128_t& quotient, int128_t& remainder) const;
+ bool IsNegative() const; // Returns true for value < 0
+ bool IsPositive() const; // Returns true for value >= 0
+};
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// uint128_t
+//
+// Implements unsigned 128 bit integer.
+//
+struct uint128_t : public int128_t_base
+{
+ // Constructors / destructors
+ using int128_t_base::int128_t_base;
+
+ // Assignment operator
+ using int128_t_base::operator=;
+
+ // Unary arithmetic/logic operators
+ uint128_t operator-() const;
+ uint128_t& operator++();
+ uint128_t& operator--();
+ uint128_t operator++(int);
+ uint128_t operator--(int);
+ uint128_t operator~() const;
+ uint128_t operator+() const;
+
+ // Math operators
+ uint128_t operator+ (const uint128_t& other);
+ uint128_t operator- (const uint128_t& other);
+ uint128_t operator* (const uint128_t& other);
+ uint128_t operator/ (const uint128_t& other);
+ uint128_t operator% (const uint128_t& other);
+ uint128_t& operator+=(const uint128_t& other);
+ uint128_t& operator-=(const uint128_t& other);
+ uint128_t& operator*=(const uint128_t& other);
+ uint128_t& operator/=(const uint128_t& other);
+ uint128_t& operator%=(const uint128_t& other);
+
+ // Shift operators
+ uint128_t operator>> (int nShift) const;
+ uint128_t operator<< (int nShift) const;
+ uint128_t& operator>>=(int nShift);
+ uint128_t& operator<<=(int nShift);
+
+ // Logical operators
+ uint128_t operator^ (const uint128_t& other) const;
+ uint128_t operator| (const uint128_t& other) const;
+ uint128_t operator& (const uint128_t& other) const;
+ uint128_t& operator^=(const uint128_t& other);
+ uint128_t& operator|=(const uint128_t& other);
+ uint128_t& operator&=(const uint128_t& other);
+
+ // Equality operators
+ bool operator==(const uint128_t& other) const;
+ bool operator!=(const uint128_t& other) const;
+ bool operator> (const uint128_t& other) const;
+ bool operator>=(const uint128_t& other) const;
+ bool operator< (const uint128_t& other) const;
+ bool operator<=(const uint128_t& other) const;
+
+protected:
+ int compare(const uint128_t& other) const;
+ void Negate();
+ void Modulus(const uint128_t& divisor, uint128_t& quotient, uint128_t& remainder) const;
+ bool IsNegative() const; // Returns true for value < 0
+ bool IsPositive() const; // Returns true for value >= 0
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// uint128_t_base implementation
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+EA_CONSTEXPR inline int128_t_base::operator bool() const { return mPart0 || mPart1; }
+EA_CONSTEXPR inline int128_t_base::operator char() const { return static_cast<char>(Low()); }
+#if EA_WCHAR_UNIQUE
+// EA_CONSTEXPR inline int128_t_base::operator char16_t() const { return static_cast<char16_t>(Low()); }
+// EA_CONSTEXPR inline int128_t_base::operator char32_t() const { return static_cast<char32_t>(Low()); }
+// EA_CONSTEXPR inline int128_t_base::operator wchar_t() const { return static_cast<wchar_t>(Low()); }
+#endif
+EA_CONSTEXPR inline int128_t_base::operator int() const { return static_cast<int>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator long() const { return static_cast<long>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator long long() const { return static_cast<long long>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator short() const { return static_cast<short>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator signed char() const { return static_cast<signed char>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned char() const { return static_cast<unsigned char>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned int() const { return static_cast<unsigned int>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned long long() const { return static_cast<unsigned long long>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned long() const { return static_cast<unsigned long>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned short() const { return static_cast<unsigned short>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator float() const { return static_cast<float>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator double() const { return static_cast<double>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator long double() const { return static_cast<long double>(Low()); }
+#if EA_INT128_INTRINSIC_AVAILABLE
+EA_CONSTEXPR inline int128_t_base::operator __int128() const { return static_cast<__int128>(Low()); }
+EA_CONSTEXPR inline int128_t_base::operator unsigned __int128() const { return static_cast<unsigned __int128>(Low()); }
+#endif
+
+inline void int128_t_base::SetBit(int nIndex, int value)
+{
+ // EA_ASSERT((nIndex >= 0) && (nIndex < 128));
+
+ const uint64_t nBitMask = ((uint64_t)1 << (nIndex % 64));
+
+ if(nIndex < 64)
+ {
+ if(value)
+ mPart0 = mPart0 | nBitMask;
+ else
+ mPart0 = mPart0 & ~nBitMask;
+ }
+ else if(nIndex < 128)
+ {
+ if(value)
+ mPart1 = mPart1 | nBitMask;
+ else
+ mPart1 = mPart1 & ~nBitMask;
+ }
+}
+
+inline int int128_t_base::GetBit(int nIndex) const
+{
+ // EA_ASSERT((nIndex >= 0) && (nIndex < 128));
+
+ const uint64_t nBitMask = ((uint64_t)1 << (nIndex % 64));
+
+ if(nIndex < 64)
+ return ((mPart0 & nBitMask) ? 1 : 0);
+ else if(nIndex < 128)
+ return ((mPart1 & nBitMask) ? 1 : 0);
+ return 0;
+}
+
+inline int128_t_base::int128_t_base(uint32_t nPart0, uint32_t nPart1, uint32_t nPart2, uint32_t nPart3)
+{
+ mPart1 = ((uint64_t)nPart3 << 32) + nPart2;
+ mPart0 = ((uint64_t)nPart1 << 32) + nPart0;
+}
+
+inline int128_t_base::int128_t_base(uint64_t nPart0, uint64_t nPart1)
+{
+ mPart1 = nPart1;
+ mPart0 = nPart0;
+}
+
+inline int128_t_base::int128_t_base(uint8_t value)
+{
+ mPart1 = 0;
+ mPart0 = value;
+}
+
+inline int128_t_base::int128_t_base(uint16_t value)
+{
+ mPart1 = 0;
+ mPart0 = value;
+}
+
+inline int128_t_base::int128_t_base(uint32_t value)
+{
+ mPart1 = 0;
+ mPart0 = value;
+}
+
+inline int128_t_base::int128_t_base(uint64_t value)
+{
+ mPart1 = 0;
+ mPart0 = value;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorPlus
+//
+// Returns: (value1 + value2) into result.
+// The output 'result' *is* allowed to point to the same memory as one of the inputs.
+// To consider: Fix 'defect' of this function whereby it doesn't implement overflow wraparound.
+//
+inline void int128_t_base::OperatorPlus(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result)
+{
+ uint64_t t = value1.mPart0 + value2.mPart0;
+ uint64_t nCarry = (t < value1.mPart0) && (t < value2.mPart0);
+ result.mPart0 = t;
+ result.mPart1 = value1.mPart1 + value2.mPart1 + nCarry;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorMinus
+//
+// Returns: (value1 - value2) into result.
+// The output 'result' *is* allowed to point to the same memory as one of the inputs.
+// To consider: Fix 'defect' of this function whereby it doesn't implement overflow wraparound.
+//
+inline void int128_t_base::OperatorMinus(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result)
+{
+ uint64_t t = (value1.mPart0 - value2.mPart0);
+ uint64_t nCarry = (value1.mPart0 < value2.mPart0) ? 1u : 0u;
+ result.mPart0 = t;
+ result.mPart1 = (value1.mPart1 - value2.mPart1) - nCarry;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorMul
+//
+// 64 bit systems:
+// This is how it would be able to work if we could get a 128 bit result from
+// two 64 bit values. None of the 64 bit systems that we are currently working
+// with have C language support for multiplying two 64 bit numbers and retrieving
+// the 128 bit result. However, many 64 bit platforms have support at the asm
+// level for doing such a thing.
+// Part 1 Part 0
+// 0000000000000002 0000000000000001
+// x 0000000000000002 0000000000000001
+// -------------------------------------------
+// | 0000000000000002 0000000000000001
+// + 0000000000000004 | 0000000000000002 (0000000000000000)
+// -------------------------------------------------------------------------
+//
+inline void int128_t_base::OperatorMul(const int128_t_base& a, const int128_t_base& b, int128_t_base& result)
+{
+ // To consider: Use compiler or OS-provided custom functionality here, such as
+ // Windows UnsignedMultiply128 and GCC's built-in int128_t.
+
+ #if defined(DISABLED_PLATFORM_WIN64)
+ // To do: Implement x86-64 asm here.
+
+ #else
+ // Else we are stuck doing something less efficient. In this case we
+ // fall back to doing 32 bit multiplies as with 32 bit platforms.
+ result = (a.mPart0 & 0xffffffff) * (b.mPart0 & 0xffffffff);
+ int128_t v01 = (a.mPart0 & 0xffffffff) * ((b.mPart0 >> 32) & 0xffffffff);
+ int128_t v02 = (a.mPart0 & 0xffffffff) * (b.mPart1 & 0xffffffff);
+ int128_t v03 = (a.mPart0 & 0xffffffff) * ((b.mPart1 >> 32) & 0xffffffff);
+
+ int128_t v10 = ((a.mPart0 >> 32) & 0xffffffff) * (b.mPart0 & 0xffffffff);
+ int128_t v11 = ((a.mPart0 >> 32) & 0xffffffff) * ((b.mPart0 >> 32) & 0xffffffff);
+ int128_t v12 = ((a.mPart0 >> 32) & 0xffffffff) * (b.mPart1 & 0xffffffff);
+
+ int128_t v20 = (a.mPart1 & 0xffffffff) * (b.mPart0 & 0xffffffff);
+ int128_t v21 = (a.mPart1 & 0xffffffff) * ((b.mPart0 >> 32) & 0xffffffff);
+
+ int128_t v30 = ((a.mPart1 >> 32) & 0xffffffff) * (b.mPart0 & 0xffffffff);
+
+ // Do row addition, shifting as needed.
+ OperatorPlus(result, v01 << 32, result);
+ OperatorPlus(result, v02 << 64, result);
+ OperatorPlus(result, v03 << 96, result);
+
+ OperatorPlus(result, v10 << 32, result);
+ OperatorPlus(result, v11 << 64, result);
+ OperatorPlus(result, v12 << 96, result);
+
+ OperatorPlus(result, v20 << 64, result);
+ OperatorPlus(result, v21 << 96, result);
+
+ OperatorPlus(result, v30 << 96, result);
+ #endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorShiftRight
+//
+// Returns: value >> nShift into result
+// The output 'result' may *not* be the same as one the input.
+// With rightward shifts of negative numbers, shift in zero from the left side.
+//
+inline void int128_t_base::OperatorShiftRight(const int128_t_base& value, int nShift, int128_t_base& result)
+{
+ if(nShift >= 0)
+ {
+ if(nShift < 64)
+ { // 0 - 63
+ result.mPart1 = (value.mPart1 >> nShift);
+
+ if(nShift == 0)
+ result.mPart0 = (value.mPart0 >> nShift);
+ else
+ result.mPart0 = (value.mPart0 >> nShift) | (value.mPart1 << (64 - nShift));
+ }
+ else
+ { // 64+
+ result.mPart1 = 0;
+ result.mPart0 = (value.mPart1 >> (nShift - 64));
+ }
+ }
+ else // (nShift < 0)
+ OperatorShiftLeft(value, -nShift, result);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorShiftRight
+//
+// Returns: value << nShift into result
+// The output 'result' may *not* be the same as one the input.
+// With rightward shifts of negative numbers, shift in zero from the left side.
+//
+inline void int128_t_base::OperatorShiftLeft(const int128_t_base& value, int nShift, int128_t_base& result)
+{
+ if(nShift >= 0)
+ {
+ if(nShift < 64)
+ {
+ if(nShift) // We need to have a special case because CPUs convert a shift by 64 to a no-op.
+ {
+ // 1 - 63
+ result.mPart0 = (value.mPart0 << nShift);
+ result.mPart1 = (value.mPart1 << nShift) | (value.mPart0 >> (64 - nShift));
+ }
+ else
+ {
+ result.mPart0 = value.mPart0;
+ result.mPart1 = value.mPart1;
+ }
+ }
+ else
+ { // 64+
+ result.mPart0 = 0;
+ result.mPart1 = (value.mPart0 << (nShift - 64));
+ }
+ }
+ else // (nShift < 0)
+ OperatorShiftRight(value, -nShift, result);
+}
+
+
+inline bool int128_t_base::operator!() const
+{
+ return (mPart0 == 0) && (mPart1 == 0);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorXOR
+//
+// Returns: value1 ^ value2 into result
+// The output 'result' may be the same as one the input.
+//
+inline void int128_t_base::OperatorXOR(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result)
+{
+ result.mPart0 = (value1.mPart0 ^ value2.mPart0);
+ result.mPart1 = (value1.mPart1 ^ value2.mPart1);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorOR
+//
+// Returns: value1 | value2 into result
+// The output 'result' may be the same as one the input.
+//
+inline void int128_t_base::OperatorOR(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result)
+{
+ result.mPart0 = (value1.mPart0 | value2.mPart0);
+ result.mPart1 = (value1.mPart1 | value2.mPart1);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// OperatorAND
+//
+// Returns: value1 & value2 into result
+// The output 'result' may be the same as one the input.
+//
+inline void int128_t_base::OperatorAND(const int128_t_base& value1, const int128_t_base& value2, int128_t_base& result)
+{
+ result.mPart0 = (value1.mPart0 & value2.mPart0);
+ result.mPart1 = (value1.mPart1 & value2.mPart1);
+}
+
+
+inline bool int128_t_base::IsZero() const
+{
+ return (mPart0 == 0) && // Check mPart0 first as this will likely yield faster execution.
+ (mPart1 == 0);
+}
+
+
+inline void int128_t_base::SetZero()
+{
+ mPart1 = 0;
+ mPart0 = 0;
+}
+
+
+inline void int128_t_base::TwosComplement()
+{
+ mPart1 = ~mPart1;
+ mPart0 = ~mPart0;
+
+ // What we want to do, but isn't available at this level:
+ // operator++();
+ // Alternative:
+ int128_t_base one((uint32_t)1);
+ OperatorPlus(*this, one, *this);
+}
+
+
+inline void int128_t_base::InverseTwosComplement()
+{
+ // What we want to do, but isn't available at this level:
+ // operator--();
+ // Alternative:
+ int128_t_base one((uint32_t)1);
+ OperatorMinus(*this, one, *this);
+
+ mPart1 = ~mPart1;
+ mPart0 = ~mPart0;
+}
+
+
+inline void int128_t_base::DoubleToUint128(double value)
+{
+ // Currently this function is limited to 64 bits of integer input.
+ // We need to make a better version of this function. Perhaps we should implement
+ // it via dissecting the IEEE floating point format (sign, exponent, matissa).
+ // EA_ASSERT(fabs(value) < 18446744073709551616.0); // Assert that the input is <= 64 bits of integer.
+
+ mPart1 = 0;
+ mPart0 = (value >= 0 ? (uint64_t)value : (uint64_t)-value);
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// uint128_t implementation
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+
+inline uint128_t uint128_t::operator^(const uint128_t& other) const
+{
+ uint128_t temp;
+ uint128_t::OperatorXOR(*this, other, temp);
+ return temp;
+}
+
+inline uint128_t uint128_t::operator|(const uint128_t& other) const
+{
+ uint128_t temp;
+ uint128_t::OperatorOR(*this, other, temp);
+ return temp;
+}
+
+inline uint128_t uint128_t::operator&(const uint128_t& other) const
+{
+ uint128_t temp;
+ uint128_t::OperatorAND(*this, other, temp);
+ return temp;
+}
+
+inline uint128_t& uint128_t::operator^=(const uint128_t& value)
+{
+ OperatorXOR(*this, value, *this);
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator|=(const uint128_t& value)
+{
+ OperatorOR(*this, value, *this);
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator&=(const uint128_t& value)
+{
+ OperatorAND(*this, value, *this);
+ return *this;
+}
+
+// With rightward shifts of negative numbers, shift in zero from the left side.
+inline uint128_t uint128_t::operator>>(int nShift) const
+{
+ uint128_t temp;
+ OperatorShiftRight(*this, nShift, temp);
+ return temp;
+}
+
+// With rightward shifts of negative numbers, shift in zero from the left side.
+inline uint128_t uint128_t::operator<<(int nShift) const
+{
+ uint128_t temp;
+ OperatorShiftLeft(*this, nShift, temp);
+ return temp;
+}
+
+inline uint128_t& uint128_t::operator>>=(int nShift)
+{
+ uint128_t temp;
+ OperatorShiftRight(*this, nShift, temp);
+ *this = temp;
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator<<=(int nShift)
+{
+ uint128_t temp;
+ OperatorShiftLeft(*this, nShift, temp);
+ *this = temp;
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator+=(const uint128_t& value)
+{
+ OperatorPlus(*this, value, *this);
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator-=(const uint128_t& value)
+{
+ OperatorMinus(*this, value, *this);
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator*=(const uint128_t& value)
+{
+ *this = *this * value;
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator/=(const uint128_t& value)
+{
+ *this = *this / value;
+ return *this;
+}
+
+inline uint128_t& uint128_t::operator%=(const uint128_t& value)
+{
+ *this = *this % value;
+ return *this;
+}
+
+inline uint128_t uint128_t::operator+(const uint128_t& other)
+{
+ uint128_t temp;
+ uint128_t::OperatorPlus(*this, other, temp);
+ return temp;
+}
+
+inline uint128_t uint128_t::operator-(const uint128_t& other)
+{
+ uint128_t temp;
+ uint128_t::OperatorMinus(*this, other, temp);
+ return temp;
+}
+
+inline uint128_t uint128_t::operator*(const uint128_t& other)
+{
+ uint128_t returnValue;
+ int128_t_base::OperatorMul(*this, other, returnValue);
+ return returnValue;
+}
+
+inline uint128_t uint128_t::operator/(const uint128_t& other)
+{
+ uint128_t remainder;
+ uint128_t quotient;
+ this->Modulus(other, quotient, remainder);
+ return quotient;
+}
+
+inline uint128_t uint128_t::operator%(const uint128_t& other)
+{
+ uint128_t remainder;
+ uint128_t quotient;
+ this->Modulus(other, quotient, remainder);
+ return remainder;
+}
+
+inline uint128_t uint128_t::operator+() const
+{
+ return *this;
+}
+
+inline uint128_t uint128_t::operator~() const
+{
+ return uint128_t(~mPart0, ~mPart1);
+}
+
+inline uint128_t& uint128_t::operator--()
+{
+ int128_t_base one((uint32_t)1);
+ OperatorMinus(*this, one, *this);
+ return *this;
+}
+
+inline uint128_t uint128_t::operator--(int)
+{
+ uint128_t temp((uint32_t)1);
+ OperatorMinus(*this, temp, temp);
+ return temp;
+}
+
+inline uint128_t uint128_t::operator++(int)
+{
+ uint128_t prev = *this;
+ uint128_t temp((uint32_t)1);
+ OperatorPlus(*this, temp, *this);
+ return prev;
+}
+
+inline uint128_t& uint128_t::operator++()
+{
+ int128_t_base one((uint32_t)1);
+ OperatorPlus(*this, one, *this);
+ return *this;
+}
+
+inline void uint128_t::Negate()
+{
+ TwosComplement();
+}
+
+inline uint128_t uint128_t::operator-() const
+{
+ uint128_t returnValue(*this);
+ returnValue.Negate();
+ return returnValue;
+}
+
+// This function forms the basis of all logical comparison functions.
+// If value1 < value2, the return value is -1.
+// If value1 == value2, the return value is 0.
+// If value1 > value2, the return value is 1.
+inline int uint128_t::compare(const uint128_t& other) const
+{
+ // Compare individual parts. At this point, the two numbers have the same sign.
+ if(mPart1 == other.mPart1)
+ {
+ if(mPart0 == other.mPart0)
+ return 0;
+ else if(mPart0 > other.mPart0)
+ return 1;
+ // return -1; //Just fall through to the end.
+ }
+ else if(mPart1 > other.mPart1)
+ return 1;
+ return -1;
+}
+
+EA_DISABLE_VC_WARNING(4723) // warning C4723: potential divide by 0
+inline void uint128_t::Modulus(const uint128_t& divisor, uint128_t& quotient, uint128_t& remainder) const
+{
+ uint128_t tempDividend(*this);
+ uint128_t tempDivisor(divisor);
+
+ if(tempDivisor.IsZero())
+ {
+ // Force a divide by zero exception.
+ // We know that tempDivisor.mPart0 is zero.
+ quotient.mPart0 /= tempDivisor.mPart0;
+ }
+ else if(tempDividend.IsZero())
+ {
+ quotient = uint128_t((uint32_t)0);
+ remainder = uint128_t((uint32_t)0);
+ }
+ else
+ {
+ remainder.SetZero();
+
+ for(int i(0); i < 128; i++)
+ {
+ remainder += (uint32_t)tempDividend.GetBit(127 - i);
+ const bool bBit(remainder >= tempDivisor);
+ quotient.SetBit(127 - i, bBit);
+
+ if(bBit)
+ remainder -= tempDivisor;
+
+ if((i != 127) && !remainder.IsZero())
+ remainder <<= 1;
+ }
+ }
+}
+EA_RESTORE_VC_WARNING()
+
+inline bool uint128_t::operator==(const uint128_t& other) const
+{
+ return (mPart0 == other.mPart0) && // Check mPart0 first as this will likely yield faster execution.
+ (mPart1 == other.mPart1);
+}
+
+inline bool uint128_t::operator< (const uint128_t& other) const { return (compare(other) < 0); }
+inline bool uint128_t::operator!=(const uint128_t& other) const { return !(*this == other); }
+inline bool uint128_t::operator> (const uint128_t& other) const { return other < *this; }
+inline bool uint128_t::operator>=(const uint128_t& other) const { return !(*this < other); }
+inline bool uint128_t::operator<=(const uint128_t& other) const { return !(other < *this); }
+
+inline bool uint128_t::IsNegative() const
+{ // True if value < 0
+ return false;
+}
+
+inline bool uint128_t::IsPositive() const
+{
+ // True of value >= 0
+ return true;
+}
+
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// int128_t implementation
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+
+inline void int128_t::Negate()
+{
+ if (IsPositive())
+ TwosComplement();
+ else
+ InverseTwosComplement();
+}
+
+inline int128_t int128_t::operator-() const
+{
+ int128_t returnValue(*this);
+ returnValue.Negate();
+ return returnValue;
+}
+
+inline int128_t& int128_t::operator++()
+{
+ int128_t_base one((uint32_t)1);
+ OperatorPlus(*this, one, *this);
+ return *this;
+}
+
+inline int128_t& int128_t::operator--()
+{
+ int128_t_base one((uint32_t)1);
+ OperatorMinus(*this, one, *this);
+ return *this;
+}
+
+inline int128_t int128_t::operator++(int)
+{
+ int128_t prev = *this;
+ int128_t temp((uint32_t)1);
+ OperatorPlus(*this, temp, *this);
+ return prev;
+}
+
+inline int128_t int128_t::operator--(int)
+{
+ int128_t temp((uint32_t)1);
+ OperatorMinus(*this, temp, temp);
+ return temp;
+}
+
+inline int128_t int128_t::operator+() const
+{
+ return *this;
+}
+
+inline int128_t int128_t::operator~() const
+{
+ return int128_t(~mPart0, ~mPart1);
+}
+
+inline int128_t int128_t::operator+(const int128_t& other)
+{
+ int128_t temp;
+ int128_t::OperatorPlus(*this, other, temp);
+ return temp;
+}
+
+inline int128_t int128_t::operator-(const int128_t& other)
+{
+ int128_t temp;
+ int128_t::OperatorMinus(*this, other, temp);
+ return temp;
+}
+
+// This function forms the basis of all logical comparison functions.
+// If value1 < value2, the return value is -1.
+// If value1 == value2, the return value is 0.
+// If value1 > value2, the return value is 1.
+inline int int128_t::compare(const int128_t& other) const
+{
+ // Cache some values. Positive means >= 0. Negative means < 0 and thus means '!positive'.
+ const bool bValue1IsPositive( IsPositive());
+ const bool bValue2IsPositive(other.IsPositive());
+
+ // Do positive/negative tests.
+ if(bValue1IsPositive != bValue2IsPositive)
+ return bValue1IsPositive ? 1 : -1;
+
+ // Compare individual parts. At this point, the two numbers have the same sign.
+ if(mPart1 == other.mPart1)
+ {
+ if(mPart0 == other.mPart0)
+ return 0;
+ else if(mPart0 > other.mPart0)
+ return 1;
+ // return -1; //Just fall through to the end.
+ }
+ else if(mPart1 > other.mPart1)
+ return 1;
+ return -1;
+}
+
+inline bool int128_t::operator==(const int128_t& other) const
+{
+ return (mPart0 == other.mPart0) && // Check mPart0 first as this will likely yield faster execution.
+ (mPart1 == other.mPart1);
+}
+
+inline bool int128_t::operator!=(const int128_t& other) const
+{
+ return (mPart0 != other.mPart0) || // Check mPart0 first as this will likely yield faster execution.
+ (mPart1 != other.mPart1);
+}
+
+inline bool int128_t::operator>(const int128_t& other) const
+{
+ return (compare(other) > 0);
+}
+
+inline bool int128_t::operator>=(const int128_t& other) const
+{
+ return (compare(other) >= 0);
+}
+
+inline bool int128_t::operator<(const int128_t& other) const
+{
+ return (compare(other) < 0);
+}
+
+inline bool int128_t::operator<=(const int128_t& other) const
+{
+ return (compare(other) <= 0);
+}
+
+inline bool int128_t::IsNegative() const
+{ // True if value < 0
+ return ((mPart1 & UINT64_C(0x8000000000000000)) != 0);
+}
+
+inline bool int128_t::IsPositive() const
+{ // True of value >= 0
+ return ((mPart1 & UINT64_C(0x8000000000000000)) == 0);
+}
+
+inline int128_t int128_t::operator*(const int128_t& other)
+{
+ int128_t a(*this);
+ int128_t b(other);
+ int128_t returnValue;
+
+ // Correctly handle negative values
+ bool bANegative(false);
+ bool bBNegative(false);
+
+ if(a.IsNegative())
+ {
+ bANegative = true;
+ a.Negate();
+ }
+
+ if(b.IsNegative())
+ {
+ bBNegative = true;
+ b.Negate();
+ }
+
+ int128_t_base::OperatorMul(a, b, returnValue);
+
+ // Do negation as needed.
+ if(bANegative != bBNegative)
+ returnValue.Negate();
+
+ return returnValue;
+}
+
+inline int128_t int128_t::operator/(const int128_t& other)
+{
+ int128_t remainder;
+ int128_t quotient;
+ this->Modulus(other, quotient, remainder);
+ return quotient;
+}
+
+inline int128_t int128_t::operator<<(int nShift) const
+{
+ int128_t temp;
+ OperatorShiftLeft(*this, nShift, temp);
+ return temp;
+}
+
+inline int128_t& int128_t::operator+=(const int128_t& value)
+{
+ OperatorPlus(*this, value, *this);
+ return *this;
+}
+
+inline int128_t& int128_t::operator-=(const int128_t& value)
+{
+ OperatorMinus(*this, value, *this);
+ return *this;
+}
+
+inline int128_t& int128_t::operator<<=(int nShift)
+{
+ int128_t temp;
+ OperatorShiftLeft(*this, nShift, temp);
+ *this = temp;
+ return *this;
+}
+
+inline int128_t& int128_t::operator*=(const int128_t& value)
+{
+ *this = *this * value;
+ return *this;
+}
+
+inline int128_t& int128_t::operator%=(const int128_t& value)
+{
+ *this = *this % value;
+ return *this;
+}
+
+inline int128_t int128_t::operator%(const int128_t& other)
+{
+ int128_t remainder;
+ int128_t quotient;
+ this->Modulus(other, quotient, remainder);
+ return remainder;
+}
+
+inline int128_t& int128_t::operator/=(const int128_t& value)
+{
+ *this = *this / value;
+ return *this;
+}
+
+// With rightward shifts of negative numbers, shift in zero from the left side.
+inline int128_t int128_t::operator>>(int nShift) const
+{
+ int128_t temp;
+ OperatorShiftRight(*this, nShift, temp);
+ return temp;
+}
+
+inline int128_t& int128_t::operator>>=(int nShift)
+{
+ int128_t temp;
+ OperatorShiftRight(*this, nShift, temp);
+ *this = temp;
+ return *this;
+}
+
+inline int128_t int128_t::operator^(const int128_t& other) const
+{
+ int128_t temp;
+ int128_t::OperatorXOR(*this, other, temp);
+ return temp;
+}
+
+inline int128_t int128_t::operator|(const int128_t& other) const
+{
+ int128_t temp;
+ int128_t::OperatorOR(*this, other, temp);
+ return temp;
+}
+
+
+inline int128_t int128_t::operator&(const int128_t& other) const
+{
+ int128_t temp;
+ int128_t::OperatorAND(*this, other, temp);
+ return temp;
+}
+
+inline int128_t& int128_t::operator^=(const int128_t& value)
+{
+ OperatorXOR(*this, value, *this);
+ return *this;
+}
+
+inline int128_t& int128_t::operator|=(const int128_t& value)
+{
+ OperatorOR(*this, value, *this);
+ return *this;
+}
+
+inline int128_t& int128_t::operator&=(const int128_t& value)
+{
+ OperatorAND(*this, value, *this);
+ return *this;
+}
+
+EA_DISABLE_VC_WARNING(4723) // warning C4723: potential divide by 0
+inline void int128_t::Modulus(const int128_t& divisor, int128_t& quotient, int128_t& remainder) const
+{
+ int128_t tempDividend(*this);
+ int128_t tempDivisor(divisor);
+
+ bool bDividendNegative = false;
+ bool bDivisorNegative = false;
+
+ if(tempDividend.IsNegative())
+ {
+ bDividendNegative = true;
+ tempDividend.Negate();
+ }
+ if(tempDivisor.IsNegative())
+ {
+ bDivisorNegative = true;
+ tempDivisor.Negate();
+ }
+
+ // Handle the special cases
+ if(tempDivisor.IsZero())
+ {
+ // Force a divide by zero exception.
+ // We know that tempDivisor.mPart0 is zero.
+ quotient.mPart0 /= tempDivisor.mPart0;
+ }
+ else if(tempDividend.IsZero())
+ {
+ quotient = int128_t((uint32_t)0);
+ remainder = int128_t((uint32_t)0);
+ }
+ else
+ {
+ remainder.SetZero();
+
+ for(int i(0); i < 128; i++)
+ {
+ remainder += (uint32_t)tempDividend.GetBit(127 - i);
+ const bool bBit(remainder >= tempDivisor);
+ quotient.SetBit(127 - i, bBit);
+
+ if(bBit)
+ remainder -= tempDivisor;
+
+ if((i != 127) && !remainder.IsZero())
+ remainder <<= 1;
+ }
+ }
+
+ if((bDividendNegative && !bDivisorNegative) || (!bDividendNegative && bDivisorNegative))
+ {
+ // Ensure the following formula applies for negative dividends
+ // dividend = divisor * quotient + remainder
+ quotient.Negate();
+ }
+}
+EA_RESTORE_VC_WARNING()
+
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////
+// INT128_C / UINT128_C
+//
+// The C99 language defines macros for portably defining constants of
+// sized numeric types. For example, there might be:
+// #define UINT64_C(x) x##ULL
+// Since our int128 data type is not a built-in type, we can't define a
+// UINT128_C macro as something that pastes ULLL at the end of the digits.
+// Instead we define it to create a temporary that is constructed from a
+// string of the digits. This will work in most cases that suffix pasting
+// would work.
+//
+/* EA_CONSTEXPR */ inline uint128_t UINT128_C(uint64_t nPart1, uint64_t nPart0) { return uint128_t(nPart0, nPart1); }
+/* EA_CONSTEXPR */ inline int128_t INT128_C(int64_t nPart1, int64_t nPart0) { return int128_t(static_cast<uint64_t>(nPart0), static_cast<uint64_t>(nPart1)); }
+
+
+
+
+#endif // INCLUDED_int128_h
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/nullptr.h b/EASTL/test/packages/EABase/include/Common/EABase/nullptr.h
new file mode 100644
index 0000000..d6629d5
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/nullptr.h
@@ -0,0 +1,102 @@
+/*-----------------------------------------------------------------------------
+ * nullptr.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+
+#include <EABase/eabase.h>
+#include <EABase/eahave.h>
+
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */
+#endif
+
+
+#if defined(EA_COMPILER_CPP11_ENABLED) && !defined(EA_COMPILER_NO_NULLPTR) && !defined(EA_HAVE_nullptr_t_IMPL)
+ // The compiler supports nullptr, but the standard library doesn't implement a declaration for std::nullptr_t. So we provide one.
+ namespace std { typedef decltype(nullptr) nullptr_t; }
+#endif
+
+
+
+#if defined(EA_COMPILER_NO_NULLPTR) // If the compiler lacks a native version...
+
+ namespace std
+ {
+ class nullptr_t
+ {
+ public:
+ template<class T> // When tested a pointer, acts as 0.
+ operator T*() const
+ { return 0; }
+
+ template<class C, class T> // When tested as a member pointer, acts as 0.
+ operator T C::*() const
+ { return 0; }
+
+ typedef void* (nullptr_t::*bool_)() const;
+ operator bool_() const // An rvalue of type std::nullptr_t can be converted to an rvalue of type bool; the resulting value is false.
+ { return false; } // We can't use operator bool(){ return false; } because bool is convertable to int which breaks other required functionality.
+
+ // We can't enable this without generating warnings about nullptr being uninitialized after being used when created without "= {}".
+ //void* mSizeofVoidPtr; // sizeof(nullptr_t) == sizeof(void*). Needs to be public if nullptr_t is to be a POD.
+
+ private:
+ void operator&() const; // Address cannot be taken.
+ };
+
+ inline nullptr_t nullptr_get()
+ {
+ nullptr_t n = { }; // std::nullptr exists.
+ return n;
+ }
+
+ #if !defined(nullptr) // If somebody hasn't already defined nullptr in a custom way...
+ #define nullptr nullptr_get()
+ #endif
+
+ } // namespace std
+
+
+ template<class T>
+ inline bool operator==(T* p, const std::nullptr_t)
+ { return p == 0; }
+
+ template<class T>
+ inline bool operator==(const std::nullptr_t, T* p)
+ { return p == 0; }
+
+ template<class T, class U>
+ inline bool operator==(T U::* p, const std::nullptr_t)
+ { return p == 0; }
+
+ template<class T, class U>
+ inline bool operator==(const std::nullptr_t, T U::* p)
+ { return p == 0; }
+
+ inline bool operator==(const std::nullptr_t, const std::nullptr_t)
+ { return true; }
+
+ inline bool operator!=(const std::nullptr_t, const std::nullptr_t)
+ { return false; }
+
+ inline bool operator<(const std::nullptr_t, const std::nullptr_t)
+ { return false; }
+
+ inline bool operator>(const std::nullptr_t, const std::nullptr_t)
+ { return false; }
+
+ inline bool operator<=(const std::nullptr_t, const std::nullptr_t)
+ { return true; }
+
+ inline bool operator>=(const std::nullptr_t, const std::nullptr_t)
+ { return true; }
+
+
+ using std::nullptr_t; // exported to global namespace.
+ using std::nullptr_get; // exported to global namespace.
+
+#endif // EA_COMPILER_NO_NULLPTR
+
diff --git a/EASTL/test/packages/EABase/include/Common/EABase/version.h b/EASTL/test/packages/EABase/include/Common/EABase/version.h
new file mode 100644
index 0000000..b6e1b66
--- /dev/null
+++ b/EASTL/test/packages/EABase/include/Common/EABase/version.h
@@ -0,0 +1,36 @@
+/*-----------------------------------------------------------------------------
+ * version.h
+ *
+ * Copyright (c) Electronic Arts Inc. All rights reserved.
+ *---------------------------------------------------------------------------*/
+
+#ifndef INCLUDED_EABASE_VERSION_H
+#define INCLUDED_EABASE_VERSION_H
+
+///////////////////////////////////////////////////////////////////////////////
+// EABASE_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("EABASE version: %s", EABASE_VERSION);
+// printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100);
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef EABASE_VERSION
+ #define EABASE_VERSION "2.09.12"
+ #define EABASE_VERSION_N 20912
+#endif
+
+#endif
diff --git a/EASTL/test/packages/EABase/test/CMakeLists.txt b/EASTL/test/packages/EABase/test/CMakeLists.txt
new file mode 100644
index 0000000..93b3e82
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/CMakeLists.txt
@@ -0,0 +1,67 @@
+#-------------------------------------------------------------------------------------------
+# Copyright (C) Electronic Arts Inc. All rights reserved.
+#-------------------------------------------------------------------------------------------
+
+#-------------------------------------------------------------------------------------------
+# CMake info
+#-------------------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.1)
+project(EABaseTest CXX)
+include(CTest)
+
+#-------------------------------------------------------------------------------------------
+# Defines
+#-------------------------------------------------------------------------------------------
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+add_definitions(-D_SCL_SECURE_NO_WARNINGS)
+add_definitions(-D_CHAR16T)
+
+#-------------------------------------------------------------------------------------------
+# Compiler Flags
+#-------------------------------------------------------------------------------------------
+set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/packages/EASTL/scripts/CMake")
+include(CommonCppFlags)
+
+#-------------------------------------------------------------------------------------------
+# Source files
+#-------------------------------------------------------------------------------------------
+file(GLOB EABASETEST_SOURCES "source/TestEABase.cpp" "source/TestEABase.h")
+set(SOURCES ${EABASETEST_SOURCES})
+
+#-------------------------------------------------------------------------------------------
+# Executable definition
+#-------------------------------------------------------------------------------------------
+add_executable(EABaseTest ${SOURCES})
+
+#-------------------------------------------------------------------------------------------
+# Dependencies
+#-------------------------------------------------------------------------------------------
+add_subdirectory(packages/EAAssert)
+add_subdirectory(packages/EAMain)
+add_subdirectory(packages/EASTL)
+add_subdirectory(packages/EAStdC)
+add_subdirectory(packages/EATest)
+add_subdirectory(packages/EAThread)
+
+target_link_libraries(EABaseTest EAAssert)
+target_link_libraries(EABaseTest EAMain)
+target_link_libraries(EABaseTest EASTL)
+target_link_libraries(EABaseTest EAStdC)
+target_link_libraries(EABaseTest EATest)
+target_link_libraries(EABaseTest EAThread)
+
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads REQUIRED)
+
+if((NOT APPLE) AND (NOT WIN32))
+ target_link_libraries(EABaseTest ${EASTLTest_Libraries} Threads::Threads rt)
+else()
+ target_link_libraries(EABaseTest ${EASTLTest_Libraries} Threads::Threads)
+endif()
+
+#-------------------------------------------------------------------------------------------
+# Run Unit tests and verify the results.
+#-------------------------------------------------------------------------------------------
+add_test(EABaseTestRuns EABaseTest)
+set_tests_properties (EABaseTestRuns PROPERTIES PASS_REGULAR_EXPRESSION "RETURNCODE=0")
+
diff --git a/EASTL/test/packages/EABase/test/packages/EAAssert b/EASTL/test/packages/EABase/test/packages/EAAssert
new file mode 160000
+Subproject e5e181255de2e883dd1f987c78ccc42ac81d3bc
diff --git a/EASTL/test/packages/EABase/test/packages/EAMain b/EASTL/test/packages/EABase/test/packages/EAMain
new file mode 160000
+Subproject 24ca8bf09e6b47b860286fc2f4c832f4009273d
diff --git a/EASTL/test/packages/EABase/test/packages/EASTL b/EASTL/test/packages/EABase/test/packages/EASTL
new file mode 160000
+Subproject b2548637826302a33f19f0635a0101cfee5a0ab
diff --git a/EASTL/test/packages/EABase/test/packages/EAStdC b/EASTL/test/packages/EABase/test/packages/EAStdC
new file mode 160000
+Subproject 8dc9e314fdbe09d0627c613ae2eb6543859e995
diff --git a/EASTL/test/packages/EABase/test/packages/EATest b/EASTL/test/packages/EABase/test/packages/EATest
new file mode 160000
+Subproject a59b372fc9cba517283ad6d060d2ab96e0ba34a
diff --git a/EASTL/test/packages/EABase/test/packages/EAThread b/EASTL/test/packages/EABase/test/packages/EAThread
new file mode 160000
+Subproject e4367a36f2e55d10b2b994bfbae8edf21f15baf
diff --git a/EASTL/test/packages/EABase/test/source/CEntryPoint.cpp b/EASTL/test/packages/EABase/test/source/CEntryPoint.cpp
new file mode 100644
index 0000000..469581f
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/source/CEntryPoint.cpp
@@ -0,0 +1,4 @@
+// EAMain/EAEntryPointMain.inl contains C++ code but it exposes the application entry point with C linkage.
+
+#include "EAMain/EAEntryPointMain.inl"
+#include "EATest/EASTLNewOperatorGuard.inl"
diff --git a/EASTL/test/packages/EABase/test/source/TestEABase.cpp b/EASTL/test/packages/EABase/test/source/TestEABase.cpp
new file mode 100644
index 0000000..1e7bee9
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/source/TestEABase.cpp
@@ -0,0 +1,3742 @@
+///////////////////////////////////////////////////////////////////////////////
+// TestEABase.cpp
+//
+// Copyright (c) 2003 Electronic Arts, Inc. -- All Rights Reserved.
+// Created by Paul Pedriana.
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TestEABase.h"
+#include "TestEABase.h" // Intentionally double-include the same header file, to test it.
+#include <EABase/eabase.h>
+#include <EABase/earesult.h>
+#include <EABase/eahave.h>
+#include <EABase/nullptr.h>
+#include <EABase/eaunits.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <cmath>
+#include <new>
+#include <assert.h>
+#include <stdarg.h>
+#include <EAMain/EAEntryPointMain.inl>
+#include <EATest/EASTLVsnprintf.inl>
+#include <EATest/EASTLNewOperatorGuard.inl>
+#include <EATest/EATest.h>
+#include <EASTL/vector.h>
+#include <EASTL/fixed_vector.h>
+#include <EASTL/string.h>
+#include <EASTL/sort.h>
+#include <EASTL/numeric_limits.h>
+#include <EAStdC/EAString.h>
+#if !defined(EA_COMPILER_NO_STANDARD_CPP_LIBRARY)
+EA_DISABLE_ALL_VC_WARNINGS()
+ #include <iterator>
+EA_RESTORE_ALL_VC_WARNINGS()
+#endif
+
+#if defined(EA_COMPILER_MSVC) && defined(EA_PLATFORM_MICROSOFT)
+ EA_DISABLE_ALL_VC_WARNINGS()
+ #define NOMINMAX
+ #include <Windows.h>
+ EA_RESTORE_ALL_VC_WARNINGS()
+#elif defined(EA_PLATFORM_ANDROID)
+ #include <android/log.h>
+#endif
+
+#if EA_FP16C
+ // Include emmintrin.h so that the test code can try to call one of the intrinsics.
+ #include "emmintrin.h"
+ #if EA_COMPILER_CLANG
+ // On some versions of clang immintrin.h needs to be included to pull in f16c operations.
+ #include "immintrin.h"
+ #endif
+#endif
+
+EA_DISABLE_SN_WARNING(1229) // function is deprecated.
+EA_DISABLE_VC_WARNING(4265 4296 4310 4350 4481 4530 4625 4626 4996)
+
+
+// ------------------------------------------------------------------------
+// EA_STATIC_WARNING
+//
+// ** Temporarily here instead of eabase.h **
+//
+// Unilaterally prints a message during the compilation pre-processing phase.
+// No string quotes are required, and no trailing semicolon should be used.
+// As of this writing, clang reports this usage like a warning, but using
+// -Wno-#pragma-messages causes both the warning and message to go away.
+//
+// Example usage:
+// EA_STATIC_WARNING(This function is deprecated.)
+//
+#if defined(_MSC_VER)
+ #define EA_PRAGMA_MESSAGE(x) __pragma(message(#x))
+ #define EA_STATIC_WARNING(msg) EA_PRAGMA_MESSAGE(msg)
+#elif defined(__clang__) || (defined(__GNUC__) && (EA_COMPILER_VERSION >= 4005)) || defined(__SN_VER__)
+ #define EA_PRAGMA(x) _Pragma(#x)
+ #define EA_STATIC_WARNING(msg) EA_PRAGMA(message(#msg))
+#else
+ #define EA_STATIC_WARNING(msg)
+#endif
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// 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
+///////////////////////////////////////////////////////////////////////////////
+
+// EA_HAVE_EXTENSIONS_FEATURE
+// We don't yet have a test for this.
+
+// EA_HAVE_DINKUMWARE_CPP_LIBRARY
+// EA_HAVE_LIBSTDCPP_LIBRARY
+// EA_HAVE_LIBCPP_LIBRARY
+
+#if defined(EA_HAVE_DINKUMWARE_CPP_LIBRARY)
+ #if !defined(_YVALS)
+ #error
+ #endif
+#elif defined(EA_HAVE_LIBSTDCPP_LIBRARY)
+ #if !defined(__GLIBCXX__) && !defined(__GLIBCPP__)
+ #error
+ #endif
+#elif defined(EA_HAVE_LIBCPP_LIBRARY)
+ #if !defined(_LIBCPP_VERSION)
+ #error
+ #endif
+#endif
+
+// EA_HAVE_XXX_H
+#if defined(EA_HAVE_SYS_TYPES_H)
+ #include <sys/types.h>
+#endif
+#if defined(EA_HAVE_IO_H)
+ #include <io.h>
+#endif
+#if defined(EA_HAVE_INTTYPES_H)
+ #include <inttypes.h>
+#endif
+#if defined(EA_HAVE_UNISTD_H)
+ #include <unistd.h>
+#endif
+#if defined(EA_HAVE_SYS_TIME_H)
+ #include <sys/time.h>
+#endif
+#if defined(EA_HAVE_SYS_PTRACE_H)
+ #include <sys/ptrace.h>
+#endif
+#if defined(EA_HAVE_SYS_STAT_H)
+ #include <sys/stat.h>
+#endif
+#if defined(EA_HAVE_LOCALE_H)
+ #include <locale.h>
+#endif
+#if defined(EA_HAVE_DIRENT_H)
+ #include <dirent.h>
+#endif
+#if defined(EA_HAVE_SIGNAL_H)
+ #include <signal.h>
+#endif
+#if defined(EA_HAVE_SYS_SIGNAL_H)
+ #include <sys/signal.h>
+#endif
+#if defined(EA_HAVE_PTHREAD_H)
+ #include <pthread.h>
+#endif
+#if defined(EA_HAVE_WCHAR_H)
+ #include <wchar.h>
+#endif
+#if defined(EA_HAVE_MALLOC_H)
+ #include <malloc.h>
+#endif
+#if defined(EA_HAVE_ALLOCA_H)
+ #include <alloca.h>
+#endif
+#if defined(EA_HAVE_EXECINFO_H)
+ #include <execinfo.h>
+#endif
+#if defined(EA_HAVE_SEMAPHORE_H)
+ #include <semaphore.h>
+#endif
+
+#if defined(EA_HAVE_CPP11_CONTAINERS)
+ #include <array>
+ #include <forward_list>
+ #include <unordered_set>
+ #include <unordered_map>
+#endif
+#if defined(EA_HAVE_CPP11_ATOMIC)
+ #include <atomic>
+#endif
+#if defined(EA_HAVE_CPP11_CONDITION_VARIABLE)
+ #include <condition_variable>
+#endif
+#if defined(EA_HAVE_CPP11_MUTEX)
+ #include <mutex>
+#endif
+#if defined(EA_HAVE_CPP11_THREAD)
+ #if defined(_MSC_VER) && defined(EA_COMPILER_NO_EXCEPTIONS) || defined(EA_COMPILER_NO_UNWIND)
+ // Skip this #include, as VC++ has a bug: <concrt.h> (included by <future>) fails to compile when exceptions are disabled.
+ #else
+ #include <thread>
+ #endif
+#endif
+#if defined(EA_HAVE_CPP11_FUTURE)
+ #if defined(_MSC_VER) && defined(EA_COMPILER_NO_EXCEPTIONS) || defined(EA_COMPILER_NO_UNWIND)
+ // Skip this #include, as VC++ has a bug: <concrt.h> (included by <future>) fails to compile when exceptions are disabled.
+ #else
+ #include <future>
+ #endif
+#endif
+#if defined(EA_HAVE_CPP11_TYPE_TRAITS)
+ #include <type_traits>
+#endif
+#if defined(EA_HAVE_CPP11_TUPLES)
+ #include <tuple>
+#endif
+#if defined(EA_HAVE_CPP11_REGEX)
+ #include <regex>
+#endif
+#if defined(EA_HAVE_CPP11_RANDOM)
+ #include <random>
+#endif
+#if defined(EA_HAVE_CPP11_CHRONO)
+ #include <chrono>
+#endif
+#if defined(EA_HAVE_CPP11_SCOPED_ALLOCATOR)
+ #include <scoped_allocator>
+#endif
+#if defined(EA_HAVE_CPP11_INITIALIZER_LIST)
+ #include <initializer_list>
+#else
+ // If there is no initializer_list support the the following should succeed.
+ // The following is disabled because EASTL defines initializer_list itself and that can collide with this:
+ // namespace std{ template<class E> class initializer_list{ }; }
+#endif
+#if defined(EA_HAVE_CPP11_SYSTEM_ERROR)
+ #include <system_error>
+#endif
+#if defined(EA_HAVE_CPP11_CODECVT)
+ #include <codecvt>
+#endif
+#if defined(EA_HAVE_CPP11_TYPEINDEX)
+ #include <typeindex>
+#endif
+
+
+
+// EA_HAVE_XXX_IMPL
+#if defined(EA_HAVE_inet_ntop_IMPL)
+ #include <arpa/inet.h>
+#endif
+
+#if defined(EA_HAVE_time_IMPL)
+ #include <time.h>
+#endif
+
+#if defined(EA_HAVE_clock_gettime_IMPL)
+ #include <time.h>
+#endif
+
+#if defined(EA_HAVE_getcwd_IMPL)
+ #if defined(EA_PLATFORM_MICROSOFT)
+ #include <direct.h>
+ #else
+ #include <unistd.h>
+ #endif
+#endif
+
+#if defined(EA_HAVE_std_terminate_IMPL)
+ #include <exception>
+#endif
+
+#if defined(EA_HAVE_CPP11_ITERATOR_IMPL)
+ #include <iterator>
+#endif
+
+#if defined(EA_HAVE_CPP11_SMART_POINTER_IMPL)
+ #include <memory>
+#endif
+
+#if defined(EA_HAVE_CPP11_FUNCTIONAL_IMPL)
+ #include <functional>
+ void BindTestFunction(int /*n1*/, int /*n2*/, int /*n3*/, const int& /*n4*/, int /*n5*/)
+ {
+ }
+
+ struct BindTestStruct
+ {
+ void Test(int /*n1*/, int /*n2*/) const
+ {
+ }
+ };
+#endif
+
+#if defined(EA_HAVE_CPP11_EXCEPTION_IMPL)
+ #include <exception>
+#endif
+
+
+EA_DISABLE_SN_WARNING(1229) // function is deprecated.
+
+
+// Some CPU/Compiler combinations don't support arbitrary alignment declarations.
+// In particular some ARM compilers often don't. You can use EAStdC's EAAlignment to
+// achieve arbitrary alignment if EA_ALIGN doesn't work.
+#if (EA_ALIGN_MAX_AUTOMATIC < 64)
+ #define ALIGNMENT_AMOUNT_64 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_64 64
+#endif
+
+#if (EA_ALIGN_MAX_AUTOMATIC < 32)
+ #define ALIGNMENT_AMOUNT_32 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_32 32
+#endif
+
+#if (EA_ALIGN_MAX_AUTOMATIC < 16)
+ #define ALIGNMENT_AMOUNT_16 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_16 16
+#endif
+
+
+// EA_OVERRIDE
+struct OverrideBase { virtual ~OverrideBase(){} virtual void f(int){} };
+struct OverrideDerived : public OverrideBase { void f(int) EA_OVERRIDE {} };
+
+
+// EA_INHERITANCE_FINAL
+struct FinalBase EA_INHERITANCE_FINAL { virtual ~FinalBase(){} virtual void f() EA_INHERITANCE_FINAL; };
+
+
+// EA_SEALED
+struct SealedBase EA_SEALED { virtual ~SealedBase(){} virtual void f() EA_SEALED; };
+
+
+// EA_ABSTRACT
+struct AbstractBase EA_ABSTRACT {virtual ~AbstractBase(){} virtual void f(){} };
+
+
+// EA_CONSTEXPR / EA_COMPILER_NO_CONSTEXPR
+EA_CONSTEXPR int GetValue(){ return 37; }
+
+
+// EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE
+template struct eabase_template<char>;
+
+
+// Forward declarations
+template<class T>
+bool VerifyValue(T v1, T v2);
+void DoError(int& nErrorCount, const char* pMessage = NULL);
+int Stricmp(const char* pString1, const char* pString2);
+int TestEABase();
+int TestEAResult();
+int TestEAPlatform();
+bool TestNU();
+int TestEACompiler();
+int TestEACompilerTraits();
+
+
+template<class T>
+bool VerifyValue(T v1, T v2)
+{
+ return (v1 == v2);
+}
+
+
+// Test EA_PLATFORM_XXX support
+// We don't do anything with the defined values below. We are just doing basic testing
+// of the usage of #if EA_PLATFORM_XXX
+#if EA_PLATFORM_WIN64
+ #define EA_PLATFORM_WIN64_OK
+#elif EA_PLATFORM_WIN32
+ #define EA_PLATFORM_WIN64_OK
+#elif EA_PLATFORM_WINDOWS
+ #define EA_PLATFORM_WINDOWS_OK
+#elif EA_PLATFORM_POSIX
+ #define EA_PLATFORM_POSIX_OK
+#elif EA_PLATFORM_UNIX
+ #define EA_PLATFORM_UNIX_OK
+#elif EA_PLATFORM_APPLE
+ #define EA_PLATFORM_APPLE_OK
+#elif EA_PLATFORM_CONSOLE
+ #define EA_PLATFORM_CONSOLE_OK
+#elif EA_PLATFORM_DESKTOP
+ #define EA_PLATFORM_DESKTOP_OK
+#else
+ #define EA_PLATFORM_OK
+#endif
+
+
+
+/* Test EA_DISABLE_WARNING */
+EA_DISABLE_VC_WARNING(4548 4127)
+EA_DISABLE_ALL_VC_WARNINGS()
+EA_RESTORE_ALL_VC_WARNINGS()
+
+EA_DISABLE_GCC_WARNING(-Wuninitialized)
+
+EA_DISABLE_SN_WARNING(1787)
+EA_DISABLE_ALL_SN_WARNINGS()
+EA_RESTORE_ALL_SN_WARNINGS()
+
+EA_DISABLE_GHS_WARNING(123)
+
+EA_DISABLE_EDG_WARNING(193)
+
+EA_DISABLE_CW_WARNING(10317)
+EA_DISABLE_ALL_CW_WARNINGS()
+EA_RESTORE_ALL_CW_WARNINGS()
+
+/* Test EA_DISABLE_WARNING */
+EA_RESTORE_VC_WARNING()
+EA_RESTORE_GCC_WARNING()
+EA_RESTORE_SN_WARNING()
+EA_RESTORE_GHS_WARNING()
+EA_RESTORE_EDG_WARNING()
+EA_RESTORE_CW_WARNING(10317)
+
+
+void DoError(int& nErrorCount, const char* pMessage)
+{
+ ++nErrorCount;
+ if(pMessage)
+ EA::EAMain::Report("Test error: %s\n", pMessage);
+}
+
+
+int Stricmp(const char* pString1, const char* pString2)
+{
+ char c1, c2;
+
+ while((c1 = (char)tolower(*pString1++)) == (c2 = (char)tolower(*pString2++)))
+ {
+ if(c1 == 0)
+ return 0;
+ }
+
+ return (c1 - c2);
+}
+
+
+// EA_PURE
+static EA_PURE bool PureFunction()
+{
+ return (strlen("abc") == 3);
+}
+
+// EA_WEAK
+EA_WEAK int gWeakVariable = 1;
+
+
+// EA_NO_VTABLE
+struct EA_NO_VTABLE NoVTable1
+{
+ virtual ~NoVTable1(){}
+ virtual void InterfaceFunction()
+ {
+ }
+};
+
+EA_STRUCT_NO_VTABLE(NoVTable2)
+{
+ virtual ~NoVTable2(){}
+ virtual void InterfaceFunction()
+ {
+ }
+};
+
+class NoVTable1Subclass : public NoVTable1
+{
+ virtual void InterfaceFunction()
+ {
+ }
+};
+
+class NoVTable2Subclass : public NoVTable2
+{
+ virtual void InterfaceFunction()
+ {
+ }
+};
+
+
+
+struct ClassWithDefaultCtor
+{
+ ClassWithDefaultCtor(int x = 0)
+ { char buffer[16]; sprintf(buffer, "%d", x); }
+};
+
+
+struct ClassWithoutDefaultCtor
+{
+ ClassWithoutDefaultCtor(int x)
+ { char buffer[16]; sprintf(buffer, "%d", x); }
+};
+
+
+struct InitPriorityTestClass
+{
+ int mX;
+ InitPriorityTestClass(int x = 0) { mX = x; }
+};
+
+
+struct OffsetofTestClass // Intentionally a non-pod.
+{
+ int32_t mX;
+ int32_t mY;
+ OffsetofTestClass(int32_t x = 0) : mX(x), mY(0) { }
+};
+
+struct SizeofMemberTestClass // Intentionally a non-pod.
+{
+ int32_t mX;
+ int32_t mY;
+ SizeofMemberTestClass(int32_t x = 0) : mX(x), mY(0) { }
+};
+
+// EA_INIT_PRIORITY
+InitPriorityTestClass gInitPriorityTestClass0 EA_INIT_PRIORITY(2000);
+InitPriorityTestClass gInitPriorityTestClass1 EA_INIT_PRIORITY(2000) (1);
+
+// EA_INIT_SEG
+EA_INIT_SEG(compiler) InitPriorityTestClass gInitSegTestSection(2300);
+
+
+// EA_MAY_ALIAS
+void* EA_MAY_ALIAS gPtr0 = NULL;
+
+typedef void* EA_MAY_ALIAS pvoid_may_alias;
+pvoid_may_alias gPtr1 = NULL;
+
+
+// EA_NO_INLINE
+static EA_NO_INLINE void DoNothingInline()
+{
+}
+
+
+// EA_PREFIX_NO_INLINE / EA_POSTFIX_NO_INLINE
+static void EA_PREFIX_NO_INLINE DoNothingPrefixInline() EA_POSTFIX_NO_INLINE;
+
+static void DoNothingPrefixInline()
+{
+}
+
+
+// EA_FORCE_INLINE
+static EA_FORCE_INLINE void DoNothingForceInline()
+{
+}
+
+
+// EA_PREFIX_FORCE_INLINE / EA_POSTFIX_FORCE_INLINE
+static void EA_PREFIX_FORCE_INLINE DoNothingPrefixForceInline() EA_POSTFIX_FORCE_INLINE;
+
+static void DoNothingPrefixForceInline()
+{
+}
+
+
+// static_asset at global scope
+// Should succeed.
+static_assert(sizeof(int32_t) == 4, "static_assert failure");
+// Should fail.
+//static_assert(sizeof(int32_t) == 8, "static_assert failure");
+
+
+// EA_STATIC_WARNING
+EA_DISABLE_CLANG_WARNING(-W#pragma-messages) // Clang treats messages as warnings.
+EA_STATIC_WARNING(EA_STATIC_WARNING test)
+EA_RESTORE_CLANG_WARNING()
+
+
+// EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+EA_OPTIMIZE_OFF()
+static EA_NO_INLINE int DisabledOptimizations(int x)
+{
+ return x * 37;
+}
+EA_OPTIMIZE_ON()
+
+
+// EA_UNUSED
+static void FunctionWithUnusedVariables(int x)
+{
+ int y = 0;
+ EA_UNUSED(x);
+ EA_UNUSED(y);
+}
+
+
+// EA_NON_COPYABLE / EANonCopyable
+struct NonCopyableA
+{
+ NonCopyableA(){}
+ int x;
+
+ EA_NON_COPYABLE(NonCopyableA)
+};
+
+EA_DISABLE_VC_WARNING(4625 4626) // C4625: A copy constructor was not accessible in a base class and was therefore not generated for a derived class. C4626: An assignment operator was not accessible in a base class and was therefore not generated for a derived class.
+struct NonCopyableB : public EANonCopyable
+{
+ #if !EA_COMPILER_NO_DELETED_FUNCTIONS
+ NonCopyableB& operator=(NonCopyableB&& other) = delete;
+ #endif
+ int x;
+};
+EA_RESTORE_VC_WARNING()
+
+
+
+// Exercize the case of using EA_NON_COPYABLE when
+struct NonDefaultConstructibleBase
+{
+ int mX;
+ NonDefaultConstructibleBase(int x) : mX(x){}
+};
+
+struct NonCopyableSubclass : public NonDefaultConstructibleBase
+{
+ NonCopyableSubclass(int x) : NonDefaultConstructibleBase(x){}
+ EA_NON_COPYABLE(NonCopyableSubclass)
+};
+
+
+
+
+// EA_COMPILER_NO_DEFAULTED_FUNCTIONS
+// EA_COMPILER_NO_DELETED_FUNCTIONS
+//
+// We currently test only the ability of the compiler to build the code,
+// and don't test if the compiler built it correctly.
+struct DefaultedDeletedTest
+{
+ #if defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS)
+ DefaultedDeletedTest(){}
+ #else
+ DefaultedDeletedTest() = default;
+ #endif
+
+ #if defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS)
+ ~DefaultedDeletedTest(){}
+ #else
+ ~DefaultedDeletedTest() = delete;
+ #endif
+};
+
+
+struct EA_FUNCTION_DELETE_Test
+{
+ int x;
+ EA_FUNCTION_DELETE_Test(int xValue) : x(xValue){}
+
+private: // For portability with pre-C++11 compilers, make the function private.
+ void foo() EA_FUNCTION_DELETE;
+};
+
+
+#if !defined(EA_COMPILER_NO_USER_DEFINED_LITERALS)
+ // Conversion example
+ inline long double operator"" _deg(long double degrees)
+ { return (degrees * 3.141592) / 180; }
+
+ // Custom type example
+ struct UDLTest
+ {
+ UDLTest() : mX(0){}
+ UDLTest(uint64_t x) : mX(x){}
+
+ uint64_t mX;
+ };
+
+ UDLTest operator"" _udl(unsigned long long x) // The type must be unsigned long long and can't be uint64_t, as uint64_t might be unsigned long int.
+ { return UDLTest(x); }
+#endif
+
+
+#if !defined(EA_COMPILER_NO_INLINE_NAMESPACES)
+ namespace INSNamespace
+ {
+ inline namespace INSNamespace_1
+ {
+ template <typename T>
+ class A;
+ }
+
+ template <typename T>
+ int g(T){ return 37; }
+ }
+
+ struct INSClass{ };
+
+ namespace INSNamespace
+ {
+ template<>
+ class A<INSClass>{ };
+ }
+
+#endif
+
+
+#if !defined(EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
+ struct FunctionTemplateTest
+ {
+ template<typename T = int>
+ static T AddOne(T value)
+ { return value + 1; }
+ };
+#endif
+
+
+#if !defined(EA_COMPILER_NO_NOEXCEPT)
+ int NoExceptTestFunction() EA_NOEXCEPT
+ { return 37; }
+
+ struct NoExceptTestStruct
+ {
+ int mX;
+ NoExceptTestStruct() : mX(37) {}
+ };
+
+ template <class T>
+ int NoExceptTestTemplate() EA_NOEXCEPT_IF(EA_NOEXCEPT_EXPR(T()))
+ { T t; return t.mX; }
+#endif
+
+
+// The following function defintions are intended to generate compilation errors if EA_CHAR16_NATIVE or EA_CHAR32_NATIVE is set to 1 when it should be 0.
+// i.e. if the types are not actually native then their will be a function redefinition error generated.
+void NoopTakingString(const wchar_t *)
+{
+}
+#if EA_WCHAR_UNIQUE
+ #if EA_WCHAR_SIZE == 2
+ // This definition should not conflict with the wchar_t defintion because char16_t should be unique.
+ void NoopTakingString(const char16_t *)
+ {
+ #if !EA_CHAR16_NATIVE
+ #error Expected EA_CHAR16_NATIVE to be 1.
+ #endif
+ }
+ #else
+ // This definition should not conflict with the wchar_t defintion because char32_t should be unique.
+ void NoopTakingString(const char32_t *)
+ {
+ #if !EA_CHAR32_NATIVE
+ #error Expected EA_CHAR32_NATIVE to be 1.
+ #endif
+ }
+
+ #endif
+#endif
+
+
+int TestEABase()
+{
+ int nErrorCount(0);
+
+ DoNothingInline();
+
+ // Test NULL
+ {
+ if(!VerifyValue<void*>(NULL, (void*)0))
+ DoError(nErrorCount, "unspecified test");
+ }
+
+ // Verify sized type sizes
+ {
+ if(!VerifyValue<size_t>(sizeof(int8_t), 1))
+ DoError(nErrorCount, "int8_t size test");
+ if(!VerifyValue<size_t>(sizeof(uint8_t), 1))
+ DoError(nErrorCount, "uint8_t size test");
+ if(!VerifyValue<size_t>(sizeof(int16_t), 2))
+ DoError(nErrorCount, "int16_t size test");
+ if(!VerifyValue<size_t>(sizeof(uint16_t), 2))
+ DoError(nErrorCount, "uint16_t size test");
+ if(!VerifyValue<size_t>(sizeof(int32_t), 4))
+ DoError(nErrorCount, "int32_t size test");
+ if(!VerifyValue<size_t>(sizeof(uint32_t), 4))
+ DoError(nErrorCount, "uint32_t size test");
+ if(!VerifyValue<size_t>(sizeof(int64_t), 8))
+ DoError(nErrorCount, "int64_t size test");
+ if(!VerifyValue<size_t>(sizeof(uint64_t), 8))
+ DoError(nErrorCount, "uint64_t size test");
+
+ #if !defined(FLT_EVAL_METHOD)
+ #error EABase should always define FLT_EVAL_METHOD
+ DoError(nErrorCount, "FLT_EVAL_METHOD test: not defined.");
+ #else
+ #if (FLT_EVAL_METHOD == -1)
+ // In this case the C99 standard states that the
+ // precision of float_t and double_t is indeterminable.
+ #elif (FLT_EVAL_METHOD == 0)
+ if(!VerifyValue<size_t>(sizeof(float_t), sizeof(float)))
+ DoError(nErrorCount, "float_t size test");
+ if(!VerifyValue<size_t>(sizeof(double_t), sizeof(double)))
+ DoError(nErrorCount, "double_t size test");
+ #elif (FLT_EVAL_METHOD == 1)
+ if(!VerifyValue<size_t>(sizeof(float_t), sizeof(double)))
+ DoError(nErrorCount, "float_t size test");
+ if(!VerifyValue<size_t>(sizeof(double_t), sizeof(double)))
+ DoError(nErrorCount, "double_t size test");
+ #elif (FLT_EVAL_METHOD == 2)
+ if(!VerifyValue<size_t>(sizeof(float_t), sizeof(long double)))
+ DoError(nErrorCount, "float_t size test");
+ if(!VerifyValue<size_t>(sizeof(double_t), sizeof(long double)))
+ DoError(nErrorCount, "double_t size test");
+ #else
+ DoError(nErrorCount, "FLT_EVAL_METHOD test: invalid value.");
+ #endif
+ #endif
+
+ if(sizeof(bool8_t) != 1)
+ DoError(nErrorCount, "bool8_t size test");
+
+ if(!VerifyValue<size_t>(sizeof(intptr_t), sizeof(void*)))
+ DoError(nErrorCount, "intptr_t size test");
+ if(!VerifyValue<size_t>(sizeof(uintptr_t), sizeof(void*)))
+ DoError(nErrorCount, "uintptr_t size test");
+
+ if(!VerifyValue<size_t>(sizeof(ssize_t), sizeof(size_t)))
+ DoError(nErrorCount, "ssize_t size test");
+
+ EA_DISABLE_VC_WARNING(6326)
+ const ssize_t ss(1); // Verify that ssize_t is a signed type.
+ if(ssize_t((ss ^ ss) - 1) >= 0)
+ DoError(nErrorCount, "ssize_t sign test");
+ EA_RESTORE_VC_WARNING()
+
+ if(!VerifyValue<size_t>(sizeof(char8_t), 1))
+ DoError(nErrorCount, "char8_t size test");
+ if(!VerifyValue<size_t>(sizeof(char16_t), 2))
+ DoError(nErrorCount, "char16_t size test");
+ if(!VerifyValue<size_t>(sizeof(char32_t), 4))
+ DoError(nErrorCount, "char32_t size test");
+
+ #if (EA_WCHAR_SIZE == 2) || (EA_WCHAR_SIZE == 4)
+ if(!VerifyValue<size_t>(sizeof(wchar_t), EA_WCHAR_SIZE))
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #else
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #endif
+ }
+
+ // Test CHAR8_MIN, etc.
+ {
+ // The C standard allows compilers/platforms to use -127 as the min 8 bit value, but we've never seen it in modern systems.
+ static_assert(((((CHAR8_MIN == -128) && (CHAR8_MAX == 127))) || ((CHAR8_MIN == 0) && (CHAR8_MAX == 255))), "CHAR8_MAX failure");
+ static_assert(((((CHAR16_MIN == -32768) && (CHAR16_MAX == 32767))) || ((CHAR16_MIN == 0) && (CHAR16_MAX == 65535))), "CHAR16_MAX failure");
+ static_assert(((((CHAR32_MIN == -INT64_C(2147483648)) && (CHAR32_MAX == INT64_C(2147483647)))) || ((CHAR32_MIN == 0) && (CHAR32_MAX == INT64_C(4294967295)))), "CHAR32_MAX failure");
+ }
+
+ // Test char8_t, char16_t, char32_t string literals.
+ {
+ const char8_t* p8 = EA_CHAR8("abc");
+ const char8_t c8 = EA_CHAR8('a');
+
+ #ifdef EA_CHAR16
+ const char16_t* p16 = EA_CHAR16("abc"); // Under GCC, this assumes compiling with -fshort-wchar
+ const char16_t c16 = EA_CHAR16('\x3001');
+ #else
+ const char16_t* p16 = NULL;
+ const char16_t c16 = static_cast<char16_t>('X');
+ #endif
+
+ #ifdef EA_CHAR32
+ const char32_t* p32 = EA_CHAR32("abc");
+ const char32_t c32 = EA_CHAR32('\x3001');
+ #else
+ const char32_t p32[] = { 'a', 'b', 'c', '\0' }; // Microsoft doesn't support 32 bit strings here, and GCC doesn't use them when we compile with -fshort-wchar (which we do).
+ #ifdef EA_CHAR16
+ const char32_t c32 = EA_CHAR16('\x3001'); // 16 bit should silently convert to 32 bit.
+ #else
+ const char32_t c32 = static_cast<char16_t>('X'); // 16 bit should silently convert to 32 bit.
+ #endif
+ #endif
+
+ const wchar_t* pW = EA_WCHAR("abc");
+ const wchar_t cW = EA_WCHAR('\x3001');
+
+ EA_UNUSED(p8);
+ EA_UNUSED(c8);
+ EA_UNUSED(p16);
+ EA_UNUSED(c16);
+ EA_UNUSED(p32);
+ EA_UNUSED(c32);
+ EA_UNUSED(pW);
+ EA_UNUSED(cW);
+ }
+
+ // Verify sized type signs
+ {
+ int8_t i8(1);
+ if(int8_t((i8 ^ i8) - 1) >= 0)
+ DoError(nErrorCount, "int8_t sign test");
+
+ uint8_t u8(1);
+ if(uint8_t((u8 ^ u8) - 1) <= 0)
+ DoError(nErrorCount, "uint8_t sign test");
+
+ int16_t i16(1);
+ if(int16_t((i16 ^ i16) - 1) >= 0)
+ DoError(nErrorCount, "int16_t sign test");
+
+ uint16_t u16(1);
+ if(uint16_t((u16 ^ u16) - 1) <= 0)
+ DoError(nErrorCount, "uint16_t sign test");
+
+ int32_t i32(1);
+ if(int32_t((i32 ^ i32) - 1) >= 0)
+ DoError(nErrorCount, "int32_t sign test");
+
+ uint32_t u32(1);
+ if(uint32_t((u32 ^ u32) - 1) <= 0)
+ DoError(nErrorCount, "uint32_t sign test");
+
+ int64_t i64(1);
+ if(int64_t((i64 ^ i64) - 1) >= 0)
+ DoError(nErrorCount, "int64_t sign test");
+
+ uint64_t u64(1);
+ if(uint64_t((u64 ^ u64) - 1) <= 0)
+ DoError(nErrorCount, "uint64_t sign test");
+
+
+
+ intptr_t ip(1);
+ if(intptr_t((ip ^ ip) - 1) >= 0)
+ DoError(nErrorCount, "intptr_t sign test");
+
+ uintptr_t up(1);
+ if(uintptr_t((up ^ up) - 1) <= 0)
+ DoError(nErrorCount, "uintptr_t sign test");
+
+
+ // The following sign tests have been disabled, as the determination of
+ // the sign of type char and wchar_t are in the hands of the compiler and
+ // the user's configuration of that compiler.
+
+ //char8_t c8(1); // We expect it to be signed, though the need for such a requirement is debateable.
+ //if(char8_t((c8 ^ c8) - 1) >= 0)
+ // DoError(nErrorCount, "char8_t sign test");
+
+ //char16_t c16(1); // We expect it to be unsigned
+ //if(char16_t((c16 ^ c16) - 1) <= 0)
+ // DoError(nErrorCount, "char16_t sign test");
+
+ //char32_t c32(1); // We expect it to be unsigned
+ //if(char32_t((c32 ^ c32) - 1) <= 0)
+ // DoError(nErrorCount, "char32_t sign test");
+ }
+
+
+
+ //Test Constant macros
+ {
+ char buffer[256];
+
+ const int8_t i8Min = INT8_C(-128); // Strictly speaking, the C language standard allows this to be -127 as well.
+ const int8_t i8Max = INT8_C(127);
+
+ const uint8_t u8Min = UINT8_C(0);
+ const uint8_t u8Max = UINT8_C(255);
+
+ const int16_t i16Min = INT16_C(-32767) - 1;
+ const int16_t i16Max = INT16_C( 32767);
+
+ const uint16_t u16Min = UINT16_C(0);
+ const uint16_t u16Max = UINT16_C(65535);
+
+ const int32_t i32Min = INT32_C(-2147483647) - 1;
+ const int32_t i32Max = INT32_C( 2147483647);
+
+ const uint32_t u32Min = UINT32_C(0);
+ const uint32_t u32Max = UINT32_C(4294967295);
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const int64_t i64Min = -9223372036854775807LL - 1;
+ const int64_t i64Max = 9223372036854775807LL;
+
+ const uint64_t u64Min = UINT64_C(0);
+ const uint64_t u64Max = 18446744073709551615ULL;
+ #else
+ const int64_t i64Min = INT64_C(-9223372036854775807) - 1;
+ const int64_t i64Max = INT64_C( 9223372036854775807);
+
+ const uint64_t u64Min = UINT64_C(0);
+ const uint64_t u64Max = UINT64_C(18446744073709551615);
+ #endif
+
+ sprintf(buffer, "%d %d %u %u %d %d %u %u %d %d %u %u %" SCNd64" %" SCNd64" %" SCNu64" %" SCNu64,
+ (int)i8Min, (int)i8Max, (unsigned)u8Min, (unsigned)u8Max,
+ (int)i16Min, (int)i16Max, (unsigned)u16Min, (unsigned)u16Max,
+ (int)i32Min, (int)i32Max, (unsigned)u32Min, (unsigned)u32Max,
+ i64Min, i64Max, u64Min, u64Max);
+ if(strcmp(buffer, "-128 127 0 255 -32768 32767 0 65535 -2147483648 2147483647 0 4294967295 -9223372036854775808 9223372036854775807 0 18446744073709551615"))
+ DoError(nErrorCount, "INT_C test");
+
+ EA_DISABLE_VC_WARNING(6326)
+ // Verify the use of hex numbers with INT64_C
+ const int64_t i64Hex = INT64_C(0x1111111122222222);
+ if(i64Hex != INT64_C(1229782938533634594))
+ DoError(nErrorCount, "INT64_C hex error");
+ EA_RESTORE_VC_WARNING()
+
+ // Verify the use of hex numbers with UINT64_C
+ const uint64_t u64Hex = UINT64_C(0xaaaaaaaabbbbbbbb);
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const uint64_t temp = 12297829382759365563ULL;
+ #else
+ const uint64_t temp = UINT64_C(12297829382759365563);
+ #endif
+
+ EA_DISABLE_VC_WARNING(6326)
+ if(u64Hex != temp)
+ DoError(nErrorCount, "UINT64_C hex error");
+ EA_RESTORE_VC_WARNING()
+
+ // Verify that the compiler both allows division with uint64_t but
+ // also that it allows it via UINT64_MAX. A bad implementation of
+ // UINT64_MAX would cause the code below to mis-execute or not compile.
+ EA_DISABLE_VC_WARNING(6326)
+ const uint64_t resultUint64 = UINT64_MAX / 2;
+ if(resultUint64 != UINT64_C(9223372036854775807))
+ DoError(nErrorCount, "UINT64_MAX error");
+ EA_RESTORE_VC_WARNING()
+ }
+
+ {
+ static_assert(INTPTR_MIN == eastl::numeric_limits<intptr_t>::min(), "INTPTR_MIN failure");
+ static_assert(INTPTR_MAX == eastl::numeric_limits<intptr_t>::max(), "INTPTR_MAX failure");
+ //static_assert(UINTPTR_MIN == eastl::numeric_limits<uintptr_t>::min(), "UINTPTR_MIN failure"); // not specified by the standard
+ static_assert(UINTPTR_MAX == eastl::numeric_limits<uintptr_t>::max(), "UINTPTR_MAX failure");
+ static_assert(INTMAX_MIN == eastl::numeric_limits<intmax_t>::min(), "INTMAX_MIN failure");
+ static_assert(INTMAX_MAX == eastl::numeric_limits<intmax_t>::max(), "INTMAX_MAX failure");
+ //static_assert(UINTMAX_MIN == eastl::numeric_limits<uintmax_t>::MIN(), "UINTMAX_MIN failure"); // not specified by the standard
+ static_assert(UINTMAX_MAX == eastl::numeric_limits<uintmax_t>::max(), "UINTMAX_MAX failure");
+ }
+
+ //Test sized printf format specifiers
+ {
+ char buffer[256];
+
+ int8_t d8(INT8_MAX), i8(INT8_MIN), o8(INT8_MAX);
+ uint8_t u8(UINT8_MAX), x8(UINT8_MAX), X8(UINT8_MAX);
+ sprintf(buffer, "%" PRId8 " %" PRIi8 " %" PRIo8 " %" PRIu8 " %" PRIx8 " %" PRIX8, d8, i8, o8, u8, x8, X8);
+
+ #ifdef EA_COMPILER_GNUC
+ if(Stricmp(buffer, "127 -128 177 255 ff FF"))
+ DoError(nErrorCount, "PRI8 test"); // This is known to fail with compilers such as VC++ which don't support %hh.
+ #endif
+
+ int16_t d16(INT16_MAX), i16(INT16_MIN), o16(INT16_MAX);
+ uint16_t u16(UINT16_MAX), x16(UINT16_MAX), X16(UINT16_MAX);
+ sprintf(buffer, "%" PRId16 " %" PRIi16 " %" PRIo16 " %" PRIu16 " %" PRIx16 " %" PRIX16, d16, i16, o16, u16, x16, X16);
+ if(Stricmp(buffer, "32767 -32768 77777 65535 ffff FFFF"))
+ DoError(nErrorCount, "PRI16 test");
+
+ int32_t d32(INT32_MAX), i32(INT32_MIN), o32(INT32_MAX);
+ uint32_t u32(UINT32_MAX), x32(UINT32_MAX), X32(UINT32_MAX);
+ sprintf(buffer, "%" PRId32 " %" PRIi32 " %" PRIo32 " %" PRIu32 " %" PRIx32 " %" PRIX32, d32, i32, o32, u32, x32, X32);
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 4294967295 ffffffff FFFFFFFF"))
+ DoError(nErrorCount, "PRI32 test");
+
+ int64_t d64(INT64_MAX), i64(INT64_MIN), o64(INT64_MAX);
+ uint64_t u64(UINT64_MAX), x64(UINT64_MAX), X64(UINT64_MAX);
+ sprintf(buffer, "%" PRId64 " %" PRIi64 " %" PRIo64 " %" PRIu64 " %" PRIx64 " %" PRIX64, d64, i64, o64, u64, x64, X64);
+ if(Stricmp(buffer, "9223372036854775807 -9223372036854775808 777777777777777777777 18446744073709551615 ffffffffffffffff FFFFFFFFFFFFFFFF"))
+ DoError(nErrorCount, "PRI64 test");
+
+ // Many compilers give warnings for the following code because they
+ // recognize that a pointer is being formatted as an integer.
+ // This is what we want to do and what the C99 standard intends here.
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ #pragma warning(disable: 4313) // Warning C4313: 'sprintf' : '%d' in format string conflicts with argument 1 of type 'void *'
+ #pragma warning(disable: 4777) // Warning C4777: 'sprintf' : format string '%lld' requires an argument of type '__int64', but variadic argument 1 has type 'intptr_t'
+ #endif
+
+ #if !defined(__GNUC__) // GCC generates warnings here which we can't work around.
+ void *dPtr = (void*)INT32_MAX, *iPtr = (void*)INT32_MIN, *oPtr = (void*)INT32_MAX, *uPtr = (void*)(uintptr_t)UINT64_MAX, *xPtr = (void*)(uintptr_t)UINT64_MAX, *XPtr = (void*)(uintptr_t)UINT64_MAX;
+ sprintf(buffer, "%" PRIdPTR " %" PRIiPTR " %" PRIoPTR " %" PRIuPTR " %" PRIxPTR " %" PRIXPTR, (intptr_t)dPtr, (intptr_t)iPtr, (uintptr_t)oPtr, (uintptr_t)uPtr, (uintptr_t)xPtr, (uintptr_t)XPtr);
+
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 4294967295 ffffffff FFFFFFFF"))
+ DoError(nErrorCount, "PRIPTR test");
+ #else // EA_PLATFORM_PTR_SIZE == 8
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 18446744073709551615 ffffffffffffffff FFFFFFFFFFFFFFFF"))
+ DoError(nErrorCount, "PRIPTR test");
+ #endif
+ #endif
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ #pragma warning(default: 4313)
+ #pragma warning(default: 4777)
+ #endif
+ }
+
+ //Test sized scanf format specifiers
+ {
+ int numMatched = 0;
+ #ifdef EA_COMPILER_IS_C99 // Enabled for C99 only because this code will simply crash on many platforms if the format specifiers aren't supported.
+ int8_t d8, i8, o8;
+ uint8_t u8, x8;
+ numMatched = sscanf("127 -127 177 255 ff", "%" SCNd8 " %" SCNi8 " %" SCNo8 " %" SCNu8 " %" SCNx8, &d8, &i8, &o8, &u8, &x8);
+ if((numMatched != 5) || (d8 != 127) || (i8 != -127) || (o8 != 127) || (u8 != 255) || (x8 != 255))
+ DoError(nErrorCount, "SCN8 test"); // This is known to fail with compilers such as VC++ which don't support %hh.
+ #endif
+
+ int16_t d16, i16, o16;
+ uint16_t u16, x16;
+ numMatched = sscanf("32767 -32768 77777 65535 ffff", "%" SCNd16 " %" SCNi16 " %" SCNo16 " %" SCNu16 " %" SCNx16, &d16, &i16, &o16, &u16, &x16);
+ if((numMatched != 5) || (d16 != 32767) || (i16 != -32768) || (o16 != 32767) || (u16 != 65535) || (x16 != 65535))
+ DoError(nErrorCount, "SCN16 test");
+
+ int32_t d32, i32, o32;
+ uint32_t u32, x32;
+ numMatched = sscanf("2147483647 -2147483648 17777777777 4294967295 ffffffff", "%" SCNd32 " %" SCNi32 " %" SCNo32 " %" SCNu32 " %" SCNx32, &d32, &i32, &o32, &u32, &x32);
+ if((numMatched != 5) || (d32 != INT32_MAX) || (i32 != INT32_MIN) || (o32 != INT32_MAX) || (u32 != UINT32_MAX) || (x32 != UINT32_MAX))
+ DoError(nErrorCount, "SCN32 test");
+
+ int64_t d64, i64, o64;
+ uint64_t u64, x64;
+ numMatched = sscanf("9223372036854775807 -9223372036854775808 777777777777777777777 18446744073709551615 ffffffffffffffff", "%" SCNd64 " %" SCNi64 " %" SCNo64 " %" SCNu64 " %" SCNx64, &d64, &i64, &o64, &u64, &x64);
+ if((numMatched != 5) || (d64 != INT64_MAX) || (i64 != INT64_MIN) || (o64 != INT64_MAX) || (u64 != UINT64_MAX) || (x64 != UINT64_MAX))
+ DoError(nErrorCount, "SCN64 test");
+
+ // Many compilers give warnings for the following code because they
+ // recognize that a pointer is being formatted as an integer.
+ // This is what we want to do and what the C99 standard intends here.
+ #if !defined(__GNUC__) // GCC generates warnings here which we can't work around.
+ void *dPtr, *iPtr, *oPtr, *uPtr, *xPtr;
+ intptr_t dip, iip;
+ uintptr_t ouip, uuip, xuip;
+
+ EA_DISABLE_VC_WARNING(4777) // format string '%lld' requires an argument of type '__int64 *', but variadic argument 1 has type 'intptr_t *'
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ numMatched = sscanf("2147483647 -2147483648 17777777777 4294967295 ffffffff", "%" SCNdPTR " %" SCNiPTR " %" SCNoPTR " %" SCNuPTR " %" SCNxPTR, &dip, &iip, &ouip, &uuip, &xuip);
+ #else // EA_PLATFORM_PTR_SIZE == 8
+ numMatched = sscanf("2147483647 -2147483648 17777777777 18446744073709551615 ffffffffffffffff", "%" SCNdPTR " %" SCNiPTR " %" SCNoPTR " %" SCNuPTR " %" SCNxPTR, &dip, &iip, &ouip, &uuip, &xuip);
+ #endif
+ EA_RESTORE_VC_WARNING()
+
+ dPtr = (void*)dip;
+ iPtr = (void*)iip;
+ oPtr = (void*)ouip;
+ uPtr = (void*)uuip;
+ xPtr = (void*)xuip;
+
+ if((numMatched != 5) || (dPtr != (void*)INT32_MAX) || (iPtr != (void*)INT32_MIN) || (oPtr != (void*)INT32_MAX) || (uPtr != (void*)(uintptr_t)UINT64_MAX) || (xPtr != (void*)(uintptr_t)UINT64_MAX))
+ DoError(nErrorCount, "SCNPTR test");
+ #endif
+ }
+
+
+ // Test min/max
+ {
+ // The C standard allows INT8_MIN to be either -127 or -128. So in order to be able
+ // to test for this in a portable way, we do the logic below whereby we test for
+ // -127 (which all compiles should support) or -127 - 1 which all compilers should
+ // support if INT8_MIN isn't -127.
+ if(!VerifyValue<int8_t>(INT8_MIN, INT8_C(-127)) && !VerifyValue<int8_t>(INT8_MIN, INT8_C(-127) - 1))
+ DoError(nErrorCount, "INT8_MIN test");
+ if(!VerifyValue<int8_t>(INT8_MAX, INT8_C(127)))
+ DoError(nErrorCount, "INT8_MAX test");
+ if(!VerifyValue<uint8_t>(UINT8_MAX, UINT8_C(255)))
+ DoError(nErrorCount, "UINT8_MAX test");
+
+ if(!VerifyValue<int16_t>(INT16_MIN, INT16_C(-32767)) && !VerifyValue<int16_t>(INT16_MIN, INT16_C(-32767) - 1))
+ DoError(nErrorCount, "INT16_MIN test");
+ if(!VerifyValue<int16_t>(INT16_MAX, INT16_C(32767)))
+ DoError(nErrorCount, "INT16_MAX test");
+ if(!VerifyValue<uint16_t>(UINT16_MAX, UINT16_C(65535)))
+ DoError(nErrorCount, "UINT16_MAX test");
+
+ if(!VerifyValue<int32_t>(INT32_MIN, INT32_C(-2147483647)) && !VerifyValue<int32_t>(INT32_MIN, INT32_C(-2147483647) - 1))
+ DoError(nErrorCount, "INT32_MIN test");
+ if(!VerifyValue<int32_t>(INT32_MAX, INT32_C(2147483647)))
+ DoError(nErrorCount, "INT32_MAX test");
+ if(!VerifyValue<uint32_t>(UINT32_MAX, UINT32_C(4294967295)))
+ DoError(nErrorCount, "UINT32_MAX test");
+
+ if(!VerifyValue<int64_t>(INT64_MIN, INT64_C(-9223372036854775807)) && !VerifyValue<int64_t>(INT64_MIN, INT64_C(-9223372036854775807) - 1))
+ DoError(nErrorCount, "INT64_MIN test");
+ if(!VerifyValue<uint64_t>(INT64_MAX, INT64_C(9223372036854775807)))
+ DoError(nErrorCount, "INT64_MAX test");
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const uint64_t temp = 18446744073709551615ULL;
+ #else
+ const uint64_t temp = UINT64_C(18446744073709551615);
+ #endif
+
+ if(!VerifyValue<uint64_t>(UINT64_MAX, temp))
+ DoError(nErrorCount, "UINT64_MAX test");
+ }
+
+ {
+ NoopTakingString(L"");
+ // Compilation errors below indicate that the EA_CHAR16/EA_CHAR32 may be incorrectly defined, or EA_CHAR16_NATIVE/EA_CHAR32_NATIVE is incorrect set to 0.
+ #if EA_WCHAR_SIZE == 2 && defined(EA_CHAR16)
+ const char16_t *str = EA_CHAR16("");
+ NoopTakingString(str);
+ #elif EA_WCHAR_SIZE == 4 && defined(EA_CHAR32)
+ const char32_t *str = EA_CHAR32("");
+ NoopTakingString(str);
+ #endif
+ }
+
+ return nErrorCount;
+}
+
+
+
+int TestEAResult()
+{
+ int nErrorCount(0);
+
+ EA::result_type resultSuccess(EA::SUCCESS);
+ EA::result_type resultFailure(EA::FAILURE);
+ EA::result_type resultZero(0); // success
+ EA::result_type resultNeg(-1); // failure
+ EA::result_type resultPos(+1); // success
+
+
+ if(!EA_SUCCEEDED(resultSuccess))
+ DoError(nErrorCount, "EA::SUCCESS test");
+ if(EA_FAILED(resultSuccess))
+ DoError(nErrorCount, "EA::SUCCESS test");
+
+ if(EA_SUCCEEDED(resultFailure))
+ DoError(nErrorCount, "EA::FAILURE test");
+ if(!EA_FAILED(resultFailure))
+ DoError(nErrorCount, "EA::FAILURE test");
+
+ if(!EA_SUCCEEDED(resultZero))
+ DoError(nErrorCount, "EA::SUCCESS test");
+ if(EA_FAILED(resultZero))
+ DoError(nErrorCount, "EA::SUCCESS test");
+
+ if(EA_SUCCEEDED(resultNeg))
+ DoError(nErrorCount, "EA::FAILURE test");
+ if(!EA_FAILED(resultNeg))
+ DoError(nErrorCount, "EA::FAILURE test");
+
+ if(!EA_SUCCEEDED(resultPos))
+ DoError(nErrorCount, "EA::SUCCESS test");
+ if(EA_FAILED(resultPos))
+ DoError(nErrorCount, "EA::SUCCESS test");
+
+ return nErrorCount;
+}
+
+
+
+int TestEAPlatform()
+{
+ int nErrorCount(0);
+
+ // Test EA_PLATFORM_PTR_SIZE
+ {
+ #ifdef EA_PLATFORM_PTR_SIZE
+ if(!VerifyValue<size_t>(EA_PLATFORM_PTR_SIZE, sizeof(void*)))
+ DoError(nErrorCount, "EA_PLATFORM_PTR_SIZE test");
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_PTR_SIZE test");
+ #endif
+ }
+
+
+ // Test EA_PLATFORM_NAME
+ {
+ #ifdef EA_PLATFORM_NAME
+ char buffer[256];
+ sprintf(buffer, "TestEAPlatform: EA_PLATFORM_NAME: %s\n", EA_PLATFORM_NAME);
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_NAME test");
+ #endif
+ }
+
+
+ // Test EA_PLATFORM_DESCRIPTION
+ {
+ #ifdef EA_PLATFORM_DESCRIPTION
+ char buffer[256];
+ sprintf(buffer, "TestEAPlatform: EA_PLATFORM_DESCRIPTION: %s\n", EA_PLATFORM_DESCRIPTION);
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_DESCRIPTION test");
+ #endif
+ }
+
+
+ // Test EA_SYSTEM_LITTLE_ENDIAN / EA_SYSTEM_BIG_ENDIAN
+ {
+ uint32_t kValue = 0x12345678;
+ uint8_t* pValue = (uint8_t*)&kValue;
+
+ #ifdef EA_SYSTEM_LITTLE_ENDIAN
+ if(pValue[0] != 0x78)
+ DoError(nErrorCount, "EA_SYSTEM_ENDIAN test");
+ #elif defined(EA_SYSTEM_BIG_ENDIAN)
+ if(pValue[0] != 0x12)
+ DoError(nErrorCount, "EA_SYSTEM_ENDIAN test");
+ #else
+ DoError(nErrorCount, "EA_SYSTEM_ENDIAN test");
+ #endif
+ }
+
+
+ // Test EA_ASM_STYLE
+ {
+ #if defined(EA_PROCESSOR_X86)
+ #if defined(EA_ASM_STYLE_ATT)
+ asm volatile ("nop");
+ #elif defined(EA_ASM_STYLE_INTEL)
+ __asm nop
+ #endif
+ #else
+ // Add other processors here.
+ #endif
+ }
+
+
+ return nErrorCount;
+}
+
+
+
+// Test compiler limitations
+// Easiest way to come up with tests for some of the more complicated versions
+// of these is to look at the Boost /libs/config/test/*.cxx files. Many of the
+// Boost compiler limitation defines are similar or match exactly to those
+// defined by EABase. See http://www.boost.org if you want to check this out.
+
+#ifndef EA_COMPILER_NO_STATIC_CONSTANTS // If class member static constants are allowed...
+ struct NSC
+ {
+ static const int x = 10;
+ };
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATES
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_TEMPLATES
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_VOID_RETURNS
+ void TestNVR1();
+ void TestNVR();
+
+ void TestNVR1()
+ {
+ char buffer[8];
+ sprintf(buffer, " ");
+ }
+ void TestNVR()
+ {
+ return TestNVR1();
+ }
+#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_DEDUCED_TYPENAME
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP
+ // Todo
+#endif
+
+#if !defined(EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE) && !defined(EA_COMPILER_NO_STANDARD_CPP_LIBRARY)
+ #include <exception>
+
+ static void TestNESN()
+ {
+ // iPhone gives us this error: Undefined symbols for architecture armv6: std::terminate()
+ // Android gives: undefined reference to std::terminate()
+ // We could possibly define our own std::terminate, but that might collide in the future unexpectedly.
+ #if defined(EA_PLATFORM_IPHONE) || defined(EA_PLATFORM_ANDROID)
+ void (*pTerminate)() = NULL;
+ #else
+ void (*pTerminate)() = std::terminate;
+ #endif
+ char buffer[32];
+ sprintf(buffer, "%p", pTerminate);
+ }
+#endif
+
+#ifndef EA_COMPILER_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_EXCEPTIONS
+ static bool TestNE()
+ {
+ EA_DISABLE_VC_WARNING(4571)
+ try{
+ char buffer1[8];
+ sprintf(buffer1, " ");
+ throw int(0);
+ }
+ catch(...){
+ char buffer2[8];
+ sprintf(buffer2, " "); // If you are tracing this in a debugger and the debugger stops here, then you need to let the app continue.
+ }
+ return true;
+ EA_RESTORE_VC_WARNING()
+ }
+#endif
+
+
+struct UnwindTest
+{
+ static int x;
+ enum State{
+ kStateNone,
+ kStateConstructed,
+ kStateDestructed
+ };
+ UnwindTest()
+ { x = kStateConstructed; };
+ ~UnwindTest()
+ { x = kStateDestructed; };
+};
+int UnwindTest::x = kStateNone;
+
+#ifndef EA_COMPILER_NO_EXCEPTIONS
+ static void TestNU1()
+ {
+ UnwindTest ut;
+ #ifndef EA_COMPILER_NO_EXCEPTIONS
+ throw(int(0)); // If you are tracing this in a debugger and the debugger stops here, then you need to let the app continue.
+ #endif
+ }
+#endif
+
+bool TestNU()
+{
+ bool bReturnValue(false);
+
+ #ifdef EA_COMPILER_NO_EXCEPTIONS
+ bReturnValue = true; //Nothing to test, so we just return true.
+ #else
+ EA_DISABLE_VC_WARNING(4571)
+ try
+ {
+ TestNU1();
+ }
+ catch(...)
+ {
+ #ifdef EA_COMPILER_NO_UNWIND
+ if(UnwindTest::x == UnwindTest::kStateConstructed)
+ bReturnValue = true;
+ #else
+ if(UnwindTest::x == UnwindTest::kStateDestructed)
+ bReturnValue = true;
+ #endif
+ }
+ EA_RESTORE_VC_WARNING()
+ #endif
+
+ return bReturnValue;
+}
+
+#ifndef EA_COMPILER_NO_STANDARD_CPP_LIBRARY
+ #include <vector> // We need do nothing more than #include this.
+#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+
+#if !defined(EA_COMPILER_NO_TRAILING_RETURN_TYPES)
+ // This usage assumes that C++11 auto is supported, which in practice is always the case because
+ // the case because otherwise trailing return types wouldn't be as useful.
+ static auto AddOne(int i)->int
+ {
+ return i + 1;
+ }
+
+ template <typename T>
+ struct AddTwoClass
+ {
+ typedef float Local_type;
+ Local_type AddTwo(T t);
+ };
+
+ template <typename T>
+ auto AddTwoClass<T>::AddTwo(T t)->Local_type
+ {
+ return (t + 2.f); // Assumes that t is a numerical type in this case.
+ }
+#endif
+
+
+#if !defined(EA_COMPILER_NO_VARIADIC_TEMPLATES)
+ template<typename...>
+ struct VariadicTemplateTuple{};
+
+ template<typename T1, typename T2>
+ struct VariadicTemplatePair
+ {
+ T1 x;
+ T1 y;
+ };
+
+ template<class ... Args1>
+ struct VariadicTemplateZip
+ {
+ template<class ... Args2> struct with
+ {
+ typedef VariadicTemplateTuple<VariadicTemplatePair<Args1, Args2> ... > type;
+ };
+ };
+
+ // VariadicTemplateType is Tuple<Pair<short, unsigned short>, Pair<int, unsigned> >
+ typedef VariadicTemplateZip<short, int>::with<unsigned short, unsigned>::type VariadicTemplateType;
+#endif
+
+
+#if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
+ template<typename T>
+ using VectorAlias = eastl::vector<T, EASTLAllocatorType>;
+#endif
+
+#if !defined(EA_COMPILER_NO_VARIABLE_TEMPLATES)
+ template<class T>
+ constexpr T pi = T(3.1415926535897932385);
+#endif
+
+
+int TestEACompiler()
+{
+ int nErrorCount(0);
+
+ // As of this writing, eacompiler.h defines at least the following compilers:
+ // EA_COMPILER_GNUC
+ // EA_COMPILER_INTEL
+ // EA_COMPILER_METROWERKS
+ // EA_COMPILER_MSVC, EA_COMPILER_MSVC6, EA_COMPILER_MSVC7, EA_COMPILER_MSVC7_1
+
+
+ // Test EA_COMPILER_NAME
+ {
+ #ifdef EA_COMPILER_NAME
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_NAME: %s\n", EA_COMPILER_NAME);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_NAME test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_VERSION
+ {
+ #ifdef EA_COMPILER_VERSION
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_VERSION: %d\n", EA_COMPILER_VERSION);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_VERSION test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_STRING
+ {
+ #ifdef EA_COMPILER_STRING
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_STRING: %s\n", EA_COMPILER_STRING);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_STRING test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_NO_STATIC_CONSTANTS
+ {
+ char buffer[256];
+ sprintf(buffer, "%d", (int)NSC::x);
+ if(buffer[0] != '1')
+ DoError(nErrorCount, "EA_COMPILER_NO_STATIC_CONSTANTS test");
+ }
+
+
+ // Test EA_COMPILER_NO_VOID_RETURNS
+ #ifndef EA_COMPILER_NO_VOID_RETURNS
+ TestNVR1(); // Nothing to test for except successful compilation.
+ #endif
+
+
+ // Test EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE
+ #if !defined(EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE) && !defined(EA_COMPILER_NO_STANDARD_CPP_LIBRARY)
+ TestNESN();
+ #endif
+
+ #if !(defined(EA_PLATFORM_IPHONE) && defined(EA_COMPILER_CLANG)) || defined(__IPHONE_7_0)
+ {
+ // There was a bug in Apple's exception code in iOS SDK versions
+ // prior to 7.0, which is why this test is disabled for versions
+ // of the SDK before 7.0.
+ // Note that __IPHONE_7_0 will be defined for all future SDKs as
+ // well, because Apple simply adds another define with each release
+ // and does not remove the old ones.
+
+ // Test EA_COMPILER_NO_EXCEPTIONS
+ #ifndef EA_COMPILER_NO_EXCEPTIONS
+ if(!TestNE())
+ DoError(nErrorCount, "EA_COMPILER_NO_EXCEPTIONS test");
+ #endif
+
+
+ // Test EA_COMPILER_NO_UNWIND
+ if(!TestNU())
+ DoError(nErrorCount, "EA_COMPILER_NO_UNWIND test");
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_RVALUE_REFERENCES
+ #ifndef EA_COMPILER_NO_RVALUE_REFERENCES
+ {
+ // Trivial test
+ int&& i = 2;
+ FunctionWithUnusedVariables(i);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_RANGE_BASED_FOR_LOOP
+ #if !defined(EA_COMPILER_NO_RANGE_BASED_FOR_LOOP)
+ {
+ float floatArray[2] = { 0.0f, 1.0f };
+
+ for(float& f : floatArray)
+ f += 1.0;
+
+ EATEST_VERIFY(floatArray[1] == 2.0f);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_AUTO
+ #if !defined(EA_COMPILER_NO_AUTO)
+ {
+ auto length = strlen("test");
+ EATEST_VERIFY(length == 4);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_DECLTYPE
+ #if !defined(EA_COMPILER_NO_DECLTYPE)
+ {
+ struct A { double x; };
+ int b = 9;
+ A a; a.x = 7;
+ decltype(b) x2 = 2;
+ decltype(a.x) x3 = 3.5;
+ EATEST_VERIFY((b + a.x) == 16);
+ EATEST_VERIFY((x3 + x2) == 5.5);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_LAMBDA_EXPRESSIONS
+ #if !defined(EA_COMPILER_NO_LAMBDA_EXPRESSIONS)
+ {
+ struct LambaTest
+ {
+ static void SortViaAbs(float* x, size_t n)
+ {
+ eastl::insertion_sort(x, x + n,
+ [](float a, float b)
+ { return (a < b); }
+ );
+ }
+ };
+
+ float floatArray[3] = { 0.f, 1.f, 3.f };
+ LambaTest::SortViaAbs(floatArray, EAArrayCount(floatArray));
+ EATEST_VERIFY(floatArray[1] == 1.f);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_TRAILING_RETURN_TYPES
+ #if !defined(EA_COMPILER_NO_TRAILING_RETURN_TYPES)
+ {
+ int x = AddOne(2); // AddOne declared above.
+ EATEST_VERIFY(x == 3);
+
+ AddTwoClass<float> a;
+ float y = a.AddTwo(2.f);
+ EATEST_VERIFY(y == 4.f);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_FORWARD_DECLARED_ENUMS
+ // Forward declared enum support requires strongly typed enum support.
+ #if !defined(EA_COMPILER_NO_FORWARD_DECLARED_ENUMS) && !defined(EA_COMPILER_NO_STRONGLY_TYPED_ENUMS)
+ {
+ // This happen to be used below in the EA_COMPILER_NO_STRONGLY_TYPED_ENUMS section.
+ enum class Color;
+ enum class Size : uint8_t;
+ enum Distance: uint8_t;
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_STRONGLY_TYPED_ENUMS
+ #if !defined(EA_COMPILER_NO_STRONGLY_TYPED_ENUMS)
+ {
+ enum class Color { red, blue, green };
+ enum class Size : uint8_t { little = 1, med = 1, large = 2 };
+ enum Distance : uint8_t { close = 1, faraway = 2 };
+
+ Color c = Color::red;
+ EATEST_VERIFY(c != Color::blue);
+
+ Size s = Size::med;
+ EATEST_VERIFY(s != Size::large);
+ static_assert(sizeof(s) == 1, "EA_COMPILER_NO_STRONGLY_TYPED_ENUMS failure");
+
+ Distance d = close;
+ EATEST_VERIFY(d != faraway);
+ static_assert(sizeof(d) == 1, "EA_COMPILER_NO_STRONGLY_TYPED_ENUMS failure");
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_VARIADIC_TEMPLATES
+ #if !defined(EA_COMPILER_NO_VARIADIC_TEMPLATES)
+ {
+ // This uses types defined above.
+ VariadicTemplateType x;
+
+ static_assert(sizeof(x) > 0, "EA_COMPILER_NO_VARIADIC_TEMPLATES failure");
+
+ char buffer[32];
+ sprintf(buffer, "%p", &x);
+ // Ignore the result, as we're just verifying that it compiles.
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_TEMPLATE_ALIASES
+ #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
+ {
+ // This uses types defined above.
+ // Same as vector<int, EASTLAllocatorType> v;
+ VectorAlias<int> v;
+ EATEST_VERIFY(v.empty());
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_VARIABLE_TEMPLATES
+ #if !defined(EA_COMPILER_NO_VARIABLE_TEMPLATES)
+ static_assert(pi<int> == 3, "variable template failure");
+ static_assert(pi<intmax_t> == 3, "variable template failure");
+ static_assert(pi<double> == 3.1415926535897932385, "variable template failure");
+ #endif
+
+
+ // Test EA_COMPILER_NO_INITIALIZER_LISTS
+ #if !defined(EA_COMPILER_NO_INITIALIZER_LISTS)
+ {
+ int a = { 1 };
+ EATEST_VERIFY(a == 1);
+
+ int* e{};
+ EATEST_VERIFY(!e);
+
+ double x = double{1};
+ EATEST_VERIFY(x == 1.0);
+
+ //Disabled until we have a compiler and standard library that can exercise this.
+ //#include <initializer_list>
+ //eastl::vector<eastl::string, int> anim = { {"bear", 4}, {"cassowary", 2}, {"tiger", 7} };
+ //EATEST_VERIFY(!anim.empty());
+
+ // Other tests to do.
+ //std::complex<double> z{1,2};
+ //eastl::vector<int>{1, 2, 3, 4};
+ //f({"Nicholas","Annemarie"});
+ //return { "Norah" };
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_NORETURN / EA_NORETURN
+ #if !defined(EA_COMPILER_NO_NORETURN) && !defined(EA_PLATFORM_PS4) // Kettle SDK up to at least v.915 has a broken definition of the exit() function and fails to compile the valid code below.
+ {
+ struct NoReturnTest
+ {
+ EA_NORETURN void DoesNotReturn()
+ { exit(0); }
+
+ int DoesReturn()
+ { return 17; }
+ };
+
+ NoReturnTest nrt;
+ if(nrt.DoesReturn() == 18)
+ nrt.DoesNotReturn();
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_CARRIES_DEPENDENCY / EA_CARRIES_DEPENDENCY
+ #if !defined(EA_COMPILER_NO_CARRIES_DEPENDENCY)
+ {
+ struct CarriesDependencyTest
+ {
+ CarriesDependencyTest() : mX(0){}
+
+ EA_CARRIES_DEPENDENCY int* Test1(){ return &mX; }
+ void Test2(int* f EA_CARRIES_DEPENDENCY) { char buffer[32]; sprintf(buffer, "%p", f); }
+
+ int mX;
+ };
+
+ CarriesDependencyTest cdt;
+ cdt.Test2(cdt.Test1());
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_FALLTHROUGH / EA_FALLTHROUGH
+ #if !defined(EA_COMPILER_NO_FALLTHROUGH)
+ {
+ int i = 1;
+ switch (i)
+ {
+ case 1:
+ i++;
+
+ EA_FALLTHROUGH;
+ case 2: { i = 42; }
+ break;
+ }
+
+ EATEST_VERIFY(i == 42);
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_NODISCARD / EA_NODISCARD
+ #if !defined(EA_COMPILER_NO_NODISCARD)
+ {
+ struct EA_NODISCARD DoNotDiscardMe {};
+ auto result = [](void) -> DoNotDiscardMe { return {}; }();
+ (void)result; // use the result to avoid [[nodiscard]] compiler warnings
+ }
+ #endif
+
+
+ // Test EA_COMPILER_NO_MAYBE_UNUSED / EA_MAYBE_UNUSED
+ #if !defined(EA_COMPILER_NO_MAYBE_UNUSED)
+ {
+ {
+ EA_MAYBE_UNUSED int notAlwaysUsed = 42;
+
+ // Do not use expressions below. It defeats the purpose of the test.
+ // (void)notAlwaysUsed;
+ // EA_UNUSED(notAlwaysUsed);
+ }
+
+ {
+ [](EA_MAYBE_UNUSED bool b1, EA_MAYBE_UNUSED bool b2) { EA_ASSERT(b1 && b2); }(true, true);
+ }
+ }
+ #endif
+
+ #if !defined(EA_COMPILER_NO_NONSTATIC_MEMBER_INITIALIZERS)
+ {
+ struct NonstaticInitializerTest
+ {
+ int a = 7;
+ int b = a;
+ };
+
+ NonstaticInitializerTest nit;
+ EATEST_VERIFY((nit.a == 7) && (nit.b == 7));
+ }
+ #endif
+
+ #if !defined(EA_COMPILER_NO_RIGHT_ANGLE_BRACKETS)
+ {
+ eastl::vector<eastl::vector<int>> listList;
+ EA_UNUSED(listList);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_ALIGNOF)
+ {
+ char buffer[32];
+ sprintf(buffer, "%u", (unsigned)alignof(uint64_t));
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_ALIGNAS)
+ {
+ struct alignas(32) AlignAsTest1
+ { float mData[4]; };
+
+ struct alignas(uint64_t) AlignAsTest2
+ { float mData[4]; };
+
+ char buffer[32];
+ sprintf(buffer, "%u %u", (unsigned)EA_ALIGN_OF(AlignAsTest1), (unsigned)EA_ALIGN_OF(AlignAsTest2));
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_DELEGATING_CONSTRUCTORS)
+ {
+ struct DCTest
+ {
+ char mChar;
+ double mDouble;
+
+ DCTest() : mChar('\0'), mDouble(1.23){ };
+ DCTest(double d, char c): mChar(c), mDouble(d) { }
+ DCTest(char c) : DCTest(1.23, c) { }
+ DCTest(double d): DCTest(d, 'a') { }
+ DCTest(char*): DCTest() { }
+ };
+
+ DCTest dcTest(1.5);
+ EATEST_VERIFY(dcTest.mDouble == 1.5);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_INHERITING_CONSTRUCTORS)
+ {
+ struct B1{
+ B1(int x) : mX(x){}
+ int mX;
+ };
+
+ struct B2{
+ B2(int x = 13, int y = 42) : mX(x), mY(y){}
+ int mX, mY;
+ };
+
+ struct D1 : B1 {
+ using B1::B1;
+ };
+
+ struct D2 : B2 {
+ using B2::B2;
+ };
+
+ D1 d1(3);
+ D2 d2a(17, 22);
+ D2 d2b;
+
+ EATEST_VERIFY((d1.mX == 3) &&
+ (d2a.mX == 17) && (d2a.mY == 22) &&
+ (d2b.mX == 13) && (d2b.mY == 42));
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_USER_DEFINED_LITERALS)
+ {
+ // The operators are defined above.
+
+ // Conversion example
+ double x = 90.0_deg; // x = 1.570796
+ EATEST_VERIFY((x > 1.57) && (x < 1.58));
+
+ // Custom type example
+ UDLTest y(123_udl);
+ EATEST_VERIFY(y.mX == 123);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_STANDARD_LAYOUT_TYPES)
+ {
+ // We don't currently have a good way of testing this without bringing in <type_traits>.
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_EXTENDED_SIZEOF)
+ {
+ struct SizeofTest{
+ int32_t mMember;
+ };
+
+ const size_t testSize = sizeof(SizeofTest::mMember);
+ EATEST_VERIFY(testSize == sizeof(int32_t));
+ char buffer[32];
+ sprintf(buffer, "%u", (unsigned)testSize);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_INLINE_NAMESPACES)
+ {
+ // The namespaces are defined above.
+
+ INSNamespace::A<INSClass> a;
+ int result = g(a);
+ EATEST_VERIFY(result == 37);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_UNRESTRICTED_UNIONS)
+ {
+ struct Point {
+ int mX, mY;
+
+ Point(int x = 0, int y = 0) : mX(x), mY(y) {}
+ };
+
+ union U {
+ int z;
+ double w;
+ Point p; // Illegal in C++03; legal in C++11.
+
+ U() { new(&p) Point(); } // Due to the Point member, a constructor definition is now required.
+ };
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_EXPLICIT_CONVERSION_OPERATORS)
+ {
+ // bool cast test
+ struct Testable
+ {
+ explicit operator bool() const
+ { return false; }
+
+ Testable() : mX(37) { }
+ int mX;
+ };
+
+ Testable a;
+
+ if(a)
+ EATEST_VERIFY(a.mX == 37);
+
+ // Class cast test
+ struct Y {
+ int mY;
+ Y(int y = 0) : mY(y) { }
+ };
+
+ struct Z {
+ int mZ;
+ Z(int z = 0) : mZ(z) { }
+ explicit operator Y() const { return Y(mZ); }
+ };
+
+ Z z(3);
+ Y y1(z); // Direct initialization
+ Y y2 = (Y)z; // Cast notation
+
+ EATEST_VERIFY((z.mZ == 3) && (y1.mY == 3) && (y2.mY == 3));
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
+ {
+ // FunctionTemplateTest is declared above.
+ int result = FunctionTemplateTest::AddOne((int)3);
+ EATEST_VERIFY(result == 4);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS)
+ {
+ struct LocalStruct{};
+ eastl::fixed_vector<LocalStruct, 2, false> localStructArray;
+ EATEST_VERIFY(localStructArray.empty());
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_NOEXCEPT)
+ {
+ EATEST_VERIFY(NoExceptTestFunction() == 37);
+ EATEST_VERIFY(NoExceptTestTemplate<NoExceptTestStruct>() == 37);
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_RAW_LITERALS)
+ {
+ // Older versions of GCC are preventing us from using " below in str1. Due to the way the preprocessor
+ // works, it encounters what it sees as a string problem before it handles the #if above. No #ifdefs
+ // can make this problem go away.
+ const char str1[] = R"(This slash is just a slash: \ This quote is just a quote: ' )";
+ const char str2[] = R"delimiter(This slash is just a slash: \ This paren is just a paren: ) )delimiter";
+ EA_UNUSED(str1);
+ EA_UNUSED(str2);
+
+ static_assert(EAArrayCount(str1) == 61, "EA_COMPILER_NO_RAW_LITERALS failure.");
+ static_assert(EAArrayCount(str2) == 61, "EA_COMPILER_NO_RAW_LITERALS failure.");
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_UNICODE_STRING_LITERALS)
+ {
+ const char8_t str1[] = u8"Unicode: \u2018."; // This assumes that \u and \U are supported by the compiler.
+ const char16_t str2[] = u"Unicode: \U00002018.";
+ const char32_t str3[] = U"Unicode: \U00022018.";
+
+ static_assert(EAArrayCount(str1) == 14, "EA_COMPILER_NO_UNICODE_STRING_LITERALS failure.");
+ static_assert(EAArrayCount(str2) == 12, "EA_COMPILER_NO_UNICODE_STRING_LITERALS failure.");
+ static_assert(EAArrayCount(str3) == 12, "EA_COMPILER_NO_UNICODE_STRING_LITERALS failure.");
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS)
+ {
+ const char8_t str1[] = "\u2018\u2019";
+ static_assert(EAArrayCount(str1) == 7, "EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS failure.");
+
+ #if (EA_WCHAR_SIZE >= 2)
+ const wchar_t str2[] = L"\U00002018\U00002019";
+ static_assert(EAArrayCount(str2) == 3, "EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS failure."); // This test assumes that wchar_t is a 16bit or greater value.
+ #endif
+
+ #if defined(EA_CHAR16_NATIVE) && EA_CHAR16_NATIVE
+ const char16_t str3[] = u"\U00002018\U00002019";
+ static_assert(EAArrayCount(str3) == 3, "EA_COMPILER_NO_UNICODE_CHAR_NAME_LITERALS failure.");
+ #endif
+ }
+ #endif
+
+ #ifndef EA_COMPILER_NO_RVALUE_REFERENCES
+ {
+ const int MAX_ARR_SIZE = 4096;
+ struct StructWithArray { int arr[MAX_ARR_SIZE]; };
+ static_assert(EAArrayCount(StructWithArray().arr) == MAX_ARR_SIZE, "");
+ }
+ #endif
+
+ #if !defined(EA_COMPILER_NO_UNIFIED_INITIALIZATION_SYNTAX)
+ {
+ struct InitTest1
+ {
+ int mX;
+ double mY;
+ };
+
+ struct InitTest2
+ {
+ InitTest2(int x, double y) : mX{x}, mY{y} {}
+
+ int mX;
+ double mY;
+ };
+
+ InitTest1 var1{5, 3.2};
+ InitTest2 var2{2, 4.3};
+
+ EATEST_VERIFY(var1.mY == 3.2);
+ EATEST_VERIFY(var2.mY == 4.3);
+ }
+ #endif
+
+ #if !defined(EA_COMPILER_NO_EXTENDED_FRIEND_DECLARATIONS)
+ {
+ class G;
+
+ class X1 {
+ friend G;
+ };
+ }
+ #endif
+
+
+ #if !defined(EA_COMPILER_NO_THREAD_LOCAL)
+ {
+ // We don't yet test this because we don't have a sufficient compiler to test it with.
+ }
+ #endif
+
+ return nErrorCount;
+}
+
+
+#if defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1900 // VS2015+
+ EA_DISABLE_VC_WARNING(5029); // nonstandard extension used: alignment attributes in C++ apply to variables, data members and tag types only
+#endif
+int TestEACompilerTraits()
+{
+ int nErrorCount(0);
+
+ // EA_COMPILER_IS_ANSIC
+ // EA_COMPILER_IS_C99
+ // EA_COMPILER_IS_CPLUSPLUS
+ // EA_COMPILER_MANAGED_CPP
+
+ {
+ // EA_COMPILER_INTMAX_SIZE
+
+ #if (EA_COMPILER_INTMAX_SIZE == 16)
+ /* To do: Test this when we get a machine that supports it (e.g. Linux64)/
+ #if defined(__GNUC__)
+ #define int128_t __int128_t
+ #define uint128_t __uint128_t
+ #endif
+
+ int128_t x = UINT128_C(0x12345678123456781234567812345678);
+ uint128_t y = (x * 2);
+
+ if(x == (int128_t)y)
+ DoError(nErrorCount, "EA_COMPILER_INTMAX_SIZE test");
+ */
+
+ #elif (EA_COMPILER_INTMAX_SIZE == 8)
+ int64_t x = UINT64_C(0x1234567812345678);
+ uint64_t y = (x * 2);
+
+ if(x == (int64_t)y)
+ DoError(nErrorCount, "EA_COMPILER_INTMAX_SIZE test");
+
+ #elif (EA_COMPILER_INTMAX_SIZE == 32)
+ int32_t x = UINT64_C(0x12345678);
+ uint32_t y = (x * 2);
+
+ if(x == (int32_t)y)
+ DoError(nErrorCount, "EA_COMPILER_INTMAX_SIZE test");
+
+ #else
+ int16_t x = UINT16_C(0x1234);
+ uint16_t y = (x * 2);
+
+ if(x == (int16_t)y)
+ DoError(nErrorCount, "EA_COMPILER_INTMAX_SIZE test");
+ #endif
+ }
+
+ {
+ // EA_OFFSETOF
+ const size_t o = EA_OFFSETOF(OffsetofTestClass, mY);
+ EA_DISABLE_VC_WARNING(6326)
+ if(o != 4)
+ DoError(nErrorCount, "EA_OFFSETOF test");
+ EA_RESTORE_VC_WARNING()
+ }
+
+ {
+ // EA_SIZEOF_MEMBER
+ const size_t s = EA_SIZEOF_MEMBER(SizeofMemberTestClass, mY);
+ EA_DISABLE_VC_WARNING(6326)
+ if(s != 4)
+ DoError(nErrorCount, "EA_SIZEOF_MEMBER test");
+ EA_RESTORE_VC_WARNING()
+
+ // There have been problems on some platforms (SNC version < 405) where extended sizeof was not properly
+ // supported when used within a member function, so we test for that here.
+
+ class TestClass
+ {
+ public:
+ void TestExtendedSizeof(int& nErrorCount)
+ {
+ EA_DISABLE_VC_WARNING(6326)
+ const size_t sizeOfmY = EA_SIZEOF_MEMBER(SizeofMemberTestClass, mY);
+ if(sizeOfmY != 4)
+ DoError(nErrorCount, "EA_SIZEOF_MEMBER test: within member function");
+ EA_RESTORE_VC_WARNING()
+ }
+ }tc;
+
+ tc.TestExtendedSizeof(nErrorCount);
+ }
+
+ { // EA_ALIGN_OF, EA_PREFIX_ALIGN, etc.
+ size_t a = EA_ALIGN_OF(int);
+ EA_PREFIX_ALIGN(4) int b = 5;
+ EA_ALIGN(8) int c;
+ int d EA_POSTFIX_ALIGN(8);
+ int e EA_POSTFIX_ALIGN(8) = 5;
+ int f EA_POSTFIX_ALIGN(8)(5);
+ struct EA_ALIGN(8) G { int x; };
+ struct EA_PREFIX_ALIGN(8) GG { int x; } EA_POSTFIX_ALIGN(8);
+ EA_ALIGNED(int, h, 8) = 5;
+ EA_ALIGNED(int, i, ALIGNMENT_AMOUNT_16)(5);
+ EA_ALIGNED(int, j[3], ALIGNMENT_AMOUNT_16);
+ 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) // 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()
+
+ //int N[3] EA_PACKED; // Some compilers (e.g. GCC) don't support this or ignore this and generate a warning.
+ struct P { int x EA_PACKED; int y EA_PACKED; };
+ struct Q { int x; int y; } EA_PACKED;
+ typedef EA_ALIGNED(int, r, ALIGNMENT_AMOUNT_16);
+ r rInstance;
+ typedef EA_ALIGNED(Q, X16, ALIGNMENT_AMOUNT_16);
+ X16 x16Instance;
+
+ char buffer[256];
+ sprintf(buffer, "%p %p %p %p %p %p %p %p %p %p %p %p %p", &a, &b, &c, &d, &e, &f, &h, &i, &j, &k, &m, &rInstance, &x16Instance);
+ }
+
+ { // Test EA_ALIGN_OF
+ if(EA_ALIGN_OF(int8_t) != sizeof(int8_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int16_t)");
+
+ if(EA_ALIGN_OF(int16_t) != sizeof(int16_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int16_t)");
+
+ if(EA_ALIGN_OF(int32_t) != sizeof(int32_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int32_t)");
+
+ #if !defined(EA_ABI_ARM_APPLE)
+ if(EA_ALIGN_OF(int64_t) != sizeof(int64_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int64_t)");
+ #endif
+
+ typedef void (*AlignTestFunctionType)();
+ if(EA_ALIGN_OF(AlignTestFunctionType) != sizeof(void*)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (AlignTestFunctionType)");
+ }
+
+ { // Test EA_ALIGN
+ #ifdef EA_ALIGN
+ char buffer[32];
+
+ EA_ALIGN(ALIGNMENT_AMOUNT_64) int x(0);
+ sprintf(buffer, "%d", x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_ALIGN test 1");
+ if((intptr_t)&x & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGN test 2");
+
+ EA_ALIGN(ALIGNMENT_AMOUNT_64) ClassWithDefaultCtor cdcA;
+ //EA_ALIGN(64) ClassWithoutDefaultCtor cwdcA;
+ if((intptr_t)&cdcA & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGN test 3");
+
+ EA_ALIGN(ALIGNMENT_AMOUNT_64) ClassWithDefaultCtor cdcB(3);
+ if((intptr_t)&cdcB & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGN test 4");
+
+ EA_ALIGN(ALIGNMENT_AMOUNT_64) ClassWithoutDefaultCtor cwdcB(3);
+ if((intptr_t)&cwdcB & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGN test 5");
+ #else
+ DoError(nErrorCount, "EA_ALIGN test 6");
+ #endif
+ }
+
+ { // Test EA_PREFIX_ALIGN
+ #ifdef EA_PREFIX_ALIGN
+ char buffer[32];
+ EA_PREFIX_ALIGN(ALIGNMENT_AMOUNT_64) int x(0);
+ sprintf(buffer, "%d", x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_PREFIX_ALIGN test 1");
+
+ EA_PREFIX_ALIGN(64) ClassWithDefaultCtor cdcA;
+ //EA_PREFIX_ALIGN(64) ClassWithoutDefaultCtor cwdcA;
+
+ EA_PREFIX_ALIGN(64) ClassWithDefaultCtor cdcB(3);
+ EA_PREFIX_ALIGN(64) ClassWithoutDefaultCtor cwdcB(3);
+ #else
+ DoError(nErrorCount, "EA_PREFIX_ALIGN test 2");
+ #endif
+ }
+
+
+ { // Test EA_POSTFIX_ALIGN
+ #ifdef EA_POSTFIX_ALIGN
+ char buffer[32];
+ int x EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64) = 0;
+ sprintf(buffer, "%d", x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_POSTFIX_ALIGN test 1");
+
+ ClassWithDefaultCtor cdcA EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64);
+ //ClassWithoutDefaultCtor cwdcA EA_POSTFIX_ALIGN(64);
+
+ 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
+ }
+
+
+ { // Test EA_ALIGNED
+ #ifdef EA_ALIGNED
+ char buffer[64];
+
+ // Verify that a simple declaration works.
+ EA_ALIGNED(int, xA, ALIGNMENT_AMOUNT_64); xA = 0;
+ sprintf(buffer, "%d", xA);
+ if((intptr_t)&xA & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGNED test 1");
+
+ // Verify that a declaration with assignment works.
+ EA_ALIGNED(int, xB, ALIGNMENT_AMOUNT_64) = 0;
+ sprintf(buffer, "%d", xB);
+ if((intptr_t)&xB & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGNED test 2");
+
+ // Verify that a declaration with construction works.
+ EA_ALIGNED(int, xC, ALIGNMENT_AMOUNT_64)(0);
+ sprintf(buffer, "%d", xC);
+ if((intptr_t)&xC & (ALIGNMENT_AMOUNT_64 -1))
+ DoError(nErrorCount, "EA_ALIGNED test 3");
+
+ // Verify that a typedefd declaration works.
+ typedef EA_ALIGNED(int, int16, ALIGNMENT_AMOUNT_16);
+ int16 n16 = 0;
+ sprintf(buffer, "%p", &n16);
+ if((intptr_t)&n16 & (ALIGNMENT_AMOUNT_16 - 1))
+ DoError(nErrorCount, "EA_ALIGNED test 4");
+
+ // Verify that the following tests compile. These tests are here
+ // because the SN compiler (EDG front-end) has some problems with
+ // GCC compatibility related to the 'aligned' __attribute__.
+ ClassWithDefaultCtor cdc;
+ ClassWithoutDefaultCtor cwdc(3);
+ sprintf(buffer, "%p%p", &cdc, &cwdc);
+
+ // Verify that regular usage of EA_ALIGNED works.
+ EA_ALIGNED(ClassWithDefaultCtor, cdc16A, ALIGNMENT_AMOUNT_16);
+ //EA_ALIGNED(ClassWithoutDefaultCtor, cwdcA, 16); // Doesn't have a default ctor, so this can't be done.
+ sprintf(buffer, "%p%p", &cdc16A, (void*)NULL);
+
+ // Verify that argument usage of EA_ALIGNED works.
+ EA_ALIGNED(ClassWithDefaultCtor, cdcB, ALIGNMENT_AMOUNT_16)(3);
+ EA_ALIGNED(ClassWithoutDefaultCtor, cwdcB, ALIGNMENT_AMOUNT_16)(3);
+ sprintf(buffer, "%p%p", &cdcB, &cwdcB);
+
+ // Verify that usage of EA_ALIGNED works within a typedef.
+ typedef EA_ALIGNED(ClassWithDefaultCtor, ClassWithDefaultCtor16, ALIGNMENT_AMOUNT_16);
+ ClassWithDefaultCtor16 cdcC(3);
+ typedef EA_ALIGNED(ClassWithoutDefaultCtor, ClassWithoutDefaultCtor16, ALIGNMENT_AMOUNT_16);
+ ClassWithoutDefaultCtor16 cwdcC(3);
+ sprintf(buffer, "%p%p", &cdcC, &cwdcC);
+ #else
+ DoError(nErrorCount, "EA_ALIGNED test");
+ #endif
+ }
+
+
+ { // Test EA_NO_INLINE / EA_PREFIX_NO_INLINE / EA_POSTFIX_NO_INLINE
+ DoNothingInline();
+ DoNothingPrefixInline();
+ }
+
+
+ { // Test EA_FORCE_INLINE / EA_PREFIX_FORCE_INLINE / EA_POSTFIX_FORCE_INLINE
+ DoNothingForceInline();
+ DoNothingPrefixForceInline();
+ }
+
+ { // Test EA_FORCE_INLINE_LAMBDA
+ auto testLambda = []() EA_FORCE_INLINE_LAMBDA
+ {
+ };
+ testLambda();
+ }
+
+
+ { // Test EA_PACKED
+ #ifdef EA_PACKED
+ char buffer[32];
+ struct X { int x; } EA_PACKED;
+ X x = { 0 };
+ sprintf(buffer, "%d", x.x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_PACKED test");
+ #else
+ DoError(nErrorCount, "EA_PACKED test");
+ #endif
+ }
+
+
+ { // Test EA_LIKELY
+
+ if(EA_UNLIKELY(nErrorCount > 0))
+ {
+ if(EA_LIKELY(nErrorCount == 999999)) // Actually this isn't likely, but that's beside the point.
+ DoError(nErrorCount, "EA_LIKELY test");
+ }
+ }
+
+
+ { // Test EA_INIT_PRIORITY
+
+ // 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.
+ if(gInitPriorityTestClass0.mX != 0)
+ DoError(nErrorCount, "EA_INIT_PRIORITY test.");
+
+ 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.");
+ }
+
+
+ { // Test EA_MAY_ALIAS
+ // 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.
+ if(gPtr0 != NULL)
+ DoError(nErrorCount, "EA_MAY_ALIAS test.");
+
+ if(gPtr1 != NULL)
+ DoError(nErrorCount, "EA_MAY_ALIAS test.");
+ }
+
+
+ { // Test EA_ASSUME
+ switch (nErrorCount / (nErrorCount + 1))
+ {
+ case 0:
+ Stricmp("nop0", "nop0");
+ break;
+ case 1:
+ Stricmp("nop1", "nop1");
+ break;
+ default:
+ EA_ASSUME(0);
+ }
+ }
+
+
+ { // Test EA_PURE
+ if(!PureFunction())
+ DoError(nErrorCount, "EA_PURE test");
+ }
+
+
+ { // EA_WEAK
+ if(gWeakVariable != 1)
+ DoError(nErrorCount, "EA_WEAK test");
+ }
+
+
+ { // Test EA_NO_VTABLE
+ NoVTable1 nvt1;
+ NoVTable2 nvt2;
+ nvt1.InterfaceFunction();
+ nvt2.InterfaceFunction();
+ }
+
+ { // Test EA_WCHAR_SIZE
+ EA_DISABLE_VC_WARNING(6326)
+ #ifdef EA_WCHAR_SIZE
+ if((EA_WCHAR_SIZE != 1) && (EA_WCHAR_SIZE != 2) && (EA_WCHAR_SIZE != 4))
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #else
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #endif
+ EA_RESTORE_VC_WARNING()
+ }
+
+
+ { // Test EA_RESTRICT
+ struct TestRestrict{
+ static size_t Test(char* EA_RESTRICT p){ return sizeof(p); }
+ };
+ char* p = NULL;
+ if(TestRestrict::Test(p) == 0) // This isn't a real test. If there is a failure, it will happen at compile time.
+ DoError(nErrorCount, "EA_RESTRICT test");
+ }
+
+
+ { // Test EA_DEPRECATED
+ /* This causes warnings on compilers, so just disable it.
+ #if defined(EA_DEPRECATED) && (!defined(__GNUC__) || ((__GNUC__ * 100 + __GNUC_MINOR__) < 402)) // GCC 4.2+ is converting deprecated into an error instead of a warning.
+ char buffer[32];
+ EA_DEPRECATED int x(0);
+ sprintf(buffer, "%d", x); (void)x;
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_DEPRECATED test");
+ #elif !defined (EA_DEPRECATED)
+ DoError(nErrorCount, "EA_DEPRECATED test");
+ #endif
+ */
+ }
+
+
+ { // Test EA_PASCAL
+ #ifdef EA_PASCAL
+ struct X{ void EA_PASCAL DoNothing(){} };
+ X x;
+ x.DoNothing();
+ #else
+ DoError(nErrorCount, "EA_PASCAL test");
+ #endif
+ }
+
+
+ { // Test EA_PASCAL_FUNC
+ #ifdef EA_PASCAL_FUNC
+ struct X{ void EA_PASCAL_FUNC(DoNothing()){} };
+ X x;
+ x.DoNothing();
+ #else
+ DoError(nErrorCount, "EA_PASCAL_FUNC test");
+ #endif
+ }
+
+
+ // EA_SSE
+ // Not sure how to properly test at this time.
+
+ { // EA_FP16C
+ #if EA_FP16C
+ // For this test just try to call an intrinsic that is only
+ // available when FP16C is available. The test can make sure the
+ // platform actually supports FP16C when it claims to support it,
+ // but it can't verify a platform doesn't support FP16C.
+ _mm_cvtph_ps(_mm_set1_epi32(42));
+ #endif
+ }
+
+ { // EA_IMPORT
+ // Not possible to do this because import means it will come from outside.
+ //struct X{ EA_IMPORT void DoNothing(){} };
+ //X x;
+ //x.DoNothing();
+ }
+
+
+ { // EA_EXPORT
+ struct X{ EA_EXPORT void DoNothing(){} };
+ X x;
+ x.DoNothing();
+ }
+
+
+ // EA_PREPROCESSOR_JOIN
+ // EA_STRINGIFY
+ {
+ char buffer[32];
+ char bufferExpected[32];
+ const int line = (__LINE__ + 2);
+
+ sprintf(buffer, "%s %s", EA_STRINGIFY(EA_PREPROCESSOR_JOIN(test_, __LINE__)), EA_STRINGIFY(__LINE__));
+ sprintf(bufferExpected, "test_%d %d", line, line);
+
+ if(strcmp(buffer, bufferExpected) != 0)
+ DoError(nErrorCount, "EA_PREPROCESSOR_JOIN/EA_STRINGIFY test");
+ }
+
+
+ { // EAArrayCount
+ const int testArray[13] = { 0 };
+ const size_t arrayCount = EAArrayCount(testArray);
+
+ EA_DISABLE_VC_WARNING(6326)
+ if((arrayCount != 13) || (testArray[0] != 0))
+ DoError(nErrorCount, "EAArrayCount test");
+ EA_RESTORE_VC_WARNING()
+
+ const float testArray2[EAArrayCount(testArray)] = {};
+ static_assert(EAArrayCount(testArray2) == EAArrayCount(testArray), "Array counts should be equivalent.");
+ static_assert(EAArrayCount(testArray2) == 13, "Float array should have 13 elements.");
+
+ EA_DISABLE_VC_WARNING(6326)
+ if (EAArrayCount(testArray2) != EAArrayCount(testArray))
+ DoError(nErrorCount, "EAArrayCount - Array counts should be equivalent.");
+ EA_RESTORE_VC_WARNING()
+
+ EA_DISABLE_VC_WARNING(6326)
+ if (EAArrayCount(testArray2) != 13)
+ DoError(nErrorCount, "EAArrayCount - Float array should have 13 elements.");
+ EA_UNUSED(testArray2);
+ EA_RESTORE_VC_WARNING()
+
+ // Regresssion of user bug report that static_assert<member array> fails with some C++11 compilers.
+ // We revised the templated definition of EAArrayCount to deal with the failure.
+ struct Example
+ {
+ int32_t mItems[7];
+ Example()
+ { static_assert(EAArrayCount(mItems) == 7, "invalid size"); memset(mItems, 0x77, sizeof(mItems)); } // This was failing with the original templated version of EAArrayCount.
+ };
+
+ Example example;
+ EATEST_VERIFY(example.mItems[0] == 0x77777777);
+ }
+
+ { // static_assert
+
+ // Should succeed.
+ static_assert(sizeof(int32_t) == 4, "static_assert failure");
+
+ // Should fail.
+ //static_assert(sizeof(int32_t) == 8, "static_assert failure");
+ }
+
+ { // EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+ int result = DisabledOptimizations(2);
+
+ if(result != 2*37)
+ DoError(nErrorCount, "EA_OPTIMIZE_OFF test");
+ }
+
+ { // EA_UNUSED
+ FunctionWithUnusedVariables(3);
+ }
+
+ { // EA_EXTERN_TEMPLATE
+
+ eabase_template<char> x;
+ x.value = 0;
+ if(x.GetValue() != 0)
+ DoError(nErrorCount, "EA_EXTERN_TEMPLATE test");
+ }
+
+ { // EA_FUNCTION_DELETE
+ EA_FUNCTION_DELETE_Test test(17);
+ EATEST_VERIFY(test.x == 17);
+ }
+
+ { // EA_NON_COPYABLE / EANonCopyable
+ NonCopyableA ncA1;
+ ncA1.x = 1;
+ //NonCopyableA ncA2(ncA1); // Both of these lines should result in
+ //ncA1 = ncA1; // compiler errors if enabled.
+ EA_UNUSED(ncA1);
+
+ NonCopyableB ncB1;
+ ncB1.x = 1;
+ //NonCopyableB ncB2(ncB1); // Both of these lines should result in
+ //ncB1 = ncB1; // compiler errors if enabled.
+ EA_UNUSED(ncB1);
+
+ NonCopyableSubclass ncs1(3);
+ //NonCopyableSubclass ncs2(ncs1); // Both of these lines should result in
+ //ncs2 = ncs2; // compiler errors if enabled.
+ EATEST_VERIFY(ncs1.mX == 3);
+
+ struct NonCopyableLocal
+ {
+ NonCopyableLocal(){}
+ int x;
+
+ EA_NON_COPYABLE(NonCopyableLocal)
+ };
+ NonCopyableLocal ncLocal1;
+ ncLocal1.x = 1;
+ //NonCopyableLocal ncLocal2(ncLocal1); // Both of these lines should result in
+ //ncLocal1 = ncLocal1; // compiler errors if enabled.
+ EA_UNUSED(ncLocal1);
+ }
+
+ return nErrorCount;
+}
+#if defined(EA_COMPILER_MSVC) && EA_COMPILER_VERSION >= 1900 // VS2015+
+ EA_RESTORE_VC_WARNING();
+#endif
+
+
+/////////////////////////////////////////////////
+// nullptr test
+/////////////////////////////////////////////////
+
+#if !defined(EA_HAVE_nullptr_IMPL)
+ #define EA_RTTI_ENABLED 0 // This is something that ideally would be defined in EABase.
+
+
+ int mfCCount = 0;
+ struct C
+ {
+ void mf()
+ {
+ mfCCount++;
+ }
+ };
+
+
+ int fDoubleCount = 0;
+ static void f(double*)
+ {
+ fDoubleCount++;
+ }
+
+
+ int fIntCount = 0;
+ static void f(int)
+ {
+ fIntCount++;
+ }
+
+
+ int gTCount = 0;
+ template<typename T>
+ void g(T*)
+ {
+ gTCount++;
+ }
+
+ int hTCount = 0;
+ template<typename T>
+ void h(T)
+ {
+ hTCount++;
+ }
+#endif
+
+
+static int TestNullPtr()
+{
+ int nErrorCount(0);
+
+ #if defined(EA_HAVE_nullptr_IMPL) // If the compiler provides a native version...
+ // Don't question it. VC++ nullptr -seems- to be not entirely conforming anyway.
+ #else
+ using namespace std;
+
+ // DoError("TestNullptr\n");
+ void* pv = nullptr; // OK
+ EATEST_VERIFY(pv == 0);
+ EATEST_VERIFY(pv == nullptr);
+ #ifndef __MWERKS__ // Currently the Metrowerks compiler crashes on this code.
+ EATEST_VERIFY(nullptr == pv);
+ #endif
+
+ pv = &pv; // OK
+ EATEST_VERIFY(pv != 0);
+ #if !defined(__GNUC__) || (__GNUC__ > 3)
+ EATEST_VERIFY(pv != nullptr);
+ #endif
+
+ const char* pc = nullptr; // OK
+ EATEST_VERIFY(pc == 0);
+ EATEST_VERIFY(pc == nullptr);
+ #ifndef __MWERKS__
+ EATEST_VERIFY(nullptr == pc);
+ #endif
+
+ C* pC = nullptr; // OK
+ EATEST_VERIFY(pC == 0);
+ EATEST_VERIFY(pC == nullptr);
+ #ifndef __MWERKS__
+ EATEST_VERIFY(nullptr == pC);
+ #endif
+
+ f(nullptr); // OK. Calls f(double*).
+ EATEST_VERIFY(fDoubleCount == 1);
+
+ f(0); // OK. Calls f(int)
+ EATEST_VERIFY(fIntCount == 1);
+
+ //g(nullptr); // Not OK. Can't deduce T
+
+ h(0); // OK. Deduces T = int
+ EATEST_VERIFY(hTCount == 1);
+
+ h(nullptr); // OK. Deduces T = nullptr_t
+ EATEST_VERIFY(hTCount == 2);
+
+ h((float*)nullptr); // OK. Deduces T = float*
+ EATEST_VERIFY(hTCount == 3);
+
+ void (C::*pmf)() = 0; // OK
+ EATEST_VERIFY(pmf == 0);
+
+ #if !defined(__GNUC__) || (__GNUC__ > 3)
+ void (C::*pmf2)() = nullptr; // OK
+ EA_UNUSED(pmf2);
+ #ifndef __MWERKS__ // CodeWarrior is not following the C++ Standard properly.
+ EATEST_VERIFY(pmf2 == 0);
+ EATEST_VERIFY(pmf2 == nullptr);
+ EATEST_VERIFY(nullptr == pmf2);
+ #endif
+ #endif
+
+ #if !defined(__GNUC__) || (__GNUC__ > 3)
+ void (C::*pmf3)() = &C::mf;
+ #ifndef __MWERKS__
+ EATEST_VERIFY(pmf3 != nullptr);
+ #endif
+ #endif
+
+ nullptr_t n1 = nullptr, n2 = nullptr; // OK
+ n1 = n2; // OK
+ h(n1);
+
+ //const int const0 = 0;
+ //if(const0 == nullptr) {} // Not OK.
+
+ //int n = 0;
+ //if(n == nullptr) {} // Not OK.
+
+ //nullptr_t* pN = &n1; // Not OK. Address can't be taken.
+
+ EATEST_VERIFY(!nullptr); // Supposedly OK, but VC++ doesn't accept it.
+ if(nullptr) // Supposedly OK, but VC++ doesn't accept it.
+ EATEST_VERIFY(false);
+
+ int val = 0;
+ char* ch3 = val ? nullptr : nullptr; // OK.
+ EATEST_VERIFY(ch3 == 0);
+
+ //char* ch4 = val ? 0 : nullptr; // Not OK. Types are not compatible.
+ //int n3 = val ? nullptr : nullptr; // Not OK. nullptr can't be converted to int.
+ //int n4 = val ? 0 : nullptr; // Not OK. Types are not compatible.
+
+ // void* p = 0;
+ // reinterpret_cast<nullptr>(p); // Not OK. But all compilers allow this. A reinterpret_cast cannot be used to convert a value of any type to the type std::nullptr_t.
+
+ //This is supposed to succeed, but we can't make it so, given the conflicting requirements of the C++ and nullptr standards.
+ //EATEST_VERIFY(sizeof(nullptr) == sizeof(void*)); // I don't currently have a means to make this work. See the class for why.
+
+ #ifndef __MWERKS__
+ nullptr_t n3 = nullptr, n4 = nullptr;
+ EATEST_VERIFY(n3 == n4);
+ EATEST_VERIFY(!(n3 != n4));
+ EATEST_VERIFY(n3 <= n4);
+ EATEST_VERIFY(n3 >= n4);
+ EATEST_VERIFY(!(n3 < n4));
+ EATEST_VERIFY(!(n3 > n4));
+ #endif
+
+
+ #if EA_RTTI_ENABLED
+ typeid(nullptr); // OK
+ #endif
+
+ #ifndef EA_COMPILER_NO_EXCEPTIONS
+ try{
+ pv = 0;
+ throw nullptr; // OK
+ }
+ catch(nullptr_t n)
+ {
+ EATEST_VERIFY(n == pv); // OK
+ h(n);
+ }
+ #endif
+ #endif // EA_HAVE_nullptr_IMPL
+
+ return nErrorCount;
+}
+
+
+static int TestEAHave()
+{
+ int nErrorCount(0);
+
+ // EA_HAVE_XXX_DECL
+ //
+ // We don't have a simple way to test these, as they indicate the presence of
+ // declarations and not necessarily the presence of implementations.
+ //
+ // EA_HAVE_mkstemps_DECL
+ // EA_HAVE_gettimeofday_DECL
+ // EA_HAVE_strcasecmp_DECL
+ // EA_HAVE_strncasecmp_DECL
+ // EA_HAVE_mmap_DECL
+ // EA_HAVE_fopen_DECL
+ // EA_HAVE_ISNAN(x)
+ // EA_HAVE_ISINF(x)
+ // EA_HAVE_itoa_DECL
+ // EA_HAVE_nanosleep_DECL
+ // EA_HAVE_utime_DECL
+ // EA_HAVE_ftruncate_DECL
+ // EA_HAVE_localtime_DECL
+ // EA_HAVE_pthread_getattr_np_DECL
+
+ #if defined(EA_HAVE_ISNAN)
+ EATEST_VERIFY(EA_HAVE_ISNAN(1.f) == 0);
+ #endif
+ #if defined(EA_HAVE_ISINF)
+ EATEST_VERIFY(EA_HAVE_ISINF(1.f) == 0);
+ #endif
+
+
+ // EA_HAVE_XXX_IMPL
+
+ #if defined(EA_HAVE_WCHAR_IMPL)
+ size_t wlen = wcslen(L"test");
+ EATEST_VERIFY(wlen == 4); // Expect success.
+ #endif
+
+ #if defined(EA_HAVE_getenv_IMPL)
+ char* p = getenv("nonexistent_asdf");
+ EATEST_VERIFY(!p); // Expect failure.
+ #endif
+
+ #if defined(EA_HAVE_setenv_IMPL)
+ // http://pubs.opengroup.org/onlinepubs/009695399/functions/setenv.html
+ // int setenv(const char *envname, const char *envval, int overwrite);
+ setenv("test_asdf", "value", 0); // We ignore the return value, as we can't tell if the platform allows it.
+ #endif
+
+ #if defined(EA_HAVE_unsetenv_IMPL)
+ unsetenv("test_asdf"); // Ignore the return value.
+ #endif
+
+ #if defined(EA_HAVE_putenv_IMPL)
+ // int putenv(char* string);
+ char str[] = "a=b";
+ #if defined(EA_PLATFORM_MICROSOFT) && defined(EA_COMPILER_MICROSOFT)
+ // Microsoft uses _putenv, while others use putenv.
+ int putenvSuccess = _putenv(str);
+ #else
+ int putenvSuccess = putenv(str);
+ #endif
+ EATEST_VERIFY(putenvSuccess == 0);
+ #endif
+
+ #if defined(EA_HAVE_time_IMPL)
+ time_t timeResult = time(NULL);
+ EATEST_VERIFY(timeResult != 0); // Expect success.
+ #endif
+
+ #if defined(EA_HAVE_clock_IMPL)
+ // http://www.cplusplus.com/reference/ctime/clock/
+ clock_t clockResult = clock();
+ EATEST_VERIFY(clockResult != (clock_t) -1); // Expect success.
+ #endif
+
+ #if defined(EA_HAVE_fopen_IMPL)
+ // We don't have a portable way of testing the success of this, as different platforms have different file systems and requirements.
+ // since we want this to fail, we will use a normal Windows path as some platforms /require/ a windows-like mount path else they call abort()
+ FILE* pFile = fopen("Q:\\nonexistent_pleasedontexist", "r");
+ EATEST_VERIFY(pFile == NULL); // Expect failure.
+ if(pFile)
+ fclose(pFile);
+ #endif
+
+ #if defined(EA_HAVE_inet_ntop_IMPL)
+ char inetResult[32];
+ const char* pInetNtopResult = inet_ntop(0, "", inetResult, (uint16_t)EAArrayCount(inetResult)); // Cast to uint16_t because different libraries declare this arg differently, and this is a lowest common denominator.
+ EATEST_VERIFY(pInetNtopResult == NULL); // Expect failure.
+ #endif
+
+ #if defined(EA_HAVE_inet_pton_IMPL)
+ char inetPtonResult[32];
+ int inetResultVal = inet_pton(0, "", inetPtonResult);
+ EATEST_VERIFY(inetResultVal <= 0); // Expect failure.
+ #endif
+
+ #if defined(EA_HAVE_clock_gettime_IMPL)
+ struct timespec tp;
+ int clockGettimeResult = clock_gettime(CLOCK_MONOTONIC, &tp);
+ EATEST_VERIFY(clockGettimeResult <= 0); // Expect success or error.
+ #endif
+
+ #if defined(EA_HAVE_getcwd_IMPL)
+ {
+ char cwdBuffer[1];
+ char *result = getcwd(cwdBuffer, EAArrayCount(cwdBuffer));
+ EA_UNUSED(result);
+ }
+ #endif
+
+ #if defined(EA_HAVE_tmpnam_IMPL)
+ {
+ char tmpnamBuffer[L_tmpnam];
+ char *result = tmpnam(tmpnamBuffer);
+ EA_UNUSED(result);
+ }
+ #endif
+
+ #if defined(EA_HAVE_nullptr_IMPL)
+ // This is exercised elsewhere in this test.
+ #endif
+
+ #if defined(EA_HAVE_std_terminate_IMPL)
+ if(nErrorCount == INT_MIN) // This is impossible.
+ std::terminate();
+ #endif
+
+ #if defined(EA_HAVE_CPP11_ITERATOR_IMPL)
+ // <iterator>: std::begin, std::end, std::prev, std::next, std::move_iterator.
+ #if defined(EA_HAVE_CPP11_INITIALIZER_LIST)
+ eastl::vector<int> intArray;
+ EATEST_VERIFY(std::begin(intArray) == std::end(intArray));
+ #endif
+
+ char charArray[16] = { 0 };
+ EATEST_VERIFY(std::begin(charArray) != std::end(charArray));
+ #endif
+
+ #if defined(EA_HAVE_CPP11_SMART_POINTER_IMPL)
+ // std::weak_ptr, std::shared_ptr, std::unique_ptr, std::bad_weak_ptr
+ std::shared_ptr<int> spInt;
+ std::weak_ptr<int> wpInt;
+ std::unique_ptr<int> upInt;
+ //std::bad_weak_ptr<int> bwpInt;
+ #endif
+
+ #if defined(EA_HAVE_CPP11_FUNCTIONAL_IMPL) && !defined(EA_PLATFORM_ANDROID) // Our Android build system is failing to link _1, _2, etc.
+ // function, mem_fn, bad_function_call, is_bind_expression, is_placeholder, reference_wrapper, hash, bind, ref, cref.
+ // It turns out that all compiler/library combinations that support this also support C++11 auto, so we can use it.
+
+ #if !defined(EA_PLATFORM_ANDROID) // Our Android build system is failing to link _1, _2, etc.
+ using namespace std::placeholders; //for _1, _2, _3...
+
+ int n = 7;
+ auto f = std::bind(BindTestFunction, _2, _1, 42, std::cref(n), n);
+ f(1, 2, 1001); // 1 is bound by _2, 2 is bound by _1, 1001 is unused
+
+ BindTestStruct bts;
+ auto f2 = std::bind(&BindTestStruct::Test, bts, 95, _1);
+ f2(5);
+ #endif
+
+ std::hash<uint32_t> hash32;
+ EATEST_VERIFY(hash32(37) == hash32(37));
+ #endif
+
+ #if defined(EA_HAVE_CPP11_EXCEPTION_IMPL)
+ // current_exception, rethrow_exception, exception_ptr, make_exception_ptr
+ #if !defined(EA_COMPILER_NO_EXCEPTIONS)
+ EA_DISABLE_VC_WARNING(4571)
+
+ if(nErrorCount == 9999999) // This will never be true.
+ {
+ std::exception_ptr ep = std::make_exception_ptr(std::logic_error("logic_error"));
+
+ try {
+ std::rethrow_exception(ep);
+ }
+ catch (...) {
+ ep = std::current_exception();
+ std::rethrow_exception(ep);
+ }
+ }
+ EA_RESTORE_VC_WARNING()
+ #endif
+ #endif
+
+ #if defined(EA_HAVE_CPP11_TYPE_TRAITS)
+ // Some form of type traits have been supported by compilers since well before C++11. But C++11 introduced
+ // a number of type traits that weren't previously supported by compilers. We require that full C++11 type
+ // traits be supported. See the C++11 Standard, section 20.9.2.
+
+ // We currently test a sampling of specific traits that didn't exist in preliminary standard library versions.
+ bool ttResult = std::is_nothrow_move_constructible<int>::value;
+ EATEST_VERIFY(ttResult);
+
+ ttResult = std::is_standard_layout<int>::value;
+ EATEST_VERIFY(ttResult);
+ #endif
+
+ return nErrorCount;
+}
+
+
+static int TestEAAlignment()
+{
+ // This test does a couple of allocations and for each allocation it determines
+ // the minimal alignment. If this (local) minimum is less than the global minimum
+ // then the global minimum is updated. After all the allocation sizes and iterations
+ // it checks this minimum to make sure that the EABase EA_PLATFORM_MIN_MALLOC_ALIGNMENT
+ // is at least that number, since you would never want to ask for finer grained
+ // allocations as malloc can't give them.
+
+ int nErrorCount(0);
+
+ const size_t MAX_SIZE = 128;
+ const size_t NUM_ITERATIONS = 32;
+
+ size_t minAlignment = MAX_SIZE;
+
+ for(size_t size = 1; size <= MAX_SIZE; ++size)
+ {
+
+ for(size_t iteration = 0; iteration < NUM_ITERATIONS; ++iteration)
+ {
+ void* ptr = malloc(size);
+ size_t address = static_cast<size_t>(reinterpret_cast<uintptr_t>(ptr));
+
+ size_t alignment = MAX_SIZE;
+
+ do
+ {
+ if((address & (alignment - 1)) == 0)
+ {
+ break;
+ }
+ else
+ {
+ alignment >>= 1;
+ }
+
+ } while(alignment > 0);
+
+ if(alignment < minAlignment)
+ minAlignment = alignment;
+
+ free(ptr);
+ }
+ }
+
+ EATEST_VERIFY_F(EA_PLATFORM_MIN_MALLOC_ALIGNMENT <= minAlignment,
+ "'EA_PLATFORM_MIN_MALLOC_ALIGNMENT=%d' <= 'minAlignment=%d' failure on '%s'",
+ EA_PLATFORM_MIN_MALLOC_ALIGNMENT, minAlignment, EA_PLATFORM_DESCRIPTION);
+
+ return nErrorCount;
+}
+
+
+
+
+#include <EABase/eastdarg.h>
+#include <EAStdC/EASprintf.h>
+#include <EAStdC/EAString.h>
+
+
+static void TestEAStdargReferenceHelp(char* p, va_list_reference args)
+{
+ EA::StdC::Sprintf(p, "%d", va_arg(args, int));
+}
+
+static void TestEAStdargReference(char* p1, char* p2, ...) // Must be called with two ints for ...
+{
+ va_list args;
+ va_start(args, p2);
+ TestEAStdargReferenceHelp(p1, args); // We pass args to TestEAStdargReferenceHelp by reference, which results in args being
+ TestEAStdargReferenceHelp(p2, args); // modified upon return. So upon this second call args should have used the first int arg.
+ va_end(args);
+}
+
+
+static void TestEAStdargCopy(char* p1, char* p2, ...) // Must be called with two ints for ...
+{
+ va_list args, argsCopy;
+ va_start(args, p2);
+ va_copy(argsCopy, args);
+ EA::StdC::Vsprintf(p1, "%d", args);
+ EA::StdC::Vsprintf(p2, "%d", argsCopy);
+ va_end(args);
+ va_end(argsCopy);
+}
+
+
+
+static int TestEAStdarg()
+{
+ int nErrorCount(0);
+
+ // VA_ARG_COUNT
+ static_assert(VA_ARG_COUNT() == 0, "VA_ARG_COUNT()");
+ static_assert(VA_ARG_COUNT(1) == 1, "VA_ARG_COUNT(1)");
+ static_assert(VA_ARG_COUNT(2, 2) == 2, "VA_ARG_COUNT(2)");
+ static_assert(VA_ARG_COUNT(3, 3, 3) == 3, "VA_ARG_COUNT(3)");
+ static_assert(VA_ARG_COUNT(4, 4, 4, 4) == 4, "VA_ARG_COUNT(4)");
+ static_assert(VA_ARG_COUNT(5, 5, 5, 5, 5) == 5, "VA_ARG_COUNT(5)");
+
+
+ char buffer1[64];
+ char buffer2[64];
+
+ // va_copy
+ TestEAStdargCopy(buffer1, buffer2, 17, 99);
+ EATEST_VERIFY((EA::StdC::AtoI32(buffer1) == 17) && (EA::StdC::AtoI32(buffer2) == 17));
+
+ // va_list_reference
+ TestEAStdargReference(buffer1, buffer2, 17, 99);
+ EATEST_VERIFY((EA::StdC::AtoI32(buffer1) == 17) && (EA::StdC::AtoI32(buffer2) == 99));
+
+ return nErrorCount;
+}
+
+
+
+static int TestEAUnits()
+{
+ int nErrorCount(0);
+
+ static_assert(EA_BYTE(64) == 64, "SI units mismatch");
+ static_assert(EA_BYTE(1000) == 1000, "SI units mismatch");
+
+ static_assert(EA_KILOBYTE(1) != EA_KIBIBYTE(1), "SI units mismatch");
+ static_assert(EA_MEGABYTE(1) != EA_MEBIBYTE(1), "SI units mismatch");
+ static_assert(EA_GIGABYTE(1) != EA_GIBIBYTE(1), "SI units mismatch");
+
+ static_assert((4 % EA_BYTE(4*10)) == 4, "Order of operations error"); //If unit macros aren't enclosed in parentheses, this will cause order of operation problems in this situation.
+ static_assert((4 % EA_MEBIBYTE(4)) == 4, "Order of operations error"); //If unit macros aren't enclosed in parentheses, this will cause order of operation problems in this situation.
+#ifndef EA_PROCESSOR_X86
+ static_assert(EA_TERABYTE(1) != EA_TEBIBYTE(1), "SI units mismatch");
+ static_assert(EA_PETABYTE(1) != EA_PEBIBYTE(1), "SI units mismatch");
+ static_assert(EA_EXABYTE(1) != EA_EXBIBYTE(1), "SI units mismatch");
+#endif
+
+ static_assert(EA_KILOBYTE(1) == 1000, "SI units mismatch");
+ static_assert(EA_MEGABYTE(2) == EA_KILOBYTE(2) * 1000, "SI units mismatch");
+ static_assert(EA_GIGABYTE(3) == EA_MEGABYTE(3) * 1000, "SI units mismatch");
+#ifndef EA_PROCESSOR_X86
+ static_assert(EA_TERABYTE(4) == EA_GIGABYTE(4) * 1000, "SI units mismatch");
+ static_assert(EA_PETABYTE(5) == EA_TERABYTE(5) * 1000, "SI units mismatch");
+ static_assert(EA_EXABYTE(6) == EA_PETABYTE(6) * 1000, "SI units mismatch");
+#endif
+
+ static_assert(EA_KIBIBYTE(1) == 1024, "SI units mismatch");
+ static_assert(EA_MEBIBYTE(2) == EA_KIBIBYTE(2) * 1024, "SI units mismatch");
+ static_assert(EA_GIBIBYTE(3) == EA_MEBIBYTE(3) * 1024, "SI units mismatch");
+#ifndef EA_PROCESSOR_X86
+ static_assert(EA_TEBIBYTE(4) == EA_GIBIBYTE(4) * 1024, "SI units mismatch");
+ static_assert(EA_PEBIBYTE(5) == EA_TEBIBYTE(5) * 1024, "SI units mismatch");
+ static_assert(EA_EXBIBYTE(6) == EA_PEBIBYTE(6) * 1024, "SI units mismatch");
+#endif
+
+ return nErrorCount;
+}
+
+
+
+template<typename Int128T, typename MakeInt128T>
+static void TestInt128T(MakeInt128T MakeInt128, const char* errorMsg, int& nErrorCount)
+{
+ auto VERIFY = [&](bool result) { if(!result) DoError(nErrorCount, errorMsg); };
+ const auto TestValue = MakeInt128(0x1234567812345678, 0x1234567812345678);
+ const Int128T zero = MakeInt128(0, 0);
+ const Int128T one = MakeInt128(0, 1);
+ const Int128T two = MakeInt128(0, 2);
+ const Int128T big = MakeInt128(0x1234567812345678, 0x1234567812345678);;
+ const Int128T negative_one = MakeInt128(0xffffffffffffffff, 0xffffffffffffffff);
+ const Int128T half_range = MakeInt128(0x0, 0xffffffffffffffff);
+
+ {
+ // Int128T a1 = 42.f;
+ // Int128T a2 = 42.0f;
+ // Int128T a3 = 42;
+ // Int128T a4 = 42u;
+ // Int128T a5 = 42ul;
+ // Int128T a6 = 42ull;
+ }
+
+ // default ctor
+ {
+ { Int128T a; (void)a; }
+ { Int128T a{}; (void)a; }
+
+ static_assert(eastl::is_trivially_default_constructible_v<Int128T>, "128-bit integer failure");
+ }
+
+ // operator-
+ {
+ VERIFY(negative_one == -one);
+ }
+
+ // operator~
+ {
+ auto not_one = ~one;
+ VERIFY(not_one == MakeInt128(0xffffffffffffffff, 0xfffffffffffffffe));
+ }
+
+ // operator+
+ {
+ VERIFY(zero == +zero);
+ VERIFY(one == +one);
+ VERIFY(big == +big);
+ }
+
+ // operator+
+ // operator-
+ // operator*
+ // operator/
+ // operator%
+ {
+ auto i = MakeInt128(42, 42);
+
+ i = i + one;
+ VERIFY(i == MakeInt128(42, 43));
+
+ i = i - one;
+ VERIFY(i == MakeInt128(42, 42));
+
+ i = i * two;
+ VERIFY(i == MakeInt128(84, 84));
+
+ i = i / two;
+ VERIFY(i == MakeInt128(42, 42));
+ }
+
+ // operator== / operator!=
+ {
+ VERIFY(TestValue == MakeInt128(0x1234567812345678, 0x1234567812345678));
+ VERIFY(TestValue == TestValue);
+ VERIFY(MakeInt128(0x1, 0x1) != MakeInt128(0x1, 0x2));
+ }
+
+ // operator<
+ {
+ VERIFY(zero < one);
+ VERIFY(one < two);
+ VERIFY(zero < two);
+ VERIFY(zero < big);
+ VERIFY(one < big);
+
+ VERIFY(MakeInt128(123, 122) < MakeInt128(123, 123));
+ VERIFY(MakeInt128(122, 123) < MakeInt128(123, 123));
+ }
+
+ // operator> / operator>=
+ {
+ VERIFY(TestValue > MakeInt128(0, 0x1234567812345678));
+ VERIFY(TestValue >= MakeInt128(0, 0x1234567812345678));
+ VERIFY(TestValue >= TestValue);
+ VERIFY(TestValue >= TestValue);
+ }
+
+ // operator< / operator<=
+ {
+ VERIFY(MakeInt128(0, 0x1234567812345678) < TestValue);
+ VERIFY(MakeInt128(0, 0x1234567812345678) <= TestValue);
+ VERIFY(TestValue <= TestValue);
+ VERIFY(TestValue <= TestValue);
+ }
+
+ // operator++
+ {
+ auto i = MakeInt128(0, 0);
+ VERIFY(i++ == MakeInt128(0, 0));
+ VERIFY(++i == MakeInt128(0, 2));
+ VERIFY(++i == MakeInt128(0, 3));
+ VERIFY(i++ == MakeInt128(0, 3));
+
+ {
+ auto n1 = half_range;
+ VERIFY(++n1 == MakeInt128(1, 0));
+ }
+ }
+
+ // operator--
+ {
+ auto i = MakeInt128(0, 5);
+ VERIFY(i-- == MakeInt128(0, 4));
+ VERIFY(--i == MakeInt128(0, 4));
+ VERIFY(--i == MakeInt128(0, 3));
+ VERIFY(i-- == MakeInt128(0, 2));
+
+ {
+ auto n1 = MakeInt128(1, 0);
+ VERIFY(n1-- == half_range);
+ }
+ }
+
+ // operator+=
+ // operator-=
+ // operator*=
+ // operator/=
+ // operator%=
+ {
+ auto n = MakeInt128(0, 5);
+
+ n += MakeInt128(0, 15);
+ VERIFY(n == MakeInt128(0, 20));
+
+ n -= MakeInt128(0, 18);
+ VERIFY(n == MakeInt128(0, 2));
+
+ n *= MakeInt128(0, 2);
+ VERIFY(n == MakeInt128(0, 4));
+
+ n /= MakeInt128(0, 2);
+ VERIFY(n == MakeInt128(0, 2));
+
+ n %= MakeInt128(0, 2);
+ VERIFY(n == MakeInt128(0, 0));
+ }
+
+ // operator>>
+ // operator<<
+ // operator>>=
+ // operator<<=
+ {
+ auto n = MakeInt128(0, 0x4);
+
+ {
+ auto a = n >> 1;
+ VERIFY(a == MakeInt128(0, 0x2));
+
+ a >>= 1;
+ VERIFY(a == MakeInt128(0, 0x1));
+ }
+
+ {
+ auto a = n << 1;
+ VERIFY(a == MakeInt128(0, 0x8));
+
+ a <<= 1;
+ VERIFY(a == MakeInt128(0, 0x10));
+ }
+
+ {
+ auto a = half_range;
+
+ a <<= 1;
+ VERIFY(a == MakeInt128(0x1, 0xfffffffffffffffe));
+ }
+
+ {
+ auto a = half_range;
+ a >>= 1;
+ VERIFY(a == MakeInt128(0x0, 0x7fffffffffffffff));
+ }
+ }
+
+ // operator^
+ // operator|
+ // operator&
+ // operator^=
+ // operator|=
+ // operator&=
+ {
+ const auto n1 = MakeInt128(0xAAAAAAAAAAAAAAAA, 0xAAAAAAAAAAAAAAAA);
+ const auto n2 = MakeInt128(0x5555555555555555, 0x5555555555555555);
+
+ {
+ auto i = n1 ^ n2;
+ VERIFY(i == negative_one);
+
+ auto n3 = n1;
+ n3 ^= n2;
+ VERIFY(n3 == negative_one);
+ }
+
+ {
+ auto i = n1 | n2;
+ VERIFY(i == negative_one);
+
+ auto n3 = n1;
+ n3 |= n2;
+ VERIFY(n3 == negative_one);
+ }
+
+ {
+ auto i = n1 & n2;
+ VERIFY(i == zero);
+
+ auto n3 = n1;
+ n3 &= n2;
+ VERIFY(n3 == zero);
+ }
+
+ }
+
+ // Test loop counter
+ {
+ {
+ int counter = 0;
+ Int128T i = MakeInt128(0,0);
+
+ for (; i < MakeInt128(0,10); i++)
+ counter++;
+
+ VERIFY(i == MakeInt128(0, counter));
+ }
+
+ {
+ // int counter = 0;
+
+ // for (Int128T i = 0; i < 10; i++)
+ // counter++;
+
+ // VERIFY(i == counter);
+ }
+ }
+}
+
+
+
+static int TestEAInt128_t()
+{
+ int nErrorCount(0);
+
+ TestInt128T<uint128_t>(UINT128_C, "uint128_t test failure", nErrorCount);
+ TestInt128T<int128_t>(INT128_C, "int128_t test failure", nErrorCount);
+
+ return nErrorCount;
+}
+
+
+
+// EA_WCHAR_UNIQUE
+template <typename T>
+struct wchar_unique { enum { value = 1 }; }; // if wchar_t is unique then wchar_unique<wchar_t>::value should be 1
+template <> struct wchar_unique<char8_t> { enum { value = 0 }; }; // if wchar_unique is not unique then it should match one of the specializations and the value will be 0.
+template <> struct wchar_unique<char16_t> { enum { value = 0 }; };
+template <> struct wchar_unique<char32_t> { enum { value = 0 }; };
+#if EA_WCHAR_UNIQUE
+ static_assert( wchar_unique<wchar_t>::value == 1, "WCHAR_UNIQUE appears to be incorrectly defined to 1 by EABase" );
+#else
+ static_assert( wchar_unique<wchar_t>::value == 0, "WCHAR_UNIQUE appears to be incorrectly defined to 0 by EABase" );
+#endif
+
+
+//
+// Tests for EA_IS_ENABLED
+//
+#define EABASE_TEST_FEATURE_A EA_ENABLED
+#if EA_IS_ENABLED(EABASE_TEST_FEATURE_A)
+ // Feature A is enabled
+#else
+ #error Error EABASE_TEST_FEATURE_A should be enabled.
+#endif
+// Make sure it is possible to successfully negate the test.
+#if !EA_IS_ENABLED(EABASE_TEST_FEATURE_A)
+ #error Error EABASE_TEST_FEATURE_A should be enabled.
+#endif
+
+#define EABASE_TEST_FEATURE_B EA_DISABLED
+#if EA_IS_ENABLED(EABASE_TEST_FEATURE_B)
+ #error Error EABASE_TEST_FEATURE_B should be disabled.
+#endif
+// Make sure it is possible to successfully negate the test.
+#if !EA_IS_ENABLED(EABASE_TEST_FEATURE_B)
+ // Feature B is not enabled
+#else
+ #error Error EABASE_TEST_FEATURE_B should be disabled.
+#endif
+
+// The test below should cause compilation to fail if it is uncommented. However we can't
+// obviously enable the test because it will break the build. It should be tested manually
+// if changes to EA_IS_ENABLED are made.
+//
+// #if EA_IS_ENABLED(EABASE_TEST_FEATURE_WITH_NO_DEFINE)
+// #endif
+
+
+int EAMain(int, char**)
+{
+ int nErrorCount = 0;
+ int nTotalErrorCount = 0;
+
+
+ nErrorCount = TestEABase();
+ EA::EAMain::Report("EABase test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAResult();
+ EA::EAMain::Report("EAResult test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAPlatform();
+ EA::EAMain::Report("EAPlatform test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEACompiler();
+ EA::EAMain::Report("EACompiler test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEACompilerTraits();
+ EA::EAMain::Report("EACompilerTraits test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestNullPtr();
+ EA::EAMain::Report("nullptr test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAHave();
+ EA::EAMain::Report("EAHave test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAAlignment();
+ EA::EAMain::Report("EAAlignment test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAStdarg();
+ EA::EAMain::Report("EAStdarg test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAUnits();
+ EA::EAMain::Report("EAUnits test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAInt128_t();
+ EA::EAMain::Report("EAInt128_t test failure count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+
+ if (nTotalErrorCount == 0)
+ EA::EAMain::Report("\nAll tests completed successfully.\n");
+ else
+ EA::EAMain::Report("\nTests failed. Total error count: %d\n", nTotalErrorCount);
+
+ return nTotalErrorCount;
+}
+
+EA_RESTORE_VC_WARNING() // for the following from above: EA_DISABLE_VC_WARNING(4265 4296 4310 4350 4481 4530 4625 4626 4996)
diff --git a/EASTL/test/packages/EABase/test/source/TestEABase.h b/EASTL/test/packages/EABase/test/source/TestEABase.h
new file mode 100644
index 0000000..20c3bf6
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/source/TestEABase.h
@@ -0,0 +1,40 @@
+/////////////////////////////////////////////////////////////////////////////
+// Copyright (c) Electronic Arts Inc. All rights reserved.
+/////////////////////////////////////////////////////////////////////////////
+
+#include <EABase/eabase.h>
+#include <EABase/version.h>
+
+
+// What we do here is verify that EA_PRAGMA_ONCE_SUPPORTED works as intended.
+// This header file should be #included two times by TestEABase.cpp
+// in order to test this.
+
+#if defined(EA_PRAGMA_ONCE_SUPPORTED)
+ #pragma once
+ const int EABaseOncePerTranslationUnitTestVariable = 0; // This should get compiled only once ever for a compilation unit.
+#else
+ // Just implement a classic manual header include guard.
+ // In this case we aren't really testing anything.
+ #ifndef TESTEABASE_H
+ #define TESTEABASE_H
+ const int EABaseOncePerTranslationUnitTestVariable = 0;
+ #endif
+#endif
+
+
+
+// EA_EXTERN_TEMPLATE / EA_COMPILER_NO_EXTERN_TEMPLATE
+
+#if defined(__cplusplus)
+ template <typename T>
+ struct eabase_template
+ {
+ T value;
+ T GetValue() const { return value; }
+ };
+
+ EA_EXTERN_TEMPLATE(struct eabase_template<char>);
+#endif
+
+
diff --git a/EASTL/test/packages/EABase/test/source/TestEABaseC.c b/EASTL/test/packages/EABase/test/source/TestEABaseC.c
new file mode 100644
index 0000000..71f492f
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/source/TestEABaseC.c
@@ -0,0 +1,1213 @@
+/////////////////////////////////////////////////////////////////////////////
+// Copyright (c) Electronic Arts Inc. All rights reserved.
+/////////////////////////////////////////////////////////////////////////////
+
+#include "TestEABase.h"
+#include "TestEABase.h" // Intentionally double-include the same header file, to test it.
+#include <EABase/eabase.h>
+#include <EABase/eahave.h>
+
+#if defined(_MSC_VER)
+ #pragma warning(disable: 4296 4310 4255) // expression is always true, cast truncates const value.
+#endif
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#include <assert.h>
+#include <math.h>
+
+#if defined(EA_COMPILER_MSVC) && defined(EA_PLATFORM_MICROSOFT)
+ EA_DISABLE_ALL_VC_WARNINGS()
+ #if defined(EA_PLATFORM_XENON)
+ #define NOD3D
+ #define NONET
+ #include <Xtl.h>
+ #else
+ #pragma warning(disable: 28252)
+ #pragma warning(disable: 28253)
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+ #include <Windows.h>
+ #endif
+ EA_RESTORE_ALL_VC_WARNINGS()
+#elif defined(EA_PLATFORM_ANDROID)
+ #include <android/log.h>
+#endif
+
+
+// Some CPU/Compiler combinations don't support arbitrary alignment declarations.
+// In particular some ARM compilers often don't. You can use EAStdC's EAAlignment to
+// achieve arbitrary alignment if EA_ALIGN doesn't work.
+#if (EA_ALIGN_MAX_AUTOMATIC < 64)
+ #define ALIGNMENT_AMOUNT_64 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_64 64
+#endif
+
+#if (EA_ALIGN_MAX_AUTOMATIC < 32)
+ #define ALIGNMENT_AMOUNT_32 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_32 32
+#endif
+
+#if (EA_ALIGN_MAX_AUTOMATIC < 16)
+ #define ALIGNMENT_AMOUNT_16 EA_ALIGN_MAX_AUTOMATIC
+#else
+ #define ALIGNMENT_AMOUNT_16 16
+#endif
+
+
+
+#if defined(__cplusplus)
+struct ClassWithDefaultCtor
+{
+ ClassWithDefaultCtor(int x = 0)
+ { char buffer[16]; sprintf(buffer, "%d", x); }
+};
+
+
+struct ClassWithoutDefaultCtor
+{
+ ClassWithoutDefaultCtor(int x)
+ { char buffer[16]; sprintf(buffer, "%d", x); }
+};
+#endif
+
+
+// Forward declarations
+int Stricmp(const char* pString1, const char* pString2);
+int TestEABase(void);
+int TestEAResult(void);
+int TestEAPlatform(void);
+int TestNU(void);
+int TestEACompiler(void);
+int TestEACompilerTraits(void);
+int Verify(int bTest, const char* pMessage);
+
+#define DoError(nErrorCount, pMessage) DoErrorC(&nErrorCount, pMessage)
+void DoErrorC(int* nErrorCount, const char* pMessage);
+
+
+
+/* Test EA_DISABLE_WARNING */
+EA_DISABLE_VC_WARNING(4548 4127)
+EA_DISABLE_ALL_VC_WARNINGS()
+EA_RESTORE_ALL_VC_WARNINGS()
+
+EA_DISABLE_GCC_WARNING(-Wuninitialized)
+
+EA_DISABLE_SN_WARNING(1787)
+EA_DISABLE_ALL_SN_WARNINGS()
+EA_RESTORE_ALL_SN_WARNINGS()
+
+EA_DISABLE_GHS_WARNING(123)
+
+EA_DISABLE_EDG_WARNING(193)
+
+EA_DISABLE_CW_WARNING(10317)
+EA_DISABLE_ALL_CW_WARNINGS()
+EA_RESTORE_ALL_CW_WARNINGS()
+
+static void Printf(const char8_t* pFormat, ...)
+{
+ #if defined(_MSC_VER)
+ #define vsnprintf _vsnprintf
+ #endif
+
+ if(pFormat)
+ {
+ char pMessage[512];
+ int nReturnValue;
+
+ va_list arguments;
+ va_start(arguments, pFormat);
+ nReturnValue = vsnprintf(pMessage, EAArrayCount(pMessage), pFormat, arguments);
+ va_end(arguments);
+
+ if(nReturnValue > 0)
+ {
+ #if defined(EA_PLATFORM_ANDROID)
+ __android_log_write(ANDROID_LOG_INFO, "EABase.Printf", pMessage);
+ #else
+ fputs(pMessage, stdout);
+ #endif
+
+ #if defined(EA_COMPILER_MSVC) && defined(EA_PLATFORM_MICROSOFT)
+ OutputDebugStringA(pMessage);
+ #endif
+ }
+ }
+}
+
+/* Test EA_DISABLE_WARNING */
+EA_RESTORE_VC_WARNING()
+EA_RESTORE_GCC_WARNING()
+EA_RESTORE_SN_WARNING()
+EA_RESTORE_GHS_WARNING()
+EA_RESTORE_EDG_WARNING()
+EA_RESTORE_CW_WARNING(10317)
+
+
+
+int Verify(int bTest, const char* pMessage)
+{
+ if(!bTest)
+ {
+ if(pMessage)
+ Printf("Test warning: %s\n", pMessage);
+ }
+
+ return bTest ? 0 : 1;
+}
+
+
+void DoErrorC(int* nErrorCount, const char* pMessage)
+{
+ ++*nErrorCount;
+ if(pMessage)
+ Printf("Test error: %s\n", pMessage);
+}
+
+
+int Stricmp(const char* pString1, const char* pString2)
+{
+ char c1, c2;
+
+ while((c1 = (char)tolower((int)*pString1++)) == (c2 = (char)tolower((int)*pString2++)))
+ {
+ if(c1 == 0)
+ return 0;
+ }
+
+ return (c1 - c2);
+}
+
+
+// GCC requires that function attributes be declared in the function
+// declaration and not in the function definition.
+// RVCT seems to require attributes to be in both the declaration
+// and definition otherwise you get a "declaration is incompatible" error
+int PureFunction(void) EA_PURE;
+
+int PureFunction(void)
+#if defined(EA_COMPILER_RVCT)
+EA_PURE
+#endif
+{
+ return (strlen("abc") == 3);
+}
+
+
+struct InitPriorityTestClass
+{
+ int mX;
+};
+
+
+
+// EA_MAY_ALIAS
+void* EA_MAY_ALIAS gPtr0 = NULL;
+
+typedef void* EA_MAY_ALIAS pvoid_may_alias;
+pvoid_may_alias gPtr1 = NULL;
+
+
+
+// static_asset at global scope
+// Should succeed.
+static_assert(sizeof(int32_t) == 4, "static_assert failure");
+// Should fail.
+//static_assert(sizeof(int32_t) == 8, "static_assert failure");
+
+
+
+static size_t RestrictTest(char* EA_RESTRICT p)
+{
+ return sizeof(p);
+}
+
+
+// EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+EA_OPTIMIZE_OFF()
+static EA_NO_INLINE int DisabledOptimizations(int x)
+{
+ return x * 37;
+}
+EA_OPTIMIZE_ON()
+
+
+// EA_UNUSED
+static void FunctionWithUnusedVariables(int x)
+{
+ int y = 0;
+ EA_UNUSED(x);
+ EA_UNUSED(y);
+}
+
+
+
+int TestEABase(void)
+{
+ int nErrorCount = 0;
+
+
+ // Test NULL
+ {
+ EA_DISABLE_VC_WARNING(6326)
+ Verify(NULL == (void*)0, "unspecified test");
+ EA_RESTORE_VC_WARNING()
+ }
+
+ // Verify sized type sizes
+ {
+ const ssize_t ss = 1; // Verify that ssize_t is a signed type.
+
+ Verify(sizeof(int8_t) == 1, "int8_t size test");
+ Verify(sizeof(uint8_t) == 1, "uint8_t size test");
+ Verify(sizeof(int16_t) == 2, "int16_t size test");
+ Verify(sizeof(uint16_t) == 2, "uint16_t size test");
+ Verify(sizeof(int32_t) == 4, "int32_t size test");
+ Verify(sizeof(uint32_t) == 4, "uint32_t size test");
+ Verify(sizeof(int64_t) == 8, "int64_t size test");
+ Verify(sizeof(uint64_t) == 8, "uint64_t size test");
+
+ #if !defined(FLT_EVAL_METHOD)
+ #error EABase should always define FLT_EVAL_METHOD
+ Verify(0, "FLT_EVAL_METHOD test: not defined.");
+ #else
+ #if !defined(__GNUC__) || defined(__USE_ISOC99) // GCC doesn't define float_t/double_t unless __USE_ISOC99 is defined (compiled with -std=c99)
+ #if (FLT_EVAL_METHOD == -1)
+ // In this case the C99 standard states that the
+ // precision of float_t and double_t is indeterminable.
+ #elif (FLT_EVAL_METHOD == 0)
+ Verify(sizeof(float_t) == sizeof(float), "float_t size test");
+ Verify(sizeof(double_t) == sizeof(double), "double_t size test");
+ #elif (FLT_EVAL_METHOD == 1)
+ Verify(sizeof(float_t) == sizeof(double), "float_t size test");
+ Verify(sizeof(double_t) == sizeof(double), "double_t size test");
+ #elif (FLT_EVAL_METHOD == 2)
+ Verify(sizeof(float_t) == sizeof(long double), "float_t size test");
+ Verify(sizeof(double_t) == sizeof(long double), "double_t size test");
+ #else
+ DoError(nErrorCount, "FLT_EVAL_METHOD test: invalid value.");
+ #endif
+ #endif
+ #endif
+
+ Verify(sizeof(bool8_t) == 1, "bool8_t size test");
+ Verify(sizeof(intptr_t) == sizeof(void*), "intptr_t size test");
+ Verify(sizeof(uintptr_t) == sizeof(void*), "uintptr_t size test");
+ Verify(sizeof(ssize_t) == sizeof(size_t), "ssize_t size test");
+ Verify((ssize_t)((ss ^ ss) - 1) < 0, "ssize_t sign test");
+ Verify(sizeof(char8_t) == 1, "char8_t size test");
+ Verify(sizeof(char16_t) == 2, "char16_t size test");
+ Verify(sizeof(char32_t) == 4, "char32_t test");
+
+ #if (EA_WCHAR_SIZE == 2) || (EA_WCHAR_SIZE == 4)
+ Verify(sizeof(wchar_t) == EA_WCHAR_SIZE, "EA_WCHAR_SIZE test");
+ #else
+ Verify(0, "EA_WCHAR_SIZE test");
+ #endif
+ }
+
+ // Test char8_t, char16_t, char32_t string literals.
+ {
+ const char8_t* p8 = "abc";
+ const char8_t c8 = 'a';
+
+ #ifdef EA_CHAR16
+ const char16_t* p16 = EA_CHAR16("abc"); // Under GCC, this assumes compiling with -fshort-wchar
+ const char16_t c16 = EA_CHAR16('\x3001');
+ #else
+ const char16_t* p16 = NULL;
+ const char16_t c16 = (char16_t)'X';
+ #endif
+
+ #if EA_CHAR16_NATIVE
+ const char32_t* p32 = EA_CHAR32("abc");
+ const char32_t c32 = EA_CHAR32('\x3001');
+ #else
+ const char32_t p32[] = { 'a', 'b', 'c', '\0' }; // Microsoft doesn't support 32 bit strings here, and GCC doesn't use them when we compile with -fshort-wchar (which we do).
+ #ifdef EA_CHAR16
+ const char32_t c32 = EA_CHAR16('\x3001'); // 16 bit should silently convert to 32 bit.
+ #else
+ const char32_t c32 = (char16_t)'X'; // 16 bit should silently convert to 32 bit.
+ #endif
+ #endif
+
+ char buffer[128];
+ sprintf(buffer, "%p %p %p %p %p %p", &p8, &c8, &p16, &c16, &p32, &c32); // Make possible compiler warnings about unused variables go away.
+ }
+
+ #if 0
+
+ // Verify sized type signs
+ {
+ int8_t i8(1);
+ if(int8_t((i8 ^ i8) - 1) >= 0)
+ DoError(nErrorCount, "int8_t sign test");
+
+ uint8_t u8(1);
+ if(uint8_t((u8 ^ u8) - 1) <= 0)
+ DoError(nErrorCount, "uint8_t sign test");
+
+ int16_t i16(1);
+ if(int16_t((i16 ^ i16) - 1) >= 0)
+ DoError(nErrorCount, "int16_t sign test");
+
+ uint16_t u16(1);
+ if(uint16_t((u16 ^ u16) - 1) <= 0)
+ DoError(nErrorCount, "uint16_t sign test");
+
+ int32_t i32(1);
+ if(int32_t((i32 ^ i32) - 1) >= 0)
+ DoError(nErrorCount, "int32_t sign test");
+
+ uint32_t u32(1);
+ if(uint32_t((u32 ^ u32) - 1) <= 0)
+ DoError(nErrorCount, "uint32_t sign test");
+
+ int64_t i64(1);
+ if(int64_t((i64 ^ i64) - 1) >= 0)
+ DoError(nErrorCount, "int64_t sign test");
+
+ uint64_t u64(1);
+ if(uint64_t((u64 ^ u64) - 1) <= 0)
+ DoError(nErrorCount, "uint64_t sign test");
+
+
+
+ intptr_t ip(1);
+ if(intptr_t((ip ^ ip) - 1) >= 0)
+ DoError(nErrorCount, "intptr_t sign test");
+
+ uintptr_t up(1);
+ if(uintptr_t((up ^ up) - 1) <= 0)
+ DoError(nErrorCount, "uintptr_t sign test");
+
+
+ // The following sign tests have been disabled, as the determination of
+ // the sign of type char and wchar_t are in the hands of the compiler and
+ // the user's configuration of that compiler.
+
+ //char8_t c8(1); // We expect it to be signed, though the need for such a requirement is debateable.
+ //if(char8_t((c8 ^ c8) - 1) >= 0)
+ // DoError(nErrorCount, "char8_t sign test");
+
+ //char16_t c16(1); // We expect it to be unsigned
+ //if(char16_t((c16 ^ c16) - 1) <= 0)
+ // DoError(nErrorCount, "char16_t sign test");
+
+ //char32_t c32(1); // We expect it to be unsigned
+ //if(char32_t((c32 ^ c32) - 1) <= 0)
+ // DoError(nErrorCount, "char32_t sign test");
+ }
+
+
+
+ //Test Constant macros
+ {
+ char buffer[256];
+
+ const int8_t i8Min = INT8_C(-128); // Strictly speaking, the C language standard allows this to be -127 as well.
+ const int8_t i8Max = INT8_C(127);
+
+ const uint8_t u8Min = UINT8_C(0);
+ const uint8_t u8Max = UINT8_C(255);
+
+ const int16_t i16Min = INT16_C(-32767) - 1;
+ const int16_t i16Max = INT16_C( 32767);
+
+ const uint16_t u16Min = UINT16_C(0);
+ const uint16_t u16Max = UINT16_C(65535);
+
+ const int32_t i32Min = INT32_C(-2147483647) - 1;
+ const int32_t i32Max = INT32_C( 2147483647);
+
+ const uint32_t u32Min = UINT32_C(0);
+ const uint32_t u32Max = UINT32_C(4294967295);
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const int64_t i64Min = -9223372036854775807LL - 1;
+ const int64_t i64Max = 9223372036854775807LL;
+
+ const uint64_t u64Min = UINT64_C(0);
+ const uint64_t u64Max = 18446744073709551615ULL;
+ #else
+ const int64_t i64Min = INT64_C(-9223372036854775807) - 1;
+ const int64_t i64Max = INT64_C( 9223372036854775807);
+
+ const uint64_t u64Min = UINT64_C(0);
+ const uint64_t u64Max = UINT64_C(18446744073709551615);
+ #endif
+
+ sprintf(buffer, "%d %d %u %u %d %d %u %u %d %d %u %u %"SCNd64" %"SCNd64" %"SCNu64" %"SCNu64,
+ (int)i8Min, (int)i8Max, (unsigned)u8Min, (unsigned)u8Max,
+ (int)i16Min, (int)i16Max, (unsigned)u16Min, (unsigned)u16Max,
+ (int)i32Min, (int)i32Max, (unsigned)u32Min, (unsigned)u32Max,
+ i64Min, i64Max, u64Min, u64Max);
+ if(strcmp(buffer, "-128 127 0 255 -32768 32767 0 65535 -2147483648 2147483647 0 4294967295 -9223372036854775808 9223372036854775807 0 18446744073709551615"))
+ DoError(nErrorCount, "INT_C test");
+
+ // Verify the use of hex numbers with INT64_C
+ const int64_t i64Hex = INT64_C(0x1111111122222222);
+ if(i64Hex != INT64_C(1229782938533634594))
+ DoError(nErrorCount, "INT64_C hex error");
+
+ // Verify the use of hex numbers with UINT64_C
+ const uint64_t u64Hex = UINT64_C(0xaaaaaaaabbbbbbbb);
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const uint64_t temp = 12297829382759365563ULL;
+ #else
+ const uint64_t temp = UINT64_C(12297829382759365563);
+ #endif
+
+ if(u64Hex != temp)
+ DoError(nErrorCount, "UINT64_C hex error");
+
+ // Verify that the compiler both allows division with uint64_t but
+ // also that it allows it via UINT64_MAX. A bad implementation of
+ // UINT64_MAX would cause the code below to mis-execute or not compile.
+ const uint64_t resultUint64 = UINT64_MAX / 2;
+ if(resultUint64 != UINT64_C(9223372036854775807))
+ DoError(nErrorCount, "UINT64_MAX error");
+ }
+
+ //Test sized Printf format specifiers
+ {
+ char buffer[256];
+
+ int8_t d8(INT8_MAX), i8(INT8_MIN), o8(INT8_MAX);
+ uint8_t u8(UINT8_MAX), x8(UINT8_MAX), X8(UINT8_MAX);
+ sprintf(buffer, "%" PRId8 " %" PRIi8 " %" PRIo8 " %" PRIu8 " %" PRIx8 " %" PRIX8, d8, i8, o8, u8, x8, X8);
+
+ #ifdef EA_COMPILER_GNUC
+ if(Stricmp(buffer, "127 -128 177 255 ff FF"))
+ DoError(nErrorCount, "PRI8 test"); // This is known to fail with compilers such as VC++ which don't support %hh.
+ #endif
+
+ int16_t d16(INT16_MAX), i16(INT16_MIN), o16(INT16_MAX);
+ uint16_t u16(UINT16_MAX), x16(UINT16_MAX), X16(UINT16_MAX);
+ sprintf(buffer, "%" PRId16 " %" PRIi16 " %" PRIo16 " %" PRIu16 " %" PRIx16 " %" PRIX16, d16, i16, o16, u16, x16, X16);
+ if(Stricmp(buffer, "32767 -32768 77777 65535 ffff FFFF"))
+ DoError(nErrorCount, "PRI16 test");
+
+ int32_t d32(INT32_MAX), i32(INT32_MIN), o32(INT32_MAX);
+ uint32_t u32(UINT32_MAX), x32(UINT32_MAX), X32(UINT32_MAX);
+ sprintf(buffer, "%" PRId32 " %" PRIi32 " %" PRIo32 " %" PRIu32 " %" PRIx32 " %" PRIX32, d32, i32, o32, u32, x32, X32);
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 4294967295 ffffffff FFFFFFFF"))
+ DoError(nErrorCount, "PRI32 test");
+
+ int64_t d64(INT64_MAX), i64(INT64_MIN), o64(INT64_MAX);
+ uint64_t u64(UINT64_MAX), x64(UINT64_MAX), X64(UINT64_MAX);
+ sprintf(buffer, "%" PRId64 " %" PRIi64 " %" PRIo64 " %" PRIu64 " %" PRIx64 " %" PRIX64, d64, i64, o64, u64, x64, X64);
+ if(Stricmp(buffer, "9223372036854775807 -9223372036854775808 777777777777777777777 18446744073709551615 ffffffffffffffff FFFFFFFFFFFFFFFF"))
+ DoError(nErrorCount, "PRI64 test");
+
+ // Many compilers give warnings for the following code because they
+ // recognize that a pointer is being formatted as an integer.
+ // This is what we want to do and what the C99 standard intends here.
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ #pragma warning(disable: 4313) // Warning C4313: 'sprintf' : '%d' in format string conflicts with argument 1 of type 'void *'
+ #endif
+
+ void *dPtr = (void*)INT32_MAX, *iPtr = (void*)INT32_MIN, *oPtr = (void*)INT32_MAX, *uPtr = (void*)(uintptr_t)UINT64_MAX, *xPtr = (void*)(uintptr_t)UINT64_MAX, *XPtr = (void*)(uintptr_t)UINT64_MAX;
+ sprintf(buffer, "%" PRIdPTR " %" PRIiPTR " %" PRIoPTR " %" PRIuPTR " %" PRIxPTR " %" PRIXPTR, (intptr_t)dPtr, (intptr_t)iPtr, (uintptr_t)oPtr, (uintptr_t)uPtr, (uintptr_t)xPtr, (uintptr_t)XPtr);
+
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 4294967295 ffffffff FFFFFFFF"))
+ DoError(nErrorCount, "PRIPTR test");
+ #else // EA_PLATFORM_PTR_SIZE == 8
+ if(Stricmp(buffer, "2147483647 -2147483648 17777777777 18446744073709551615 ffffffffffffffff FFFFFFFFFFFFFFFF"))
+ DoError(nErrorCount, "PRIPTR test");
+ #endif
+
+ #if defined(_MSC_VER) && (_MSC_VER >= 1300)
+ #pragma warning(default: 4313)
+ #endif
+ }
+
+ //Test sized scanf format specifiers
+ {
+ #ifdef EA_COMPILER_IS_C99 // Enabled for C99 only because this code will simply crash on many platforms if the format specifiers aren't supported.
+ int8_t d8, i8, o8;
+ uint8_t u8, x8;
+ sscanf("127 -127 177 255 ff", "%"SCNd8 " %"SCNi8 " %"SCNo8 " %"SCNu8 " %"SCNx8, &d8, &i8, &o8, &u8, &x8);
+ if((d8 != 127) || (i8 != -127) || (o8 != 127) || (u8 != 255) || (x8 != 255))
+ DoError(nErrorCount, "SCN8 test"); // This is known to fail with compilers such as VC++ which don't support %hh.
+ #endif
+
+ int16_t d16, i16, o16;
+ uint16_t u16, x16;
+ sscanf("32767 -32768 77777 65535 ffff", "%"SCNd16 " %"SCNi16 " %"SCNo16 " %"SCNu16 " %"SCNx16, &d16, &i16, &o16, &u16, &x16);
+ if((d16 != 32767) || (i16 != -32768) || (o16 != 32767) || (u16 != 65535) || (x16 != 65535))
+ DoError(nErrorCount, "SCN16 test");
+
+ int32_t d32, i32, o32;
+ uint32_t u32, x32;
+ sscanf("2147483647 -2147483648 17777777777 4294967295 ffffffff", "%"SCNd32 " %"SCNi32 " %"SCNo32 " %"SCNu32 " %"SCNx32, &d32, &i32, &o32, &u32, &x32);
+ if((d32 != INT32_MAX) || (i32 != INT32_MIN) || (o32 != INT32_MAX) || (u32 != UINT32_MAX) || (x32 != UINT32_MAX))
+ DoError(nErrorCount, "SCN32 test");
+
+ int64_t d64, i64, o64;
+ uint64_t u64, x64;
+ sscanf("9223372036854775807 -9223372036854775808 777777777777777777777 18446744073709551615 ffffffffffffffff", "%"SCNd64 " %"SCNi64 " %"SCNo64 " %"SCNu64 " %"SCNx64, &d64, &i64, &o64, &u64, &x64);
+ if((d64 != INT64_MAX) || (i64 != INT64_MIN) || (o64 != INT64_MAX) || (u64 != UINT64_MAX) || (x64 != UINT64_MAX))
+ DoError(nErrorCount, "SCN64 test");
+
+ // Many compilers give warnings for the following code because they
+ // recognize that a pointer is being formatted as an integer.
+ // This is what we want to do and what the C99 standard intends here.
+ void *dPtr, *iPtr, *oPtr, *uPtr, *xPtr;
+
+ #if (EA_PLATFORM_PTR_SIZE == 4)
+ sscanf("2147483647 -2147483648 17777777777 4294967295 ffffffff", "%"SCNdPTR " %"SCNiPTR " %"SCNoPTR " %"SCNuPTR " %"SCNxPTR, (intptr_t*)&dPtr, (intptr_t*)&iPtr, (uintptr_t*)&oPtr, (uintptr_t*)&uPtr, (uintptr_t*)&xPtr);
+ #else // EA_PLATFORM_PTR_SIZE == 8
+ sscanf("2147483647 -2147483648 17777777777 18446744073709551615 ffffffffffffffff", "%"SCNdPTR " %"SCNiPTR " %"SCNoPTR " %"SCNuPTR " %"SCNxPTR, (intptr_t*)&dPtr,(intptr_t*)&iPtr, (uintptr_t*)&oPtr, (uintptr_t*)&uPtr, (uintptr_t*)&xPtr);
+ #endif
+
+ if((dPtr != (void*)INT32_MAX) || (iPtr != (void*)INT32_MIN) || (oPtr != (void*)INT32_MAX) || (uPtr != (void*)(uintptr_t)UINT64_MAX) || (xPtr != (void*)(uintptr_t)UINT64_MAX))
+ DoError(nErrorCount, "SCNPTR test");
+ }
+
+
+ // Test min/max
+ {
+ // The C standard allows INT8_MIN to be either -127 or -128. So in order to be able
+ // to test for this in a portable way, we do the logic below whereby we test for
+ // -127 (which all compiles should support) or -127 - 1 which all compilers should
+ // support if INT8_MIN isn't -127.
+ if(!Verify(INT8_MIN == INT8_C(-127)) && !Verify(INT8_MIN == INT8_C(-127) - 1))
+ DoError(nErrorCount, "INT8_MIN test");
+ if(!Verify(INT8_MAX == INT8_C(127)))
+ DoError(nErrorCount, "INT8_MAX test");
+ if(!Verify(UINT8_MAX == UINT8_C(255)))
+ DoError(nErrorCount, "UINT8_MAX test");
+
+ if(!Verify(INT16_MIN == INT16_C(-32767)) && !Verify(INT16_MIN == INT16_C(-32767) - 1))
+ DoError(nErrorCount, "INT16_MIN test");
+ if(!Verify(INT16_MAX == INT16_C(32767)))
+ DoError(nErrorCount, "INT16_MAX test");
+ if(!Verify(UINT16_MAX == UINT16_C(65535)))
+ DoError(nErrorCount, "UINT16_MAX test");
+
+ if(!Verify(INT32_MIN == INT32_C(-2147483647)) && !Verify(INT32_MIN == INT32_C(-2147483647) - 1))
+ DoError(nErrorCount, "INT32_MIN test");
+ if(!Verify(INT32_MAX == INT32_C(2147483647)))
+ DoError(nErrorCount, "INT32_MAX test");
+ if(!Verify(UINT32_MAX == UINT32_C(4294967295)))
+ DoError(nErrorCount, "UINT32_MAX test");
+
+ if(!Verify(INT64_MIN == INT64_C(-9223372036854775807)) && !Verify(INT64_MIN == INT64_C(-9223372036854775807) - 1))
+ DoError(nErrorCount, "INT64_MIN test");
+ if(!Verify(INT64_MAX == INT64_C(9223372036854775807)))
+ DoError(nErrorCount, "INT64_MAX test");
+
+ #if defined(__GNUC__) && (__GNUC__ < 4) // If using a broken version of UINT64_C/INT64_C macros...
+ const uint64_t temp = 18446744073709551615ULL;
+ #else
+ const uint64_t temp = UINT64_C(18446744073709551615);
+ #endif
+
+ if(!Verify(UINT64_MAX == temp))
+ DoError(nErrorCount, "UINT64_MAX test");
+ }
+
+ #endif
+
+ return nErrorCount;
+}
+
+
+
+
+int TestEAPlatform(void)
+{
+ int nErrorCount = 0;
+
+ // Test EA_PLATFORM_PTR_SIZE
+ {
+ #ifdef EA_PLATFORM_PTR_SIZE
+ Verify(EA_PLATFORM_PTR_SIZE == sizeof(void*), "EA_PLATFORM_PTR_SIZE test");
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_PTR_SIZE test");
+ #endif
+ }
+
+
+ // Test EA_PLATFORM_NAME
+ {
+ #ifdef EA_PLATFORM_NAME
+ char buffer[256];
+ sprintf(buffer, "TestEAPlatform: EA_PLATFORM_NAME: %s\n", EA_PLATFORM_NAME);
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_NAME test");
+ #endif
+ }
+
+
+ // Test EA_PLATFORM_DESCRIPTION
+ {
+ #ifdef EA_PLATFORM_DESCRIPTION
+ char buffer[256];
+ sprintf(buffer, "TestEAPlatform: EA_PLATFORM_DESCRIPTION: %s\n", EA_PLATFORM_DESCRIPTION);
+ #else
+ DoError(nErrorCount, "EA_PLATFORM_DESCRIPTION test");
+ #endif
+ }
+
+
+ // Test EA_SYSTEM_LITTLE_ENDIAN / EA_SYSTEM_BIG_ENDIAN
+ {
+ uint32_t kValue = 0x12345678;
+ uint8_t* pValue = (uint8_t*)&kValue;
+
+ #ifdef EA_SYSTEM_LITTLE_ENDIAN
+ Verify(pValue[0] == 0x78, "EA_SYSTEM_ENDIAN test");
+ #elif defined(EA_SYSTEM_BIG_ENDIAN)
+ Verify(pValue[0] == 0x12, "EA_SYSTEM_ENDIAN test");
+ #else
+ Verify(0, "EA_SYSTEM_ENDIAN test");
+ #endif
+ }
+
+
+ // Test EA_ASM_STYLE
+ {
+ #if defined(EA_PROCESSOR_X86)
+ #if defined(EA_ASM_STYLE_ATT)
+ asm volatile ("nop");
+ #elif defined(EA_ASM_STYLE_INTEL)
+ __asm nop
+ #endif
+ #else
+ // Add other processors here.
+ #endif
+ }
+
+
+ return nErrorCount;
+}
+
+
+
+// Test compiler limitations
+// Easiest way to come up with tests for some of the more complicated versions
+// of these is to look at the Boost /libs/config/test/*.cxx files. Many of the
+// Boost compiler limitation defines are similar or match exactly to those
+// defined by EABase. See http://www.boost.org if you want to check this out.
+
+#ifndef EA_COMPILER_NO_STATIC_CONSTANTS // If class member static constants are allowed...
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATES
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATE_SPECIALIZATION
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_TEMPLATE_TEMPLATES
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_MEMBER_TEMPLATE_FRIENDS
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_VOID_RETURNS
+#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_DEDUCED_TYPENAME
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_ARGUMENT_DEPENDENT_LOOKUP
+ // Todo
+#endif
+
+// Not applicable to C:
+//#ifndef EA_COMPILER_NO_STANDARD_CPP_LIBRARY
+// #include <vector>
+//#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_COVARIANT_RETURN_TYPE
+ // Todo
+#endif
+
+#ifndef EA_COMPILER_NO_VARIADIC_MACROS
+ #define MY_PRINTF(format, ...) Printf(format, __VA_ARGS__)
+#endif
+
+
+
+
+int TestEACompiler(void)
+{
+ int nErrorCount = 0;
+
+ #if 0
+
+ // 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
+
+
+ // Test EA_COMPILER_NAME
+ {
+ #ifdef EA_COMPILER_NAME
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_NAME: %s\n", EA_COMPILER_NAME);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_NAME test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_VERSION
+ {
+ #ifdef EA_COMPILER_VERSION
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_VERSION: %d\n", EA_COMPILER_VERSION);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_VERSION test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_STRING
+ {
+ #ifdef EA_COMPILER_STRING
+ char buffer[256];
+ sprintf(buffer, "TestEACompiler: EA_COMPILER_STRING: %s\n", EA_COMPILER_STRING);
+ #else
+ DoError(nErrorCount, "EA_COMPILER_STRING test");
+ #endif
+ }
+
+
+ // Test EA_COMPILER_NO_STATIC_CONSTANTS
+ {
+ char buffer[256];
+ sprintf(buffer, "%d", (int)NSC::x);
+ if(buffer[0] != '1')
+ DoError(nErrorCount, "EA_COMPILER_NO_STATIC_CONSTANTS test");
+ }
+
+
+ // Test EA_COMPILER_NO_VOID_RETURNS
+ #ifndef EA_COMPILER_NO_VOID_RETURNS
+ TestNVR1(); // Nothing to test for except successful compilation.
+ #endif
+
+
+ // Test EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE
+ #ifndef EA_COMPILER_NO_EXCEPTION_STD_NAMESPACE
+ TestNESN();
+ #endif
+
+
+ // Test EA_COMPILER_NO_EXCEPTIONS
+ #ifndef EA_COMPILER_NO_EXCEPTIONS
+ if(!TestNE())
+ DoError(nErrorCount, "EA_COMPILER_NO_EXCEPTIONS test");
+ #endif
+
+
+ // Test EA_COMPILER_NO_UNWIND
+ if(!TestNU())
+ DoError(nErrorCount, "EA_COMPILER_NO_UNWIND test");
+
+ #endif
+
+ return nErrorCount;
+}
+
+
+int TestEACompilerTraits(void)
+{
+ int nErrorCount = 0;
+
+ // EA_COMPILER_IS_ANSIC
+ // EA_COMPILER_IS_C99
+ // EA_COMPILER_IS_CPLUSPLUS
+ // EA_COMPILER_MANAGED_CPP
+
+ { // Test EA_ALIGN_OF
+ typedef void (*AlignTestFunctionType)(void);
+ if(EA_ALIGN_OF(AlignTestFunctionType) != sizeof(void*)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (AlignTestFunctionType)");
+
+ if(EA_ALIGN_OF(int8_t) != sizeof(int8_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int16_t)");
+
+ if(EA_ALIGN_OF(int16_t) != sizeof(int16_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int16_t)");
+
+ if(EA_ALIGN_OF(int32_t) != sizeof(int32_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int32_t)");
+
+ #if !defined (EA_ABI_ARM_APPLE)
+ if(EA_ALIGN_OF(int64_t) != sizeof(int64_t)) // This may not be a kosher test.
+ DoError(nErrorCount, "EA_ALIGN_OF test (int64_t)");
+ #endif
+ }
+
+ { // Test EA_PREFIX_ALIGN
+ #ifdef EA_PREFIX_ALIGN
+ char buffer[32];
+ EA_PREFIX_ALIGN(64) int x = 0;
+ sprintf(buffer, "%d", x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_PREFIX_ALIGN test");
+
+ #if defined(__cplusplus)
+ EA_PREFIX_ALIGN(64) ClassWithDefaultCtor cdcA;
+ //EA_PREFIX_ALIGN(64) ClassWithoutDefaultCtor cwdcA;
+
+ EA_PREFIX_ALIGN(64) ClassWithDefaultCtor cdcB(3);
+ EA_PREFIX_ALIGN(64) ClassWithoutDefaultCtor cwdcB(3);
+ #endif
+
+ #else
+ DoError(nErrorCount, "EA_PREFIX_ALIGN test");
+ #endif
+ }
+
+
+ { // Test EA_POSTFIX_ALIGN
+ #ifdef EA_POSTFIX_ALIGN
+ char buffer[32];
+ int x EA_POSTFIX_ALIGN(ALIGNMENT_AMOUNT_64) = 0;
+ sprintf(buffer, "%d", x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_POSTFIX_ALIGN test");
+ #else
+ DoError(nErrorCount, "EA_POSTFIX_ALIGN test");
+ #endif
+ }
+
+
+ { // Test EA_ALIGNED
+ #ifdef EA_ALIGNED
+ char buffer[32];
+
+ // Verify that a simple declaration works.
+ EA_ALIGNED(int, xA, ALIGNMENT_AMOUNT_64);
+
+ // Verify that a declaration with assignment works.
+ EA_ALIGNED(int, xB, ALIGNMENT_AMOUNT_64) = 0;
+
+ // Verify that a typedefd declaration works.
+ typedef EA_ALIGNED(int, int16, ALIGNMENT_AMOUNT_16);
+ int16 n16 = 0;
+
+ // Verify that a declaration with construction works.
+ #if defined(__cplusplus)
+ EA_ALIGNED(int, xC, ALIGNMENT_AMOUNT_64)(0);
+ #endif
+
+ xA = 0;
+ sprintf(buffer, "%d", xA);
+ sprintf(buffer, "%d", xB);
+ sprintf(buffer, "%p", &n16);
+ #if defined(__cplusplus)
+ sprintf(buffer, "%d", xC);
+ #endif
+
+ #if defined(__cplusplus)
+ // Verify that the following tests compile. These tests are here
+ // because the SN compiler (EDG front-end) has some problems with
+ // GCC compatibility related to the 'aligned' __attribute__.
+ ClassWithDefaultCtor cdc;
+ ClassWithoutDefaultCtor cwdc(3);
+ sprintf(buffer, "%p%p", &cdc, &cwdc);
+
+ // Verify that regular usage of EA_ALIGNED works.
+ EA_ALIGNED(ClassWithDefaultCtor, cdc16A, ALIGNMENT_AMOUNT_16);
+ //EA_ALIGNED(ClassWithoutDefaultCtor, cwdcA, 16); // Doesn't have a default ctor, so this can't be done.
+ sprintf(buffer, "%p%p", &cdc16A, (void*)NULL);
+
+ // Verify that argument usage of EA_ALIGNED works.
+ EA_ALIGNED(ClassWithDefaultCtor, cdcB, ALIGNMENT_AMOUNT_16)(3);
+ EA_ALIGNED(ClassWithoutDefaultCtor, cwdcB, ALIGNMENT_AMOUNT_16)(3);
+ sprintf(buffer, "%p%p", &cdcB, &cwdcB);
+
+ // Verify that usage of EA_ALIGNED works within a typedef.
+ typedef EA_ALIGNED(ClassWithDefaultCtor, ClassWithDefaultCtor16, ALIGNMENT_AMOUNT_16);
+ ClassWithDefaultCtor16 cdcC(3);
+ typedef EA_ALIGNED(ClassWithoutDefaultCtor, ClassWithoutDefaultCtor16, ALIGNMENT_AMOUNT_16);
+ ClassWithoutDefaultCtor16 cwdcC(3);
+ sprintf(buffer, "%p%p", &cdcC, &cwdcC);
+ #endif
+ #else
+ DoError(nErrorCount, "EA_ALIGNED test");
+ #endif
+ }
+
+
+ { // Test EA_PACKED
+ #if defined(__cplusplus)
+ #ifdef EA_PACKED
+ char buffer[32];
+ struct X { int x; } EA_PACKED;
+ X x = { 0 };
+ sprintf(buffer, "%d", x.x);
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_PACKED test");
+ #else
+ DoError(nErrorCount, "EA_PACKED test");
+ #endif
+ #endif
+ }
+
+
+ { // Test EA_LIKELY
+
+ if(EA_UNLIKELY(nErrorCount > 0))
+ {
+ if(EA_LIKELY(nErrorCount == 999999)) // Actually this isn't likely, but that's beside the point.
+ DoError(nErrorCount, "EA_LIKELY test");
+ }
+ }
+
+
+
+ { // Test EA_ASSUME
+ switch (nErrorCount / (nErrorCount + 1))
+ {
+ case 0:
+ Stricmp("nop0", "nop0");
+ break;
+ case 1:
+ Stricmp("nop1", "nop1");
+ break;
+ default:
+ EA_ASSUME(0);
+ }
+ }
+
+
+ { // Test EA_PURE
+ if(!PureFunction())
+ DoError(nErrorCount, "EA_PURE test");
+ }
+
+
+ { // Test EA_WCHAR_SIZE
+ EA_DISABLE_VC_WARNING(6326)
+ #ifdef EA_WCHAR_SIZE
+ if((EA_WCHAR_SIZE != 1) && (EA_WCHAR_SIZE != 2) && (EA_WCHAR_SIZE != 4))
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #else
+ DoError(nErrorCount, "EA_WCHAR_SIZE test");
+ #endif
+ EA_RESTORE_VC_WARNING()
+ }
+
+
+ { // Test EA_RESTRICT
+ char* p = NULL;
+ if(RestrictTest(p) == 0) // This isn't a real test. If there is a failure, it will happen at compile time.
+ DoError(nErrorCount, "EA_RESTRICT test");
+ }
+
+
+ { // Test EA_DEPRECATED
+ /* This causes warnings on compilers, so just disable it.
+ #if defined(EA_DEPRECATED) && (!defined(__GNUC__) || ((__GNUC__ * 100 + __GNUC_MINOR__) < 402)) // GCC 4.2+ is converting deprecated into an error instead of a warning.
+ char buffer[32];
+ EA_DEPRECATED int x = 0;
+ sprintf(buffer, "%d", x); (void)x;
+ if(buffer[0] != '0')
+ DoError(nErrorCount, "EA_DEPRECATED test");
+ #else
+ DoError(nErrorCount, "EA_DEPRECATED test");
+ #endif
+ */
+ }
+
+
+ { // Test EA_PASCAL
+ #if defined(__cplusplus)
+ #ifdef EA_PASCAL
+ struct X{ void EA_PASCAL DoNothing(void){} };
+ X x;
+ x.DoNothing();
+ #else
+ DoError(nErrorCount, "EA_PASCAL test");
+ #endif
+ #endif
+ }
+
+
+ { // Test EA_PASCAL_FUNC
+ #if defined(__cplusplus)
+ #ifdef EA_PASCAL_FUNC
+ struct X{ void EA_PASCAL_FUNC(DoNothing()){} };
+ X x;
+ x.DoNothing();
+ #else
+ DoError(nErrorCount, "EA_PASCAL_FUNC test");
+ #endif
+ #endif
+ }
+
+
+ // EA_SSE
+ // Not sure how to properly test at this time.
+
+
+ { // EA_IMPORT
+ // Not possible to do this because import means it will come from outside.
+ //struct X{ EA_IMPORT void DoNothing(){} };
+ //X x;
+ //x.DoNothing();
+ }
+
+
+ { // EA_EXPORT
+ #if defined(__cplusplus)
+ struct X{ EA_EXPORT void DoNothing(){} };
+ X x;
+ x.DoNothing();
+ #endif
+ }
+
+
+ // EA_PREPROCESSOR_JOIN
+ // EA_STRINGIFY
+ {
+ char buffer[32];
+ char bufferExpected[32];
+ const int line = (__LINE__ + 2);
+
+ sprintf(buffer, "%s %s", EA_STRINGIFY(EA_PREPROCESSOR_JOIN(test_, __LINE__)), EA_STRINGIFY(__LINE__));
+ sprintf(bufferExpected, "test_%d %d", line, line);
+
+ if(strcmp(buffer, bufferExpected) != 0)
+ DoError(nErrorCount, "EA_PREPROCESSOR_JOIN/EA_STRINGIFY test");
+ }
+
+
+ { // EAArrayCount
+ const int testArray[13] = { 0 };
+ const size_t arrayCount = EAArrayCount(testArray);
+
+ if((arrayCount != 13) || (testArray[0] != 0))
+ DoError(nErrorCount, "EAArrayCount test");
+ }
+
+ { // static_assert
+
+ // Should succeed.
+ static_assert(sizeof(int32_t) == 4, "static_assert failure");
+
+ // Should fail.
+ //static_assert(sizeof(int32_t) == 8, "static_assert failure");
+ }
+
+ { // EA_OPTIMIZE_OFF / EA_OPTIMIZE_ON
+ int result = DisabledOptimizations(2);
+
+ if(result != 2*37)
+ DoError(nErrorCount, "EA_OPTIMIZE_OFF test");
+ }
+
+ { // EA_UNUSED
+ FunctionWithUnusedVariables(3);
+ }
+
+ return nErrorCount;
+}
+
+
+//
+// Tests for EA_IS_ENABLED
+//
+#define EABASE_TEST_FEATURE_A EA_ENABLED
+#if EA_IS_ENABLED(EABASE_TEST_FEATURE_A)
+ // Feature A is enabled
+#else
+ #error Error EABASE_TEST_FEATURE_A should be enabled.
+#endif
+// Make sure it is possible to successfully negate the test.
+#if !EA_IS_ENABLED(EABASE_TEST_FEATURE_A)
+ #error Error EABASE_TEST_FEATURE_A should be enabled.
+#endif
+
+#define EABASE_TEST_FEATURE_B EA_DISABLED
+#if EA_IS_ENABLED(EABASE_TEST_FEATURE_B)
+ #error Error EABASE_TEST_FEATURE_B should be disabled.
+#endif
+// Make sure it is possible to successfully negate the test.
+#if !EA_IS_ENABLED(EABASE_TEST_FEATURE_B)
+ // Feature B is not enabled
+#else
+ #error Error EABASE_TEST_FEATURE_B should be disabled.
+#endif
+
+// The test below should cause compilation to fail if it is uncommented. However we can't
+// obviously enable the test because it will break the build. It should be tested manually
+// if changes to EA_IS_ENABLED are made.
+//
+// #if EA_IS_ENABLED(EABASE_TEST_FEATURE_WITH_NO_DEFINE)
+// #endif
+
+
+int EAMain(int argc, char** argv)
+{
+ int nErrorCount = 0, nTotalErrorCount = 0;
+
+ (void)argc;
+ (void)argv;
+
+ nErrorCount = TestEABase();
+ Printf("EABase test error count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEAPlatform();
+ Printf("EAPlatform test error count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEACompiler();
+ Printf("EACompiler test error count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ nErrorCount = TestEACompilerTraits();
+ Printf("EACompilerTraits test error count: %d\n\n", nErrorCount);
+ nTotalErrorCount += nErrorCount;
+
+ if (nTotalErrorCount == 0)
+ Printf("\nAll tests completed successfully.\n");
+ else
+ Printf("\nTests failed. Total error count: %d\n", nTotalErrorCount);
+
+ return nTotalErrorCount;
+}
diff --git a/EASTL/test/packages/EABase/test/source/TestEABaseSeparate.cpp b/EASTL/test/packages/EABase/test/source/TestEABaseSeparate.cpp
new file mode 100644
index 0000000..ca709a0
--- /dev/null
+++ b/EASTL/test/packages/EABase/test/source/TestEABaseSeparate.cpp
@@ -0,0 +1,34 @@
+// The purpose of this compilation unit is to test EABase in the absence of other system headers.
+// For example TestEABase.cpp directly includes system headers like ctype.h, stddef.h, stdarg, etc.
+// However, these headers make it impossible to verify that certain definitions are being provided
+// by EABase instead of the system headers being included directly.
+
+#include <EABase/eabase.h>
+
+// This structure tests that EABase types are properly defined.
+struct EABaseDefinedTypesStruct
+{
+ char8_t mChar8_t;
+ char16_t mChar16_t;
+ char32_t mChar32_t;
+ wchar_t mWchar_t;
+ bool8_t mBool8_t;
+ int8_t mInt8_t;
+ int16_t mInt16_t;
+ int32_t mInt32_t;
+ int64_t mInt64_t;
+ uint8_t mUint8_t;
+ uint16_t mUint16_t;
+ uint32_t mUint32_t;
+ uint64_t mUint64_t;
+ intmax_t mIntmax_t;
+ uintmax_t mUintmax_t;
+ size_t mSize_t;
+ ssize_t mSsize_t;
+ float_t mFloat_t;
+ double_t mDouble_t;
+ intptr_t mIntptr_t;
+ uintptr_t mUintptr_t;
+ ptrdiff_t mPtrdiff_t;
+};
+