diff options
author | Michael D Kinney <michael.d.kinney@intel.com> | 2025-01-06 12:42:07 -0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-01-16 05:33:13 +0000 |
commit | 8b2256fbf22c07c7f3505a374458ab53c3fcfff3 (patch) | |
tree | 4a60e7728260feb36a528c03b8b451110a0bec57 /MdePkg | |
parent | aae044a130599427e3562fe5736d7b2d42777272 (diff) | |
download | edk2-8b2256fbf22c07c7f3505a374458ab53c3fcfff3.tar.gz |
MdePkg/Include: Use _Static_assert for clang and GNUC
The clang compiler generates the following error
error: use of 'static_assert' without inclusion of <assert.h>
This is due to the use of the MSC Extension static_assert.
Use _Static_assert instead for clang and GNUC compilers.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Base.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 554f827fd1..a6fb59205e 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -800,12 +800,14 @@ typedef UINTN *BASE_LIST; @param Message Raised compiler diagnostic message when expression is false.
**/
-#ifdef MDE_CPU_EBC
-#define STATIC_ASSERT(Expression, Message)
-#elif defined (_MSC_EXTENSIONS) || defined (__cplusplus)
+#if defined (__cplusplus)
#define STATIC_ASSERT static_assert
-#else
+#elif defined (__GNUC__) || defined (__clang__)
#define STATIC_ASSERT _Static_assert
+#elif defined (_MSC_EXTENSIONS)
+#define STATIC_ASSERT static_assert
+#else
+ #error STATIC_ASSERT() definiton not available
#endif
//
|