From nobody Mon Feb 9 18:18:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45873+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45873+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1565999901; cv=none; d=zoho.com; s=zohoarc; b=MeKP3ChHSit4AL0AkpQcpUjAAd0Q1u/iRlTwxHVx7gWkT0i+OYPTJAjw+WNFmNrZXPOcxFaFy9QLEoDt2NgapUWtpd/pQVQmCJrvehfZ4A6qPV0+j6Ib+eQ3Ze8xWj4acOMNE30hjXJ5bNbtu5puoGIXZ2uI7JgDoHrE6W0PONE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565999901; h=Content-Type:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=goDGGjmhUyq/FMi5rPce4X9wGmHubwiMRh+NB6sMW1Y=; b=N6gEgCBNKLlnatGbzT4YjvfQlatjpID7lGwCW0syIecSDJxzuCjdAtJBYfGPVBfnuT4f++biMcoYax0DZ9vdhKUJF/+1tROjDIwXu6RIVGeoR8Di1I2pH46uX2GcUr/FyZcJfZwk/O2FKcx34Me+n6T3KiYKWpNyHHQ+NIQYsvA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45873+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565999901781883.4814197268865; Fri, 16 Aug 2019 16:58:21 -0700 (PDT) Return-Path: X-Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by groups.io with SMTP; Fri, 16 Aug 2019 16:58:21 -0700 Date: Fri, 16 Aug 2019 23:58:11 +0000 To: devel@edk2.groups.io From: "Vitaly Cheptsov via Groups.Io" Reply-To: devel@edk2.groups.io,vit9696@protonmail.com Subject: [edk2-devel] [PATCH v1 2/3] MdePkg: Use STATIC_ASSERT macro Message-ID: <20190816235808.16019-3-vit9696@protonmail.com> In-Reply-To: <20190816235808.16019-1-vit9696@protonmail.com> References: <20190816235808.16019-1-vit9696@protonmail.com> Feedback-ID: p9QuX-L1wMgUm6nrSvNrf8juLupNs0VSnzXGVXuYDxlEahFdWtaedWDMB9zpwGDklGt7kzs1-RBc0cqz327Gcg==:Ext:ProtonMail MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha256; boundary="---------------------f617766d256b96f9b676844d65bc2e7e"; charset=UTF-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565999901; bh=xYyeI6qmF0qswxq0mvNZd9ivkWupqSRrbkZsLzlZIg8=; h=Content-Type:Date:From:Reply-To:Subject:To; b=ELputeKXYJlu/n/7IsA2v6L47LHR3HwpkGMx4zyhuEF28ACWcZBWyS600EOiJR1sTfn cMaeYqei0sxWhlIEb3Thklj8YeWThMpbe2Om/7sYNfvqlbWVB0Xo2yot7sAl2jVFPISPN BqJu3xeCGck0mevsEXDZZC2xjFzbFbpI49M= X-Zoho-Virus-Status: 1 X-ZohoMail-DKIM: pass (identity @groups.io) -----------------------f617766d256b96f9b676844d65bc2e7e Content-Transfer-Encoding: quoted-printable Date: Sat, 17 Aug 2019 02:58:07 +0300 From: Vitaly Cheptsov In-Reply-To: <20190816235808.16019-1-vit9696@protonmail.com> Message-Id: <20190816235808.16019-3-vit9696@protonmail.com> Mime-Version: 1.0 References: <20190816235808.16019-1-vit9696@protonmail.com> Subject: [PATCH v1 2/3] MdePkg: Use STATIC_ASSERT macro To: devel@edk2.groups.io X-Mailer: git-send-email 2.20.1 (Apple Git-117) Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2048 Use new STATIC_ASSERT macro instead of VERIFY_SIZE_OF. Signed-off-by: Vitaly Cheptsov --- MdePkg/Include/Base.h | 79 ++++++++++---------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index ec096133ba..d871422cd6 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -41,45 +41,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(sizeo= f(TYPE) =3D=3D (Size)) / (sizeof(TYPE) =3D=3D (Size))] =20 -// -// Verify that ProcessorBind.h produced UEFI Data Types that are compliant= with -// Section 2.3.1 of the UEFI 2.3 Specification. -// -VERIFY_SIZE_OF (BOOLEAN, 1); -VERIFY_SIZE_OF (INT8, 1); -VERIFY_SIZE_OF (UINT8, 1); -VERIFY_SIZE_OF (INT16, 2); -VERIFY_SIZE_OF (UINT16, 2); -VERIFY_SIZE_OF (INT32, 4); -VERIFY_SIZE_OF (UINT32, 4); -VERIFY_SIZE_OF (INT64, 8); -VERIFY_SIZE_OF (UINT64, 8); -VERIFY_SIZE_OF (CHAR8, 1); -VERIFY_SIZE_OF (CHAR16, 2); - -// -// The following three enum types are used to verify that the compiler -// configuration for enum types is compliant with Section 2.3.1 of the -// UEFI 2.3 Specification. These enum types and enum values are not -// intended to be used. A prefix of '__' is used avoid conflicts with -// other types. -// -typedef enum { - __VerifyUint8EnumValue =3D 0xff -} __VERIFY_UINT8_ENUM_SIZE; - -typedef enum { - __VerifyUint16EnumValue =3D 0xffff -} __VERIFY_UINT16_ENUM_SIZE; - -typedef enum { - __VerifyUint32EnumValue =3D 0xffffffff -} __VERIFY_UINT32_ENUM_SIZE; - -VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4); -VERIFY_SIZE_OF (__VERIFY_UINT16_ENUM_SIZE, 4); -VERIFY_SIZE_OF (__VERIFY_UINT32_ENUM_SIZE, 4); - // // The Microsoft* C compiler can removed references to unreferenced data i= tems // if the /OPT:REF linker option is used. We defined a macro as this is a @@ -857,6 +818,46 @@ typedef UINTN *BASE_LIST; #define STATIC_ASSERT _Static_assert #endif =20 +// +// Verify that ProcessorBind.h produced UEFI Data Types that are compliant= with +// Section 2.3.1 of the UEFI 2.3 Specification. +// + +STATIC_ASSERT (sizeof (BOOLEAN) =3D=3D 1, "sizeof (BOOLEAN) does not meet = UEFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (INT8) =3D=3D 1, "sizeof (INT8) does not meet UEF= I Specification Data Type requirements"); +STATIC_ASSERT (sizeof (UINT8) =3D=3D 1, "sizeof (UINT8) does not meet UE= FI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (INT16) =3D=3D 2, "sizeof (INT16) does not meet UE= FI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (UINT16) =3D=3D 2, "sizeof (UINT16) does not meet U= EFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (INT32) =3D=3D 4, "sizeof (INT32) does not meet UE= FI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (UINT32) =3D=3D 4, "sizeof (UINT32) does not meet U= EFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (INT64) =3D=3D 8, "sizeof (INT64) does not meet UE= FI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (UINT64) =3D=3D 8, "sizeof (UINT64) does not meet U= EFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (CHAR8) =3D=3D 1, "sizeof (CHAR8) does not meet UE= FI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (CHAR16) =3D=3D 2, "sizeof (CHAR16) does not meet U= EFI Specification Data Type requirements"); + +// +// The following three enum types are used to verify that the compiler +// configuration for enum types is compliant with Section 2.3.1 of the +// UEFI 2.3 Specification. These enum types and enum values are not +// intended to be used. A prefix of '__' is used avoid conflicts with +// other types. +// +typedef enum { + __VerifyUint8EnumValue =3D 0xff +} __VERIFY_UINT8_ENUM_SIZE; + +typedef enum { + __VerifyUint16EnumValue =3D 0xffff +} __VERIFY_UINT16_ENUM_SIZE; + +typedef enum { + __VerifyUint32EnumValue =3D 0xffffffff +} __VERIFY_UINT32_ENUM_SIZE; + +STATIC_ASSERT (sizeof (__VERIFY_UINT8_ENUM_SIZE) =3D=3D 4, "Size of enum d= oes not meet UEFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (__VERIFY_UINT16_ENUM_SIZE) =3D=3D 4, "Size of enum = does not meet UEFI Specification Data Type requirements"); +STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) =3D=3D 4, "Size of enum = does not meet UEFI Specification Data Type requirements"); + /** Macro that returns a pointer to the data structure that contains a speci= fied field of that data structure. This is a lightweight method to hide information b= y placing a --=20 2.20.1 (Apple Git-117) -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45873): https://edk2.groups.io/g/devel/message/45873 Mute This Topic: https://groups.io/mt/32918012/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- -----------------------f617766d256b96f9b676844d65bc2e7e Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wsBmBAEBCAAQBQJdV0MTCRBPsoxt7Hy0xQAKCRBPsoxt7Hy0xQR7CAAKg0n/ 1jFpuLN1D8415hynlou9rOAt0nMwC+hnchr+hFwA4gvQdgazN/tjwP1yBws2 dWRdkm2jfyO1CWChjqhZVF2yqiCXTFfY8kpiiRo/WQYkitAQYfS0tCM+h75p zNr0f5YF9Xt9hzivm/RVwoIHB7/eR8u5fqb1i8A3VOC94gQJ9F0NXcvBbBTx YMLL34t2if48+8YXLtmgRu5sL55/ryYSGuCwTXAdcn/4y45vBMH4EPigsthD qzsHMnDYGSM98GxvqdspiNjXeiphFZmsREJuGUoH8W8I4H0etTQndHDcKCQi quhoaIfVVtyBiot0NceyI0yH8C0uMqn/dUh4 =+uJ5 -----END PGP SIGNATURE----- -----------------------f617766d256b96f9b676844d65bc2e7e--