[edk2-devel] [PATCH v3 1/1] MdePkg: Add STATIC_ASSERT macro
Liming Gao
liming.gao at intel.com
Thu Sep 12 01:21:06 UTC 2019
Push @204ae9da230ecbf0910c21acac7aa5d5e8cbb8d0
>-----Original Message-----
>From: devel at edk2.groups.io [mailto:devel at edk2.groups.io] On Behalf Of
>Philippe Mathieu-Daudé
>Sent: Tuesday, September 10, 2019 2:30 PM
>To: devel at edk2.groups.io; vit9696 at protonmail.com
>Subject: Re: [edk2-devel] [PATCH v3 1/1] MdePkg: Add STATIC_ASSERT macro
>
>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 <vit9696 at protonmail.com>
>> ---
>> 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 <philmd at redhat.com>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#47147): https://edk2.groups.io/g/devel/message/47147
Mute This Topic: https://groups.io/mt/32917749/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list