From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@protonmail.com header.s=default header.b=GPl1+GWB; spf=pass (domain: protonmail.com, ip: 185.70.40.18, mailfrom: vit9696@protonmail.com) Received: from mail1.protonmail.ch (mail1.protonmail.ch [185.70.40.18]) by groups.io with SMTP; Tue, 13 Aug 2019 01:16:54 -0700 Date: Tue, 13 Aug 2019 08:16:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1565684212; bh=OwF4Bcpwuy3ddPPULTyFtewMXBiK+0tKoQLTuglIbJI=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:Feedback-ID: From; b=GPl1+GWBemhrdSjHj7vRg4/uSWdJLIFZ+4ELPGpuq7YZX6J39m5kt83f2Uzav3w3o 9S6zbkhoGaUPzGumpnlu3t8GhB3AnryahlpuHKcWJe0CsBC0qoES5qW1fS0HeQTRpx AJBTsstbfwyspwPFQxwWT7TLP/MFTi8pxI0+nu7E= To: devel@edk2.groups.io From: "vit9696" Reply-To: Vitaly Cheptsov Subject: [PATCH v2 1/1] MdePkg: Add STATIC_ASSERT macro Message-ID: <20190813081644.53963-2-vit9696@protonmail.com> In-Reply-To: <20190813081644.53963-1-vit9696@protonmail.com> References: <20190813081644.53963-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 X-Groupsio-MsgNum: 45503 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha256; boundary="---------------------8d223fbf56bf7ea3fb862b6e42d5715a"; charset=UTF-8 -----------------------8d223fbf56bf7ea3fb862b6e42d5715a Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Aug 2019 11:16:44 +0300 From: Vitaly Cheptsov In-Reply-To: <20190813081644.53963-1-vit9696@protonmail.com> Message-Id: <20190813081644.53963-2-vit9696@protonmail.com> Mime-Version: 1.0 References: <20190813081644.53963-1-vit9696@protonmail.com> Subject: [PATCH v2 1/1] MdePkg: Add STATIC_ASSERT macro To: devel@edk2.groups.io X-Mailer: git-send-email 2.20.1 (Apple Git-117) REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2048 Provide a macro for compile time assertions. Equivalent to C11 static_assert macro from assert.h. Signed-off-by: Vitaly Cheptsov --- MdePkg/Include/Base.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index ce20b5f01dce..f85f7028a262 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 =20 +/// +/// 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_EXTENSIONS + #define STATIC_ASSERT static_assert +#else + #define STATIC_ASSERT _Static_assert +#endif + /** 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) -----------------------8d223fbf56bf7ea3fb862b6e42d5715a Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: ProtonMail wsBmBAEBCAAQBQJdUnHuCRBPsoxt7Hy0xQAKCRBPsoxt7Hy0xe77CAAfISgA mrceAlkZ87zQMDrumWfln6uugRYprQWhNj0W9zTgO3oCeloIq6QcSP8NMDqn EyZOgJdEnineu5p/wZvoNCs6l78en5QxmiJd3Lc+h0gZf5XdykhDViwIgBXU wwPI1KVYU0Ax+gbxId04qZs6/3m0gbf8L9JC4luRK5N834Lz0l3b6ZyNgVYS E1GqjhQAlhjlR2MutBFL0hv/OggFXYHQH2BmGvc8AkRiDG4+MxQBnhJ2Xsdx W415P1HePmUxOAoT3hzYDYI9+LOeS/bt+fST5fNB5HRsd9U6QvxqSCx9uHVt JvSXgOoujbN4NXzndpNcpP2Rcv2yaE0Fk08V =OzEG -----END PGP SIGNATURE----- -----------------------8d223fbf56bf7ea3fb862b6e42d5715a--