[cfe-commits] [PATCH] stddef.h: redefine offsetof macro every time the header is included

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Apr 25 06:19:42 PDT 2012


Hi,

this patch moves offsetof definition outside of the header guard in
Clang stddef.h header. As a result, it will override any conflicting
definition of this macro every time stddef.h is included.

On linux there is a conflicting definition in
/usr/include/linux/sysdef.h, which, unlike Clang definition, is not a
compile-time constant. Failing to override it with Clang definition
breaks some code that otherwise (i.e. with GCC) compiles.

This mimics GCC header behaviour which also redefines offsetof
everytime it is included.

Since this is a compiler header, we don't need #undef to override an
earlier definition.

Please review.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: offsetof.patch
Type: application/octet-stream
Size: 523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120425/b7e42261/attachment.obj>


More information about the cfe-commits mailing list