Page MenuHomeFreeBSD

stddef.h: centralize definition of offsetof()
ClosedPublic

Authored by brooks on Mon, Feb 16, 1:49 PM.
Tags
None
Referenced Files
F147307522: D55307.diff
Mon, Mar 9, 8:25 PM
Unknown Object (File)
Sat, Mar 7, 10:01 PM
Unknown Object (File)
Thu, Mar 5, 3:43 AM
Unknown Object (File)
Wed, Mar 4, 10:23 AM
Unknown Object (File)
Wed, Mar 4, 10:23 AM
Unknown Object (File)
Mon, Mar 2, 12:06 PM
Unknown Object (File)
Mon, Mar 2, 10:46 AM
Unknown Object (File)
Mon, Mar 2, 10:27 AM
Subscribers

Details

Summary

Move to sys/_offsetof.h and use builtin_offsetof() instead of
offsetof to avoid reintroducing sys/cdefs.h polution in stddef.h.

This has the side effect of allowing sys/stddef.h to be included after
stddef.h which can happen in compatability headers.

Effort: CHERI upstreaming
Sponsored by: DARPA, AFRL

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The change by itself is fine.

This is a related comment. sys/stddef.h definition for offsetof() uses offsetof() instead of builtin_offsetof(). Then, should we have e.g. sys/_offsetof.h with include guard, then this issue would be handled automatically?

This revision is now accepted and ready to land.Mon, Feb 16, 2:32 PM
brooks retitled this revision from sys/stddef.h: guard offsetof definition to stddef.h: centralize definition of offsetof().Wed, Feb 18, 2:39 PM
brooks edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Wed, Feb 18, 2:40 PM
This revision is now accepted and ready to land.Wed, Feb 18, 2:58 PM
This revision was automatically updated to reflect the committed changes.