From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0F5DD1A1E89 for ; Wed, 26 Oct 2016 20:17:49 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 26 Oct 2016 20:17:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,404,1473145200"; d="scan'208";a="184344926" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 26 Oct 2016 20:17:48 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 20:17:48 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 20:17:48 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.104]) with mapi id 14.03.0248.002; Thu, 27 Oct 2016 11:17:46 +0800 From: "Gao, Liming" To: "Kinney, Michael D" , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [Patch] MdePkg/Include: Add enumeration size checks to Base.h Thread-Index: AQHSL9JaBBwhQ5ATdE+zN8U+nJJheaC7oarQ Date: Thu, 27 Oct 2016 03:17:44 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14B49A460@shsmsx102.ccr.corp.intel.com> References: <1477518340-12316-1-git-send-email-michael.d.kinney@intel.com> In-Reply-To: <1477518340-12316-1-git-send-email-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdePkg/Include: Add enumeration size checks to Base.h X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 03:17:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Michael Kinney > Sent: Thursday, October 27, 2016 5:46 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [Patch] MdePkg/Include: Add enumeration size checks to > Base.h >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D181 >=20 > Add size check for 8-bit, 16-bit, and 32-bit enums > to make sure they follow the UEFI Specification 2.3.1 > Data Types. >=20 > >=20 > Element of a standard ANSI C enum type declaration. > Type INT32.or UINT32. ANSI C does not define the > size of sign of an enum so they should never be > used in structures. ANSI C integer promotion rules > make INT32 or UINT32 interchangeable when passed as > an argument to a function. >=20 > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Michael Kinney > --- > MdePkg/Include/Base.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > index c666148..725d9c9 100644 > --- a/MdePkg/Include/Base.h > +++ b/MdePkg/Include/Base.h > @@ -63,6 +63,22 @@ VERIFY_SIZE_OF (UINT64, 8); > VERIFY_SIZE_OF (CHAR8, 1); > VERIFY_SIZE_OF (CHAR16, 2); >=20 > +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 > items > // if the /OPT:REF linker option is used. We defined a macro as this is= a > -- > 2.6.3.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel