Page MenuHomeFreeBSD

stddef.h: centralize definition of offsetof()
ClosedPublic

Authored by brooks on Mon, Feb 16, 1:49 PM.
Tags
None
Referenced Files
F146413022: D55307.id171969.diff
Mon, Mar 2, 12:06 PM
F146404942: D55307.id.diff
Mon, Mar 2, 10:46 AM
F146403053: D55307.id172237.diff
Mon, Mar 2, 10:27 AM
Unknown Object (File)
Sun, Mar 1, 6:14 PM
Unknown Object (File)
Sun, Mar 1, 4:15 PM
Unknown Object (File)
Sun, Mar 1, 1:47 AM
Unknown Object (File)
Sun, Mar 1, 12:46 AM
Unknown Object (File)
Sat, Feb 28, 10:52 PM
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 Passed
Unit
No Test Coverage
Build Status
Buildable 70696
Build 67579: arc lint + arc unit

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.