From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.7390.1667532676726925714 for ; Thu, 03 Nov 2022 20:31:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=fzmToW83; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667532677; x=1699068677; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BwWNkpRGJajojthHXMC9Vm+CrImh6xGy6pf1xF1diJo=; b=fzmToW83eV3FFyoIxuczEo1GOxRM/3pjx8muXDkT9Muf82hy0AlyUW5y lykpwlxpcSbMX+a66RJpX7aB1DklMJZXcHKpcIEqOPTq2PjvTDlenNWUL oC3yRHofmwKk3tV6F8RzQrB/R4h0PR4/dz3OqllxEYLhsb1mg3RTZV449 5JbNQ97Y/JXNUVuxr8v7fGuv+kuZRyJGKR0SwE2NI1BQPrH8TChyMMqDd h5I0BnPwyRcnjI5Y0IufRu4aSR46vyoHtVdEukHVuv9TFH6Yt+XqBYStD 7zUE4QzOic8eXHyxOiiLgrNnnecQJ6Lfdmq3jdJGGjmLnZLyOKOTkdyOH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="290258026" X-IronPort-AV: E=Sophos;i="5.96,136,1665471600"; d="scan'208";a="290258026" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 20:31:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="809917951" X-IronPort-AV: E=Sophos;i="5.96,136,1665471600"; d="scan'208";a="809917951" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.2.81]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 20:31:03 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu Subject: [Patch 2/7] MdePkg/Include/Library: Undefine _ASSERT() if already defined Date: Thu, 3 Nov 2022 20:30:51 -0700 Message-Id: <20221104033056.1259-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: <20221104033056.1259-1-michael.d.kinney@intel.com> References: <20221104033056.1259-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- MdePkg/Include/Library/DebugLib.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h index 8d3d08638d73..9110be2f41b3 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 -- 2.37.1.windows.1