From c1b073a9dccc11fbd9fdfd69f76de6e972ad1550 Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 11 Oct 2022 12:03:48 -0700 Subject: 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 --- MdePkg/Include/Library/DebugLib.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'MdePkg') 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 -- cgit