HomeFreeBSD

stddef.h: don't include sys/cdefs.h

Description

stddef.h: don't include sys/cdefs.h

Switch to sys/_visible.h for visibility macros.

Prefer builtin_offsetof over offset. sys/cdefs.h always defines
offsetof to builtin_offsetof so just use the latter to remove a
dependency on sys/cdefs.h. Realistically, we're never going to care
about a compiler that doesn't supply this builtin.

Add a somewhat questionable guard around the offsetof() definition
because the compiler no longer thinks it the same as a number of other
redundent definitions scattered around (e.g., in the openzfs codebase).
It is actually the same and those defintions likely shouldn't exist at
all, but it's easy to add a guard for now.

Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595

Details

Provenance
brooksAuthored on Jun 11 2025, 4:39 PM
Parents
rG5a2f6016dec6: sys/cdefs.h: extract __*_VISIBLE to sys/_visible.h
Branches
Unknown
Tags
Unknown