From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, theracermaster@gmail.com
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain
Date: Thu, 28 Nov 2019 14:16:36 +0100 [thread overview]
Message-ID: <dd8d621f-ae91-6fc3-0a25-d1460146930f@redhat.com> (raw)
In-Reply-To: <20191128055645.53053-1-theracermaster@gmail.com>
On 11/28/19 6:56 AM, Alex James via Groups.Io wrote:
> CLANGPDB does not define __GNUC__, but it does define __clang__. Check
> for the __clang__ preprocessor definition to use __builtin_offsetof to
> implement the OFFSET_OF macro.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Alex James <theracermaster@gmail.com>
> ---
> MdePkg/Include/Base.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
> index 4680e64136..e0bcd0ae67 100644
> --- a/MdePkg/Include/Base.h
> +++ b/MdePkg/Include/Base.h
> @@ -781,11 +781,9 @@ typedef UINTN *BASE_LIST;
> @return Offset, in bytes, of field.
>
> **/
> -#ifdef __GNUC__
> -#if __GNUC__ >= 4
> +#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
> #define OFFSET_OF(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field))
> #endif
> -#endif
>
> #ifndef OFFSET_OF
> #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
next prev parent reply other threads:[~2019-11-28 13:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 5:56 [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Alex James
2019-11-28 13:16 ` Philippe Mathieu-Daudé [this message]
2019-11-29 0:23 ` Liming Gao
2019-11-29 6:11 ` Liming Gao
[not found] ` <15DB8D5B995A93E2.20368@groups.io>
2019-12-10 0:50 ` [edk2-devel] " Liming Gao
[not found] ` <15DEDC2D7232490F.29160@groups.io>
2019-12-18 2:06 ` Liming Gao
[not found] ` <15E15503EA811A55.14752@groups.io>
2019-12-20 6:10 ` Liming Gao
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=dd8d621f-ae91-6fc3-0a25-d1460146930f@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