From: Michael D Kinney Date: Tue, 11 Oct 2022 19:03:48 +0000 (-0700) Subject: MdePkg/Include/Library: Undefine _ASSERT() if already defined X-Git-Tag: edk2-stable202211~12 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=c1b073a9dccc11fbd9fdfd69f76de6e972ad1550 MdePkg/Include/Library: Undefine _ASSERT() if already defined REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 When unit testing is enabled, make sure _ASSERT() is not already defined by the host environment before defining _ASSERT(). This avoids conflicts with VS20xx builds of GoogleTest based unit tests. Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Michael D Kinney Reviewed-by: Liming Gao --- diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index 8d3d08638d..9110be2f41 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -337,6 +337,9 @@ UnitTestDebugAssert ( IN CONST CHAR8 *Description ); + #if defined (_ASSERT) + #undef _ASSERT + #endif #if defined (__clang__) && defined (__FILE_NAME__) #define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) #else