From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from walk.intel-email.com (walk.intel-email.com [101.227.64.242]) by mx.groups.io with SMTP id smtpd.web08.5231.1667890756392053366 for ; Mon, 07 Nov 2022 22:59:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=Ffdi4k5K; spf=pass (domain: byosoft.com.cn, ip: 101.227.64.242, mailfrom: gaoliming@byosoft.com.cn) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 93F1DCD1F64B for ; Tue, 8 Nov 2022 14:59:13 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1667890753; bh=f9HovDkhAhG02kQNbuchT+zuG539jIWeXR2MLFyQTUs=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=Ffdi4k5KUBkjMAToe8R7b/H2iKcYdcA5x4vo2lv6bbmhxqZJS6PQhQ1QS9lOipV91 AGBuiQsFfNvOjc6eUXh7yC1HB36k8HsTMe6MdfrJ6KYD/Be4adnHBSSHrDM+qvDd/m SPsazQPIK+ESBqaiHAJz6yruC7xcRHa0z7Au6bnw= Received: from localhost (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 8F9B3CD1F637 for ; Tue, 8 Nov 2022 14:59:13 +0800 (CST) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 67BCDCD1F6A9 for ; Tue, 8 Nov 2022 14:59:13 +0800 (CST) Authentication-Results: walk.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by walk.intel-email.com (Postfix) with SMTP id 69A2ACD1F696 for ; Tue, 8 Nov 2022 14:59:09 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 08 Nov 2022 14:59:08 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'Michael D Kinney'" , Cc: "'Zhiguang Liu'" References: <20221104202528.1157-1-michael.d.kinney@intel.com> <20221104202528.1157-2-michael.d.kinney@intel.com> In-Reply-To: <20221104202528.1157-2-michael.d.kinney@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUGF0Y2ggVjIgMS83XSBNZGVQa2cvSW5jbHVkZTogVXBkYXRlIEJhc2UuaCB0byBpbXByb3ZlIEMrKyBjb21wYXRpYmlsaXR5?= Date: Tue, 8 Nov 2022 14:59:09 +0800 Message-ID: <034501d8f33f$99bd0320$cd370960$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFH1jmsDKlCXelHkMPmoRIYImxWkgG8WDbyr0jv7CA= Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Michael D Kinney > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA11=D4=C25=C8=D5 4:25 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Liming Gao ; Zhiguang Liu > > =D6=F7=CC=E2: [Patch V2 1/7] MdePkg/Include: Update Base.h to improve = C++ > compatibility >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4134 >=20 > * Map NULL to nullptr or __null when c++ compiler is used. > * Map STATIC_ASSERT to static_assert when a c++ compiler is used. > * Typecast RETURN_SUCCESS to type RETURN_STATUS to match type used > by all return error/warning status codes. C++ has stricter type > checking and found this inconsistency. >=20 > Cc: Liming Gao > Cc: Zhiguang Liu > Signed-off-by: Michael D Kinney > --- > MdePkg/Include/Base.h | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) >=20 > diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > index d19ddfe4bba7..d209e6de280a 100644 > --- a/MdePkg/Include/Base.h > +++ b/MdePkg/Include/Base.h > @@ -309,7 +309,15 @@ struct _LIST_ENTRY { > /// > /// NULL pointer (VOID *) > /// > +#if defined (__cplusplus) > + #if defined (_MSC_EXTENSIONS) > +#define NULL nullptr > + #else > +#define NULL __null > + #endif > +#else > #define NULL ((VOID *) 0) > +#endif >=20 > // > // Null character > @@ -760,7 +768,7 @@ typedef UINTN *BASE_LIST; > **/ > #ifdef MDE_CPU_EBC > #define STATIC_ASSERT(Expression, Message) > -#elif defined (_MSC_EXTENSIONS) > +#elif defined (_MSC_EXTENSIONS) || defined (__cplusplus) > #define STATIC_ASSERT static_assert > #else > #define STATIC_ASSERT _Static_assert > @@ -959,7 +967,7 @@ typedef UINTN RETURN_STATUS; > /// > /// The operation completed successfully. > /// > -#define RETURN_SUCCESS 0 > +#define RETURN_SUCCESS (RETURN_STATUS)(0) >=20 > /// > /// The image failed to load. > -- > 2.37.1.windows.1