From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 13 Aug 2019 05:28:43 -0700 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E28B3C050E0B; Tue, 13 Aug 2019 12:28:42 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-193.ams2.redhat.com [10.36.117.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id 426CA891AB; Tue, 13 Aug 2019 12:28:41 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdePkg: Add STATIC_ASSERT macro To: devel@edk2.groups.io, vit9696@protonmail.com References: <-7J-ox4uCTbcsET7h6qAoF8YW8JKIRBPlwK3qb9XdjOtKeSyj11dLzvgBSbPMsAw_lz4656nVS4owNAkaQ2GNOw-FeihwAY75H7kULLh4r0=@protonmail.com> From: "Laszlo Ersek" Message-ID: <1044ab43-3a1c-bd03-c06c-471708ddb324@redhat.com> Date: Tue, 13 Aug 2019 14:28:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <-7J-ox4uCTbcsET7h6qAoF8YW8JKIRBPlwK3qb9XdjOtKeSyj11dLzvgBSbPMsAw_lz4656nVS4owNAkaQ2GNOw-FeihwAY75H7kULLh4r0=@protonmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 13 Aug 2019 12:28:43 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 08/12/19 12:05, via Groups.Io wrote: > Implements=C2=A0https://bugzilla.tianocore.org/show_bug.cgi?id=3D2048. >=20 > Best regards, > Vitaly Cheptsov >=20 >=20 >=20 >=20 >=20 > 0001-MdePkg-Add-STATIC_ASSERT-macro.patch >=20 >=20 > From 4e388637cc9004ef8befdd7fa6c9446c96daf011 Mon Sep 17 00:00:00 2001 > From: Vitaly Cheptsov > Date: Mon, 12 Aug 2019 12:43:06 +0300 > Subject: [PATCH] MdePkg: Add STATIC_ASSERT macro >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2048 >=20 > Provide a macro for compile time assertions. > Equivalent to C11 static_assert macro from assert.h. >=20 > Signed-off-by: Vitaly Cheptsov > --- > MdePkg/Include/Base.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) >=20 > diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > index ce20b5f01d..0162192f71 100644 > --- a/MdePkg/Include/Base.h > +++ b/MdePkg/Include/Base.h > @@ -843,6 +843,17 @@ typedef UINTN *BASE_LIST; > #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field)) > #endif > > +/// > +/// Portable definition for compile time assertions. > +/// Equivalent to C11 static_assert macro from assert.h. > +/// Takes condtion and error message as its arguments. > +/// > +#ifdef _MSC_VER > + #define STATIC_ASSERT static_assert > +#else > + #define STATIC_ASSERT _Static_assert The oldest GCC toolchain that edk2 supports is GCC48. Will _Static_assert work with gcc-4.8? Thanks Laszlo > +#endif > + > /** > Macro that returns a pointer to the data structure that contains a sp= ecified field of > that data structure. This is a lightweight method to hide informatio= n by placing a > -- 2.20.1 (Apple Git-117) >=20