[PATCH] build_bug.h: Also define static_assert() when __CHECKER__ is defined

Rasmus Villemoes rasmus.villemoes at prevas.dk
Fri Jan 27 10:04:29 CET 2023

On 27/01/2023 09.41, Christophe Leroy wrote:

> Also I have a problem with the following u-boot commit : aa9e891c633 
> ("include/linux/stddef.h: avoid 'warning: preprocessor token offsetof 
> redefined'")
> On uboot mainline I get:
> What can we do about it ? At least reverting it replaces an error with a 
> warning, I think that's better isn't it ?

Well, I don't have much time to look at that offsetof issue, but I know
that I simplified linux recently in that area, dropping that poor man's
definition of offsetof ('((size_t)&((TYPE *)0)->MEMBER)') and defining
it always (also for __CHECKER__) in terms of __builtin_offsetof. See
commit 14e83077d55f.

If we somehow include a system header that also defines offsetof, and
end up doing that after we've included our own stddef.h, well, that's a
bug in whatever code includes <stddef.h>, we really should not do that.


More information about the U-Boot mailing list