|
|
@@ -100,6 +100,9 @@
|
|
|
* C++17 functionality
|
|
|
* EA_COMPILER_NO_INLINE_VARIABLES
|
|
|
* EA_COMPILER_NO_ALIGNED_NEW
|
|
|
+ *
|
|
|
+ * C++20 functionality
|
|
|
+ * EA_COMPILER_NO_DESIGNATED_INITIALIZERS
|
|
|
*
|
|
|
*-----------------------------------------------------------------------------
|
|
|
*
|
|
|
@@ -300,6 +303,26 @@
|
|
|
#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++.
|
|
|
@@ -1290,6 +1313,24 @@
|
|
|
#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.
|