REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2048
Provide a macro for compile time assertions.
Equivalent to C11 static_assert macro from assert.h.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))\r
#endif\r
\r
+/**\r
+ Portable definition for compile time assertions.\r
+ Equivalent to C11 static_assert macro from assert.h.\r
+\r
+ @param Expression Boolean expression.\r
+ @param Message Raised compiler diagnostic message when expression is false.\r
+\r
+**/\r
+#ifdef _MSC_EXTENSIONS\r
+ #define STATIC_ASSERT static_assert\r
+#else\r
+ #define STATIC_ASSERT _Static_assert\r
+#endif\r
+\r
/**\r
Macro that returns a pointer to the data structure that contains a specified field of\r
that data structure. This is a lightweight method to hide information by placing a\r