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>
This commit is contained in:
Michael D Kinney 2025-01-06 12:42:07 -08:00 committed by mergify[bot]
parent aae044a130
commit 8b2256fbf2

View File

@ -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
#elif defined (__GNUC__) || defined (__clang__)
#define STATIC_ASSERT _Static_assert
#elif defined (_MSC_EXTENSIONS)
#define STATIC_ASSERT static_assert
#else
#define STATIC_ASSERT _Static_assert
#error STATIC_ASSERT() definiton not available
#endif
//