mirror of https://github.com/acidanthera/audk.git
MdePkg: Use __builtin_offset with CLANGPDB toolchain
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2393 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> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
665afccc52
commit
796b380ca7
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue