public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, vit9696@protonmail.com
Subject: Re: [edk2-devel] [PATCH] MdePkg: Add STATIC_ASSERT macro
Date: Tue, 13 Aug 2019 14:28:41 +0200	[thread overview]
Message-ID: <1044ab43-3a1c-bd03-c06c-471708ddb324@redhat.com> (raw)
In-Reply-To: <-7J-ox4uCTbcsET7h6qAoF8YW8JKIRBPlwK3qb9XdjOtKeSyj11dLzvgBSbPMsAw_lz4656nVS4owNAkaQ2GNOw-FeihwAY75H7kULLh4r0=@protonmail.com>

On 08/12/19 12:05,  via Groups.Io wrote:
> Implements https://bugzilla.tianocore.org/show_bug.cgi?id=2048.
> 
> Best regards,
> Vitaly Cheptsov
> 
> 
> 
> 
> 
> 0001-MdePkg-Add-STATIC_ASSERT-macro.patch
> 
> 
> From 4e388637cc9004ef8befdd7fa6c9446c96daf011 Mon Sep 17 00:00:00 2001
> From: Vitaly Cheptsov <vit9696@protonmail.com>
> Date: Mon, 12 Aug 2019 12:43:06 +0300
> Subject: [PATCH] MdePkg: Add STATIC_ASSERT macro
> 
> 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@protonmail.com>
> ---
>  MdePkg/Include/Base.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> 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 specified field of
>    that data structure.  This is a lightweight method to hide information by placing a
> -- 2.20.1 (Apple Git-117)
> 


  parent reply	other threads:[~2019-08-13 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 10:05 [PATCH] MdePkg: Add STATIC_ASSERT macro vit9696
2019-08-12 21:12 ` [edk2-devel] " Michael D Kinney
2019-08-13 12:28 ` Laszlo Ersek [this message]
     [not found]   ` <45B1F80A-14DF-4300-BE67-FE408398DDEE@protonmail.com>
2019-08-14 15:30     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1044ab43-3a1c-bd03-c06c-471708ddb324@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox