]> git.proxmox.com Git - mirror_edk2.git/commit - MdePkg/Include/Base.h
MdePkg/Base.h: Implement BASE_CR() via OFFSET_OF().
authorMarvin.Haeuser@outlook.com <Marvin.Haeuser@outlook.com>
Wed, 31 Oct 2018 20:08:35 +0000 (04:08 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 2 Nov 2018 14:15:54 +0000 (22:15 +0800)
commit498cb29dfdcc7232f7b0693e266555c19c43ae20
tree6a4ad28f86252c97a2b02633acf4873e3822d2c8
parent88e8498f8a72cff1f7af6852ec8166772913399e
MdePkg/Base.h: Implement BASE_CR() via OFFSET_OF().

Replace the current NULL pointer dereference to retrieve Field's
offset with a call to OFFSET_OF().  This is implemented via
__builtin_offsetof for GCC and Clang, which eliminates UB caught by
Clang UndefinedBehaviorSanitizer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/Base.h