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

Joerg Sonnenberger joerg at britannica.bec.de
Thu Apr 26 03:23:08 PDT 2012


On Thu, Apr 26, 2012 at 01:26:23PM +0400, Evgeniy Stepanov wrote:
> Because that's how things work.

The classic definition of offsetof is valid C. As long as you don't deal
with C++, using __builtin_offsetof is optional. As such, this would
trigger redef warnings on valid code.

> This header also does not fully respect __need_size_t and friends,
> even though it should. This is a (undocumented) contract between gcc
> and glibc headers. As we replace one part of the system, we are
> responsible to do all the necessary hacks to maintain compatibility.

Not everyone uses glibc. Your changes should not create regressions for
other supported platforms. Of course, most other platforms do provide a
sane stddef.h that works with the rest of the system headers.

Joerg



More information about the cfe-commits mailing list