89 #ifndef INCLUDED_eacompilertraits_H
90 #define INCLUDED_eacompilertraits_H
92 #include <EABase/config/eaplatform.h>
93 #include <EABase/config/eacompiler.h>
102 #if defined(__STDC__)
103 #define EA_COMPILER_IS_ANSIC 1
115 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
116 #define EA_COMPILER_IS_C99 1
124 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
125 #define EA_COMPILER_IS_C11 1
133 #if (defined(__USE_ISOC99) || (defined(_MSL_C99) && (_MSL_C99 == 1))) && !defined(EA_COMPILER_IS_C99)
134 #define EA_COMPILER_IS_C99 1
138 #if (defined(_MSL_C99) && (_MSL_C99 == 1))
139 #define EA_COMPILER_HAS_C99_TYPES 1
142 #if defined(__GNUC__)
143 #if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 302)
144 #define EA_COMPILER_HAS_C99_TYPES 1
146 #ifndef __STDC_LIMIT_MACROS
147 #define __STDC_LIMIT_MACROS 1
150 #ifndef __STDC_CONSTANT_MACROS
151 #define __STDC_CONSTANT_MACROS 1
156 #if defined(_MSC_VER) && (_MSC_VER >= 1600)
157 #define EA_COMPILER_HAS_C99_TYPES 1
161 #define EA_COMPILER_IS_CPLUSPLUS 1
183 #ifndef EA_PREPROCESSOR_JOIN
184 #define EA_PREPROCESSOR_JOIN(a, b) EA_PREPROCESSOR_JOIN1(a, b)
185 #define EA_PREPROCESSOR_JOIN1(a, b) EA_PREPROCESSOR_JOIN2(a, b)
186 #define EA_PREPROCESSOR_JOIN2(a, b) a##b
197 #define EA_STRINGIFY(x) EA_STRINGIFYIMPL(x)
198 #define EA_STRINGIFYIMPL(x) #x
206 #define EA_IDENTITY(x) x
213 #ifdef EA_COMPILER_MSVC
214 #if EA_COMPILER_VERSION >= 1300
216 #define EA_COMPILER_MANAGED_CPP 1
229 #if defined(__GNUC__) && defined(__x86_64__)
230 #define EA_COMPILER_INTMAX_SIZE 16
232 #define EA_COMPILER_INTMAX_SIZE 8
248 #define EA_LPAREN() (
251 #define EA_RPAREN() )
279 #if defined(__GNUC__)
280 #define EA_OFFSETOF(struct_, member_) ((size_t)(((uintptr_t)&reinterpret_cast<const volatile char&>((((struct_*)65536)->member_))) - 65536))
282 #define EA_OFFSETOF(struct_, member_) offsetof(struct_, member_)
297 #ifndef EA_COMPILER_NO_EXTENDED_SIZEOF
298 #define EA_SIZEOF_MEMBER(struct_, member_) (sizeof(struct_::member_))
300 #define EA_SIZEOF_MEMBER(struct_, member_) (sizeof(((struct_*)0)->member_))
338 #if !defined(EA_ALIGN_MAX)
339 #if defined(EA_PROCESSOR_ARM)
340 #define EA_ALIGN_MAX_STATIC 1048576
341 #define EA_ALIGN_MAX_AUTOMATIC 1
342 #elif defined(EA_PLATFORM_APPLE)
343 #define EA_ALIGN_MAX_STATIC 1048576
344 #define EA_ALIGN_MAX_AUTOMATIC 16
346 #define EA_ALIGN_MAX_STATIC 1048576
347 #define EA_ALIGN_MAX_AUTOMATIC 1048576
356 #if defined(__GNUC__) && (__GNUC__ < 3)
357 #define EA_ALIGN_OF(type) ((size_t)__alignof__(type))
359 #define EA_PREFIX_ALIGN(n)
360 #define EA_POSTFIX_ALIGN(n) __attribute__((aligned(n)))
361 #define EA_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((aligned(n)))
362 #define EA_PACKED __attribute__((packed))
365 #elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__xlC__) || defined(__clang__)
366 #define EA_ALIGN_OF(type) ((size_t)__alignof__(type))
367 #define EA_ALIGN(n) __attribute__((aligned(n)))
368 #define EA_PREFIX_ALIGN(n)
369 #define EA_POSTFIX_ALIGN(n) __attribute__((aligned(n)))
370 #define EA_ALIGNED(variable_type, variable, n) variable_type variable __attribute__((aligned(n)))
371 #define EA_PACKED __attribute__((packed))
375 #elif defined(EA_COMPILER_INTEL) || defined(CS_UNDEFINED_STRING) || (defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1300))
376 #define EA_ALIGN_OF(type) ((size_t)__alignof(type))
377 #define EA_ALIGN(n) __declspec(align(n))
378 #define EA_PREFIX_ALIGN(n) EA_ALIGN(n)
379 #define EA_POSTFIX_ALIGN(n)
380 #define EA_ALIGNED(variable_type, variable, n) EA_ALIGN(n) variable_type variable
384 #elif defined(EA_COMPILER_ARM)
385 #define EA_ALIGN_OF(type) ((size_t)__ALIGNOF__(type))
386 #define EA_ALIGN(n) __align(n)
387 #define EA_PREFIX_ALIGN(n) __align(n)
388 #define EA_POSTFIX_ALIGN(n)
389 #define EA_ALIGNED(variable_type, variable, n) __align(n) variable_type variable
390 #define EA_PACKED __packed
398 #define EA_PREFIX_ALIGN(n)
399 #define EA_POSTFIX_ALIGN(n)
400 #define EA_ALIGNED(variable_type, variable, n) variable_type variable
404 template <
typename T>
struct EAAlignOf1 {
enum { s =
sizeof (T), value = s ^ (s & (s - 1)) }; };
405 template <
typename T>
struct EAAlignOf2;
406 template <
int size_diff>
struct helper {
template <
typename T>
struct Val {
enum { value = size_diff }; }; };
407 template <>
struct helper<0> {
template <
typename T>
struct Val {
enum { value = EAAlignOf2<T>::value }; }; };
408 template <
typename T>
struct EAAlignOf2 {
struct Big { T x;
char c; };
409 enum { diff =
sizeof (Big) -
sizeof (T), value = helper<diff>::template Val<Big>::value }; };
410 template <
typename T>
struct EAAlignof3 {
enum { x = EAAlignOf2<T>::value, y = EAAlignOf1<T>::value, value = x < y ? x : y }; };
411 #define EA_ALIGN_OF(type) ((size_t)EAAlignof3<type>::value)
418 #define EA_ALIGN_OF(type) ((size_t)offsetof(struct { char c; type m; }, m))
431 #if !defined(EA_PRAGMA_PACK_VC)
432 #if defined(EA_COMPILER_MSVC)
433 #define EA_PRAGMA_PACK_VC(...) __pragma(pack(__VA_ARGS__))
434 #elif !defined(EA_COMPILER_NO_VARIADIC_MACROS)
435 #define EA_PRAGMA_PACK_VC(...)
463 #if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__)
464 #if defined(__cplusplus)
465 #define EA_LIKELY(x) __builtin_expect(!!(x), true)
466 #define EA_UNLIKELY(x) __builtin_expect(!!(x), false)
468 #define EA_LIKELY(x) __builtin_expect(!!(x), 1)
469 #define EA_UNLIKELY(x) __builtin_expect(!!(x), 0)
472 #define EA_LIKELY(x) (x)
473 #define EA_UNLIKELY(x) (x)
490 #if !defined(EA_HAS_INCLUDE_AVAILABLE)
491 #if EA_COMPILER_CPP17_ENABLED || EA_COMPILER_CLANG || EA_COMPILER_GNUC
492 #define EA_HAS_INCLUDE_AVAILABLE 1
494 #define EA_HAS_INCLUDE_AVAILABLE 0
517 #if !defined(EA_HAS_INCLUDE)
518 #if EA_COMPILER_CPP17_ENABLED
519 #define EA_HAS_INCLUDE(x) __has_include(x)
520 #elif EA_COMPILER_CLANG
521 #define EA_HAS_INCLUDE(x) __has_include(x)
522 #elif EA_COMPILER_GNUC
523 #define EA_HAS_INCLUDE(x) __has_include(x)
534 #if !defined(EA_INIT_PRIORITY_AVAILABLE)
535 #if defined(__GNUC__) && !defined(__EDG__)
536 #define EA_INIT_PRIORITY_AVAILABLE 1
537 #elif defined(__clang__)
538 #define EA_INIT_PRIORITY_AVAILABLE 1
553 #if !defined(EA_INIT_PRIORITY)
554 #if defined(EA_INIT_PRIORITY_AVAILABLE)
555 #define EA_INIT_PRIORITY(x) __attribute__ ((init_priority (x)))
557 #define EA_INIT_PRIORITY(x)
566 #if !defined(EA_INIT_SEG_AVAILABLE)
567 #if defined(_MSC_VER)
568 #define EA_INIT_SEG_AVAILABLE 1
584 #if !defined(EA_INIT_SEG)
585 #if defined(EA_INIT_SEG_AVAILABLE)
586 #define EA_INIT_SEG(x) \
587 __pragma(warning(push)) __pragma(warning(disable : 4074)) __pragma(warning(disable : 4075)) __pragma(init_seg(x)) \
588 __pragma(warning(pop))
590 #define EA_INIT_SEG(x)
603 #ifndef EA_MAY_ALIAS_AVAILABLE
604 #if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
605 #if !defined(__EDG__)
606 #define EA_MAY_ALIAS_AVAILABLE 2
608 #define EA_MAY_ALIAS_AVAILABLE 0
611 #define EA_MAY_ALIAS_AVAILABLE 0
630 #if EA_MAY_ALIAS_AVAILABLE
631 #define EA_MAY_ALIAS __attribute__((__may_alias__))
659 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
660 #define EA_ASSUME(x) __assume(x)
681 #ifndef EA_ANALYSIS_ASSUME
682 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
683 #define EA_ANALYSIS_ASSUME(x) __analysis_assume(!!(x))
685 #define EA_ANALYSIS_ASSUME(x)
704 #ifndef EA_DISABLE_VC_WARNING
705 #if defined(_MSC_VER)
706 #define EA_DISABLE_VC_WARNING(w) \
707 __pragma(warning(push)) \
708 __pragma(warning(disable:w))
710 #define EA_DISABLE_VC_WARNING(w)
714 #ifndef EA_RESTORE_VC_WARNING
715 #if defined(_MSC_VER)
716 #define EA_RESTORE_VC_WARNING() \
717 __pragma(warning(pop))
719 #define EA_RESTORE_VC_WARNING()
737 #ifndef EA_ENABLE_VC_WARNING_AS_ERROR
738 #if defined(_MSC_VER)
739 #define EA_ENABLE_VC_WARNING_AS_ERROR(w) \
740 __pragma(warning(push)) \
741 __pragma(warning(error:w))
743 #define EA_ENABLE_VC_WARNING_AS_ERROR(w)
747 #ifndef EA_DISABLE_VC_WARNING_AS_ERROR
748 #if defined(_MSC_VER)
749 #define EA_DISABLE_VC_WARNING_AS_ERROR() \
750 __pragma(warning(pop))
752 #define EA_DISABLE_VC_WARNING_AS_ERROR()
768 #ifndef EA_DISABLE_GCC_WARNING
769 #if defined(EA_COMPILER_GNUC)
770 #define EAGCCWHELP0(x) #x
771 #define EAGCCWHELP1(x) EAGCCWHELP0(GCC diagnostic ignored x)
772 #define EAGCCWHELP2(x) EAGCCWHELP1(#x)
775 #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
776 #define EA_DISABLE_GCC_WARNING(w) \
777 _Pragma("GCC diagnostic push") \
778 _Pragma(EAGCCWHELP2(w))
779 #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
780 #define EA_DISABLE_GCC_WARNING(w) \
781 _Pragma(EAGCCWHELP2(w))
783 #define EA_DISABLE_GCC_WARNING(w)
787 #ifndef EA_RESTORE_GCC_WARNING
788 #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
789 #define EA_RESTORE_GCC_WARNING() \
790 _Pragma("GCC diagnostic pop")
792 #define EA_RESTORE_GCC_WARNING()
818 #ifndef EA_ENABLE_GCC_WARNING_AS_ERROR
819 #if defined(EA_COMPILER_GNUC)
820 #define EAGCCWERRORHELP0(x) #x
821 #define EAGCCWERRORHELP1(x) EAGCCWERRORHELP0(GCC diagnostic error x)
822 #define EAGCCWERRORHELP2(x) EAGCCWERRORHELP1(#x)
825 #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
826 #define EA_ENABLE_GCC_WARNING_AS_ERROR(w) \
827 _Pragma("GCC diagnostic push") \
828 _Pragma(EAGCCWERRORHELP2(w))
829 #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4004)
830 #define EA_DISABLE_GCC_WARNING(w) \
831 _Pragma(EAGCCWERRORHELP2(w))
833 #define EA_DISABLE_GCC_WARNING(w)
837 #ifndef EA_DISABLE_GCC_WARNING_AS_ERROR
838 #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION >= 4006)
839 #define EA_DISABLE_GCC_WARNING_AS_ERROR() \
840 _Pragma("GCC diagnostic pop")
842 #define EA_DISABLE_GCC_WARNING_AS_ERROR()
858 #ifndef EA_DISABLE_CLANG_WARNING
859 #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
860 #define EACLANGWHELP0(x) #x
861 #define EACLANGWHELP1(x) EACLANGWHELP0(clang diagnostic ignored x)
862 #define EACLANGWHELP2(x) EACLANGWHELP1(#x)
864 #define EA_DISABLE_CLANG_WARNING(w) \
865 _Pragma("clang diagnostic push") \
866 _Pragma(EACLANGWHELP2(-Wunknown-warning-option))\
867 _Pragma(EACLANGWHELP2(w))
869 #define EA_DISABLE_CLANG_WARNING(w)
873 #ifndef EA_RESTORE_CLANG_WARNING
874 #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
875 #define EA_RESTORE_CLANG_WARNING() \
876 _Pragma("clang diagnostic pop")
878 #define EA_RESTORE_CLANG_WARNING()
901 #ifndef EA_ENABLE_CLANG_WARNING_AS_ERROR
902 #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
903 #define EACLANGWERRORHELP0(x) #x
904 #define EACLANGWERRORHELP1(x) EACLANGWERRORHELP0(clang diagnostic error x)
905 #define EACLANGWERRORHELP2(x) EACLANGWERRORHELP1(#x)
907 #define EA_ENABLE_CLANG_WARNING_AS_ERROR(w) \
908 _Pragma("clang diagnostic push") \
909 _Pragma(EACLANGWERRORHELP2(w))
911 #define EA_DISABLE_CLANG_WARNING(w)
915 #ifndef EA_DISABLE_CLANG_WARNING_AS_ERROR
916 #if defined(EA_COMPILER_CLANG) || defined(EA_COMPILER_CLANG_CL)
917 #define EA_DISABLE_CLANG_WARNING_AS_ERROR() \
918 _Pragma("clang diagnostic pop")
920 #define EA_DISABLE_CLANG_WARNING_AS_ERROR()
941 #ifndef EA_DISABLE_SN_WARNING
942 #define EA_DISABLE_SN_WARNING(w)
945 #ifndef EA_RESTORE_SN_WARNING
946 #define EA_RESTORE_SN_WARNING()
958 #ifndef EA_DISABLE_ALL_SN_WARNINGS
959 #define EA_DISABLE_ALL_SN_WARNINGS()
962 #ifndef EA_RESTORE_ALL_SN_WARNINGS
963 #define EA_RESTORE_ALL_SN_WARNINGS()
980 #ifndef EA_DISABLE_GHS_WARNING
981 #define EA_DISABLE_GHS_WARNING(w)
984 #ifndef EA_RESTORE_GHS_WARNING
985 #define EA_RESTORE_GHS_WARNING()
1023 #ifndef EA_DISABLE_EDG_WARNING
1025 #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_INTEL) && !defined(EA_COMPILER_RVCT)
1026 #define EAEDGWHELP0(x) #x
1027 #define EAEDGWHELP1(x) EAEDGWHELP0(diag_suppress x)
1029 #define EA_DISABLE_EDG_WARNING(w) \
1030 _Pragma("control %push diag") \
1031 _Pragma(EAEDGWHELP1(w))
1033 #define EA_DISABLE_EDG_WARNING(w)
1037 #ifndef EA_RESTORE_EDG_WARNING
1038 #if defined(EA_COMPILER_EDG) && !defined(EA_COMPILER_INTEL) && !defined(EA_COMPILER_RVCT)
1039 #define EA_RESTORE_EDG_WARNING() \
1040 _Pragma("control %pop diag")
1042 #define EA_RESTORE_EDG_WARNING()
1085 #ifndef EA_DISABLE_CW_WARNING
1086 #define EA_DISABLE_CW_WARNING(w)
1089 #ifndef EA_RESTORE_CW_WARNING
1091 #define EA_RESTORE_CW_WARNING(w)
1099 #ifndef EA_DISABLE_ALL_CW_WARNINGS
1100 #define EA_DISABLE_ALL_CW_WARNINGS()
1104 #ifndef EA_RESTORE_ALL_CW_WARNINGS
1105 #define EA_RESTORE_ALL_CW_WARNINGS()
1129 #if defined(EA_COMPILER_GNUC)
1130 #define EA_PURE __attribute__((pure))
1131 #elif defined(EA_COMPILER_ARM)
1132 #define EA_PURE __pure
1160 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
1161 #define EA_WEAK __declspec(selectany)
1162 #define EA_WEAK_SUPPORTED 1
1163 #elif defined(_MSC_VER) || (defined(__GNUC__) && defined(__CYGWIN__))
1165 #define EA_WEAK_SUPPORTED 0
1166 #elif defined(EA_COMPILER_ARM)
1167 #define EA_WEAK __weak
1168 #define EA_WEAK_SUPPORTED 1
1170 #define EA_WEAK __attribute__((weak))
1171 #define EA_WEAK_SUPPORTED 1
1194 #if defined(__cplusplus) && defined(__EDG__)
1195 template <
typename T>
1196 inline void EABaseUnused(T
const volatile & x) { (void)x; }
1197 #define EA_UNUSED(x) EABaseUnused(x)
1199 #define EA_UNUSED(x) (void)x
1218 #define EA_EMPTY (void)0
1237 #ifndef EA_CURRENT_FUNCTION
1238 #if defined __GNUC__ || (defined __ICC && __ICC >= 600)
1239 #define EA_CURRENT_FUNCTION __PRETTY_FUNCTION__
1240 #elif defined(__FUNCSIG__)
1241 #define EA_CURRENT_FUNCTION __FUNCSIG__
1242 #elif (defined __INTEL_COMPILER && __INTEL_COMPILER >= 600) || (defined __IBMCPP__ && __IBMCPP__ >= 500) || (defined CS_UNDEFINED_STRING && CS_UNDEFINED_STRING >= 0x4200)
1243 #define EA_CURRENT_FUNCTION __FUNCTION__
1244 #elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901
1245 #define EA_CURRENT_FUNCTION __func__
1247 #define EA_CURRENT_FUNCTION "(unknown function)"
1258 #ifndef EA_WCHAR_T_NON_NATIVE
1265 #if defined(EA_COMPILER_INTEL)
1266 #if (EA_COMPILER_VERSION < 700)
1267 #define EA_WCHAR_T_NON_NATIVE 1
1269 #if (!defined(_WCHAR_T_DEFINED) && !defined(_WCHAR_T))
1270 #define EA_WCHAR_T_NON_NATIVE 1
1273 #elif defined(EA_COMPILER_MSVC) || (defined(EA_COMPILER_CLANG) && defined(EA_PLATFORM_WINDOWS))
1274 #ifndef _NATIVE_WCHAR_T_DEFINED
1275 #define EA_WCHAR_T_NON_NATIVE 1
1277 #elif defined(__EDG_VERSION__) && (!defined(_WCHAR_T) && (__EDG_VERSION__ < 400))
1278 #define EA_WCHAR_T_NON_NATIVE 1
1282 #ifndef EA_WCHAR_SIZE
1283 #if defined(__WCHAR_MAX__)
1284 #if (__WCHAR_MAX__ == 2147483647) || (__WCHAR_MAX__ == 4294967295)
1285 #define EA_WCHAR_SIZE 4
1286 #elif (__WCHAR_MAX__ == 32767) || (__WCHAR_MAX__ == 65535)
1287 #define EA_WCHAR_SIZE 2
1288 #elif (__WCHAR_MAX__ == 127) || (__WCHAR_MAX__ == 255)
1289 #define EA_WCHAR_SIZE 1
1291 #define EA_WCHAR_SIZE 4
1293 #elif defined(WCHAR_MAX)
1294 #if (WCHAR_MAX == 2147483647) || (WCHAR_MAX == 4294967295)
1295 #define EA_WCHAR_SIZE 4
1296 #elif (WCHAR_MAX == 32767) || (WCHAR_MAX == 65535)
1297 #define EA_WCHAR_SIZE 2
1298 #elif (WCHAR_MAX == 127) || (WCHAR_MAX == 255)
1299 #define EA_WCHAR_SIZE 1
1301 #define EA_WCHAR_SIZE 4
1303 #elif defined(__WCHAR_BIT)
1304 #if (__WCHAR_BIT == 16)
1305 #define EA_WCHAR_SIZE 2
1306 #elif (__WCHAR_BIT == 32)
1307 #define EA_WCHAR_SIZE 4
1308 #elif (__WCHAR_BIT == 8)
1309 #define EA_WCHAR_SIZE 1
1311 #define EA_WCHAR_SIZE 4
1313 #elif defined(_WCMAX)
1314 #if (_WCMAX == 2147483647) || (_WCMAX == 4294967295)
1315 #define EA_WCHAR_SIZE 4
1316 #elif (_WCMAX == 32767) || (_WCMAX == 65535)
1317 #define EA_WCHAR_SIZE 2
1318 #elif (_WCMAX == 127) || (_WCMAX == 255)
1319 #define EA_WCHAR_SIZE 1
1321 #define EA_WCHAR_SIZE 4
1323 #elif defined(EA_PLATFORM_UNIX)
1329 #define EA_WCHAR_SIZE 4
1341 #define EA_WCHAR_SIZE 2
1357 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400)
1358 #define EA_RESTRICT __restrict
1359 #elif defined(EA_COMPILER_CLANG)
1360 #define EA_RESTRICT __restrict
1361 #elif defined(EA_COMPILER_GNUC)
1362 #define EA_RESTRICT __restrict
1363 #elif defined(EA_COMPILER_ARM)
1364 #define EA_RESTRICT __restrict
1365 #elif defined(EA_COMPILER_IS_C99)
1366 #define EA_RESTRICT restrict
1391 #ifndef EA_DEPRECATED
1392 #if defined(EA_COMPILER_CPP14_ENABLED)
1393 #define EA_DEPRECATED [[deprecated]]
1394 #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION > 1300)
1395 #define EA_DEPRECATED __declspec(deprecated)
1396 #elif defined(EA_COMPILER_MSVC)
1397 #define EA_DEPRECATED
1399 #define EA_DEPRECATED __attribute__((deprecated))
1403 #ifndef EA_PREFIX_DEPRECATED
1404 #if defined(EA_COMPILER_CPP14_ENABLED)
1405 #define EA_PREFIX_DEPRECATED [[deprecated]]
1406 #define EA_POSTFIX_DEPRECATED
1407 #elif defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION > 1300)
1408 #define EA_PREFIX_DEPRECATED __declspec(deprecated)
1409 #define EA_POSTFIX_DEPRECATED
1410 #elif defined(EA_COMPILER_MSVC)
1411 #define EA_PREFIX_DEPRECATED
1412 #define EA_POSTFIX_DEPRECATED
1414 #define EA_PREFIX_DEPRECATED
1415 #define EA_POSTFIX_DEPRECATED __attribute__((deprecated))
1419 #ifndef EA_DEPRECATED_MESSAGE
1420 #if defined(EA_COMPILER_CPP14_ENABLED)
1421 #define EA_DEPRECATED_MESSAGE(msg) [[deprecated(#msg)]]
1424 #define EA_DEPRECATED_MESSAGE(msg) EA_DEPRECATED
1449 #ifndef EA_FORCE_INLINE
1450 #if defined(EA_COMPILER_MSVC)
1451 #define EA_FORCE_INLINE __forceinline
1452 #elif defined(EA_COMPILER_GNUC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 301) || defined(EA_COMPILER_CLANG)
1453 #if defined(__cplusplus)
1454 #define EA_FORCE_INLINE inline __attribute__((always_inline))
1456 #define EA_FORCE_INLINE __inline__ __attribute__((always_inline))
1459 #if defined(__cplusplus)
1460 #define EA_FORCE_INLINE inline
1462 #define EA_FORCE_INLINE __inline
1467 #if defined(EA_COMPILER_GNUC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 301) || defined(EA_COMPILER_CLANG)
1468 #define EA_PREFIX_FORCE_INLINE inline
1469 #define EA_POSTFIX_FORCE_INLINE __attribute__((always_inline))
1471 #define EA_PREFIX_FORCE_INLINE inline
1472 #define EA_POSTFIX_FORCE_INLINE
1492 #ifndef EA_FORCE_INLINE_LAMBDA
1493 #if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG)
1494 #define EA_FORCE_INLINE_LAMBDA __attribute__((always_inline))
1496 #define EA_FORCE_INLINE_LAMBDA
1523 #ifndef EA_NO_INLINE
1524 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400)
1525 #define EA_NO_INLINE __declspec(noinline)
1526 #elif defined(EA_COMPILER_MSVC)
1527 #define EA_NO_INLINE
1529 #define EA_NO_INLINE __attribute__((noinline))
1533 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400)
1534 #define EA_PREFIX_NO_INLINE __declspec(noinline)
1535 #define EA_POSTFIX_NO_INLINE
1536 #elif defined(EA_COMPILER_MSVC)
1537 #define EA_PREFIX_NO_INLINE
1538 #define EA_POSTFIX_NO_INLINE
1540 #define EA_PREFIX_NO_INLINE
1541 #define EA_POSTFIX_NO_INLINE __attribute__((noinline))
1557 #ifdef EA_COMPILER_MSVC
1558 #define EA_NO_VTABLE __declspec(novtable)
1559 #define EA_CLASS_NO_VTABLE(x) class __declspec(novtable) x
1560 #define EA_STRUCT_NO_VTABLE(x) struct __declspec(novtable) x
1562 #define EA_NO_VTABLE
1563 #define EA_CLASS_NO_VTABLE(x) class x
1564 #define EA_STRUCT_NO_VTABLE(x) struct x
1585 #if defined(EA_COMPILER_MSVC)
1586 #define EA_PASCAL __stdcall
1587 #elif defined(EA_COMPILER_GNUC) && defined(EA_PROCESSOR_X86)
1588 #define EA_PASCAL __attribute__((stdcall))
1598 #ifndef EA_PASCAL_FUNC
1599 #if defined(EA_COMPILER_MSVC)
1600 #define EA_PASCAL_FUNC(funcname_and_paramlist) __stdcall funcname_and_paramlist
1601 #elif defined(EA_COMPILER_GNUC) && defined(EA_PROCESSOR_X86)
1602 #define EA_PASCAL_FUNC(funcname_and_paramlist) __attribute__((stdcall)) funcname_and_paramlist
1604 #define EA_PASCAL_FUNC(funcname_and_paramlist) funcname_and_paramlist
1626 #if defined(EA_COMPILER_GNUC) || defined(EA_COMPILER_CLANG)
1627 #if defined(__SSE3__)
1629 #elif defined(__SSE2__)
1631 #elif defined(__SSE__) && __SSE__
1636 #elif (defined(EA_SSE3) && EA_SSE3) || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1638 #elif defined(EA_SSE2) && EA_SSE2
1640 #elif defined(EA_PROCESSOR_X86) && defined(_MSC_FULL_VER) && !defined(__NOSSE__) && defined(_M_IX86_FP)
1641 #define EA_SSE _M_IX86_FP
1642 #elif defined(EA_PROCESSOR_X86) && defined(EA_COMPILER_INTEL) && !defined(__NOSSE__)
1644 #elif defined(EA_PROCESSOR_X86_64)
1675 #if defined __SSSE3__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1682 #if defined __SSE4_1__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1689 #if defined __SSE4_2__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1696 #if defined __SSE4A__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1712 #if defined __AVX2__
1714 #elif defined __AVX__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1731 #if defined __F16C__ || defined EA_PLATFORM_XBOXONE || defined CS_UNDEFINED_STRING
1742 #if (defined __FLOAT128__ || defined _GLIBCXX_USE_FLOAT128) && !defined(EA_PLATFORM_SONY)
1754 #if defined(__ABM__) || defined(EA_PLATFORM_XBOXONE) || defined(EA_PLATFORM_SONY) || defined(CS_UNDEFINED_STRING)
1765 #if defined(__ARM_NEON__) || defined(__ARM_NEON)
1781 #if defined(__BMI2__)
1783 #elif defined(__BMI__) || defined(EA_PLATFORM_XBOXONE) || defined(CS_UNDEFINED_STRING)
1808 #if defined(__FMA__) || EA_AVX2 >= 1
1819 #if defined(__TBM__)
1832 #if defined(EA_COMPILER_MSVC)
1833 #define EA_IMPORT __declspec(dllimport)
1847 #if defined(EA_COMPILER_MSVC)
1848 #define EA_EXPORT __declspec(dllexport)
1880 #if defined(_MSC_VER) || defined(__GNUC__) || defined(__EDG__) || defined(__APPLE__)
1881 #define EA_PRAGMA_ONCE_SUPPORTED 1
1899 #if defined(EA_PRAGMA_ONCE_SUPPORTED)
1900 #if defined(_MSC_VER)
1901 #define EA_ONCE() __pragma(once)
1921 #if defined(EA_COMPILER_NO_OVERRIDE)
1924 #define EA_OVERRIDE override
1940 #ifndef EA_INHERITANCE_FINAL
1941 #if defined(EA_COMPILER_NO_INHERITANCE_FINAL)
1942 #define EA_INHERITANCE_FINAL
1943 #elif (defined(_MSC_VER) && (EA_COMPILER_VERSION < 1700))
1944 #define EA_INHERITANCE_FINAL sealed
1946 #define EA_INHERITANCE_FINAL final
1960 #ifndef EA_FINAL_OVERRIDE
1961 #define EA_FINAL_OVERRIDE EA_OVERRIDE EA_INHERITANCE_FINAL
1974 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400)
1975 #define EA_SEALED sealed
1991 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1400)
1992 #define EA_ABSTRACT abstract
2010 #if !defined(EA_CONSTEXPR)
2011 #if defined(EA_COMPILER_NO_CONSTEXPR)
2012 #define EA_CONSTEXPR
2014 #define EA_CONSTEXPR constexpr
2018 #if !defined(EA_CONSTEXPR_OR_CONST)
2019 #if defined(EA_COMPILER_NO_CONSTEXPR)
2020 #define EA_CONSTEXPR_OR_CONST const
2022 #define EA_CONSTEXPR_OR_CONST constexpr
2038 #if !defined(EA_CONSTEXPR_IF)
2039 #if defined(EA_COMPILER_NO_CONSTEXPR_IF)
2040 #define EA_CONSTEXPR_IF(predicate) if ((predicate))
2042 #define EA_CONSTEXPR_IF(predicate) if constexpr ((predicate))
2056 #if !defined(EA_EXTERN_TEMPLATE)
2057 #if defined(EA_COMPILER_NO_EXTERN_TEMPLATE)
2058 #define EA_EXTERN_TEMPLATE(declaration)
2060 #define EA_EXTERN_TEMPLATE(declaration) extern template declaration
2088 #if !defined(EA_NOEXCEPT)
2089 #if defined(EA_COMPILER_NO_NOEXCEPT)
2091 #define EA_NOEXCEPT_IF(predicate)
2092 #define EA_NOEXCEPT_EXPR(expression) false
2094 #define EA_NOEXCEPT noexcept
2095 #define EA_NOEXCEPT_IF(predicate) noexcept((predicate))
2096 #define EA_NOEXCEPT_EXPR(expression) noexcept((expression))
2113 #if !defined(EA_NORETURN)
2114 #if defined(EA_COMPILER_MSVC) && (EA_COMPILER_VERSION >= 1300)
2115 #define EA_NORETURN __declspec(noreturn)
2116 #elif defined(EA_COMPILER_NO_NORETURN)
2119 #define EA_NORETURN [[noreturn]]
2136 #if !defined(EA_CARRIES_DEPENDENCY)
2137 #if defined(EA_COMPILER_NO_CARRIES_DEPENDENCY)
2138 #define EA_CARRIES_DEPENDENCY
2140 #define EA_CARRIES_DEPENDENCY [[carries_dependency]]
2172 #if !defined(EA_FALLTHROUGH)
2173 #if defined(EA_COMPILER_NO_FALLTHROUGH)
2174 #define EA_FALLTHROUGH
2176 #define EA_FALLTHROUGH [[fallthrough]]
2204 #if !defined(EA_NODISCARD)
2205 #if defined(EA_COMPILER_NO_NODISCARD)
2206 #define EA_NODISCARD
2208 #define EA_NODISCARD [[nodiscard]]
2227 #if !defined(EA_MAYBE_UNUSED)
2228 #if defined(EA_COMPILER_NO_MAYBE_UNUSED)
2229 #define EA_MAYBE_UNUSED
2231 #define EA_MAYBE_UNUSED [[maybe_unused]]
2247 #if defined(EA_COMPILER_CLANG)
2248 #define EA_NO_UBSAN __attribute__((no_sanitize("undefined")))
2266 #if defined(EA_COMPILER_CLANG)
2267 #define EA_NO_ASAN __attribute__((no_sanitize("address")))
2280 #if defined(__has_feature)
2281 #if __has_feature(address_sanitizer)
2282 #define EA_ASAN_ENABLED 1
2284 #define EA_ASAN_ENABLED 0
2287 #define EA_ASAN_ENABLED 0
2318 #if !defined(EA_NON_COPYABLE)
2319 #if defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
2320 #define EA_NON_COPYABLE(EAClass_) \
2322 EA_DISABLE_VC_WARNING(4822); \
2323 EAClass_(const EAClass_&); \
2324 void operator=(const EAClass_&); \
2325 EA_RESTORE_VC_WARNING();
2327 #define EA_NON_COPYABLE(EAClass_) \
2328 EA_DISABLE_VC_WARNING(4822); \
2329 EAClass_(const EAClass_&) = delete; \
2330 void operator=(const EAClass_&) = delete; \
2331 EA_RESTORE_VC_WARNING();
2356 #if defined(EA_COMPILER_NO_DELETED_FUNCTIONS)
2357 #define EA_FUNCTION_DELETE
2359 #define EA_FUNCTION_DELETE = delete
2376 #define EA_DISABLE_DEFAULT_CTOR(ClassName) ClassName() EA_FUNCTION_DELETE
2392 #define EA_DISABLE_COPY_CTOR(ClassName) ClassName(const ClassName &) EA_FUNCTION_DELETE
2408 #define EA_DISABLE_MOVE_CTOR(ClassName) ClassName(ClassName&&) EA_FUNCTION_DELETE
2424 #define EA_DISABLE_ASSIGNMENT_OPERATOR(ClassName) ClassName & operator=(const ClassName &) EA_FUNCTION_DELETE
2440 #define EA_DISABLE_MOVE_OPERATOR(ClassName) ClassName & operator=(ClassName&&) EA_FUNCTION_DELETE
2463 struct EANonCopyable
2465 #if defined(EA_COMPILER_NO_DEFAULTED_FUNCTIONS) || defined(__EDG__)
2471 EANonCopyable() =
default;
2472 ~EANonCopyable() =
default;
2475 EA_NON_COPYABLE(EANonCopyable)
2508 #if !defined(EA_OPTIMIZE_OFF)
2509 #if defined(EA_COMPILER_MSVC)
2510 #define EA_OPTIMIZE_OFF() __pragma(optimize("", off))
2511 #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION > 4004) && (defined(__i386__) || defined(__x86_64__))
2512 #define EA_OPTIMIZE_OFF() \
2513 _Pragma("GCC push_options") \
2514 _Pragma("GCC optimize 0")
2515 #elif defined(EA_COMPILER_CLANG) && (!defined(EA_PLATFORM_ANDROID) || (EA_COMPILER_VERSION >= 380))
2516 #define EA_OPTIMIZE_OFF() \
2517 EA_DISABLE_CLANG_WARNING(-Wunknown-pragmas) \
2518 _Pragma("clang optimize off") \
2519 EA_RESTORE_CLANG_WARNING()
2521 #define EA_OPTIMIZE_OFF()
2525 #if !defined(EA_OPTIMIZE_ON)
2526 #if defined(EA_COMPILER_MSVC)
2527 #define EA_OPTIMIZE_ON() __pragma(optimize("", on))
2528 #elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION > 4004) && (defined(__i386__) || defined(__x86_64__))
2529 #define EA_OPTIMIZE_ON() _Pragma("GCC pop_options")
2530 #elif defined(EA_COMPILER_CLANG) && (!defined(EA_PLATFORM_ANDROID) || (EA_COMPILER_VERSION >= 380))
2531 #define EA_OPTIMIZE_ON() \
2532 EA_DISABLE_CLANG_WARNING(-Wunknown-pragmas) \
2533 _Pragma("clang optimize on") \
2534 EA_RESTORE_CLANG_WARNING()
2536 #define EA_OPTIMIZE_ON()