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: philmd@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 09 Sep 2019 23:30:20 -0700 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6856E7FD6C for ; Tue, 10 Sep 2019 06:30:19 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id o11so8493294wrq.22 for ; Mon, 09 Sep 2019 23:30:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=o/9AgXuTjF0o1wv5nYkGB7OzPqTT21tLorYvKgfTYRw=; b=FWn791RRMXel2HCLdYDLHuKiowWgCV4r8Bz39JYTMqgKy6Yu2Kb/kFGyxvHQ2eygdn +NShUyJ5gj8UBQ8LPuvzvFptRlUa26BKYFyHSch37e+JRDrKrbgYeEmtjz9xfItduCNr KcT+ZhD0eoBh4B3ke0G6+3JxcpTIFQzBCcnkdF6AR7o9U1TiAoIbmF4xmYF5wdXxR38p g9tF1ubSSmXwzlZnmOqcVDFexW7mzw8d6bfqLK1zbDLRsD8soIpXGlAwt4z7oC3WLtQ2 UpTnjdi0A9z3LbOZo6iQlzNMVwCD4Z/wPdzoKt1AuqNyuJXm0zj+Ga4767yoxhwqEzvD SDtw== X-Gm-Message-State: APjAAAXGlmvFelVumkLp6LOpENandmzuWz0uAYLkkawcLhLdX8/z1nMy BlvCqMK5SNdwFT8g5T4/VHjISFNoJQHp1SYNeNbygFNLPzxcs5I+xDmyUaRHgdGMOezsYKFO5jS /ae45hWtSzk71Gg== X-Received: by 2002:adf:f486:: with SMTP id l6mr3738076wro.232.1568097018214; Mon, 09 Sep 2019 23:30:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNEnaMgKGoSpJZpAVOGCImM1AZTTrVxedKKUmNhgPQgv8XTPwYgP+HbmUlx26g/Bbc9NejQA== X-Received: by 2002:adf:f486:: with SMTP id l6mr3738055wro.232.1568097018026; Mon, 09 Sep 2019 23:30:18 -0700 (PDT) Received: from [192.168.1.41] (251.red-88-10-102.dynamicip.rima-tde.net. [88.10.102.251]) by smtp.gmail.com with ESMTPSA id x17sm1642161wmj.19.2019.09.09.23.30.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Sep 2019 23:30:17 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH v3 1/1] MdePkg: Add STATIC_ASSERT macro To: devel@edk2.groups.io, vit9696@protonmail.com References: <20190816232811.14941-1-vit9696@protonmail.com> <20190816232811.14941-2-vit9696@protonmail.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: Date: Tue, 10 Sep 2019 08:30:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190816232811.14941-2-vit9696@protonmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 8/17/19 1:28 AM, Vitaly Cheptsov via Groups.Io wrote: > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2048 > > 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 | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > index ce20b5f01d..ec096133ba 100644 > --- a/MdePkg/Include/Base.h > +++ b/MdePkg/Include/Base.h > @@ -843,6 +843,20 @@ 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. > + > + @param Expression Boolean expression. > + @param Message Raised compiler diagnostic message when expression is false. > + > +**/ > +#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 specified field of > that data structure. This is a lightweight method to hide information by placing a > Reviewed-by: Philippe Mathieu-Daude