Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/cdefs.h
Show First 20 Lines • Show All 926 Lines • ▼ Show 20 Lines | |||||||||||||
#define __builtin_align_down(x, align) \ | #define __builtin_align_down(x, align) \ | ||||||||||||
((__typeof__(x))((x)&(~((align)-1)))) | ((__typeof__(x))((x)&(~((align)-1)))) | ||||||||||||
#endif | #endif | ||||||||||||
#define __align_up(x, y) __builtin_align_up(x, y) | #define __align_up(x, y) __builtin_align_up(x, y) | ||||||||||||
#define __align_down(x, y) __builtin_align_down(x, y) | #define __align_down(x, y) __builtin_align_down(x, y) | ||||||||||||
#define __is_aligned(x, y) __builtin_is_aligned(x, y) | #define __is_aligned(x, y) __builtin_is_aligned(x, y) | ||||||||||||
/* | |||||||||||||
kib: The general intent with sys/cdefs.h is to provide common facilities to adjust to compiler… | |||||||||||||
Done Inline Actionsperhaps this should land in sys/types.h then? again under _KERNEL mjg: perhaps this should land in sys/types.h then? again under _KERNEL | |||||||||||||
Done Inline Actionspoint being, arguably it is a new type mjg: point being, arguably it is a new type | |||||||||||||
Not Done Inline Actionssys/types.h indeed sound not bad, but I do not agree with the _KERNEL braces. The type name should be put into impl namespace, and be accessible to any consumer. Note that we have usermode that wants the struct vnode definition. kib: sys/types.h indeed sound not bad, but I do not agree with the _KERNEL braces. The type name… | |||||||||||||
* TODO: figure out how to do checking at compilation time that consumers don't | |||||||||||||
* use mere 'enum' | |||||||||||||
*/ | |||||||||||||
Not Done Inline ActionsPlain "enum" appears to work fine with both. arichardson: Plain "enum" appears to work fine with both. | |||||||||||||
#define small_enum_decl enum __attribute__((__packed__)) | |||||||||||||
#define small_enum enum | |||||||||||||
#endif /* !_SYS_CDEFS_H_ */ | #endif /* !_SYS_CDEFS_H_ */ | ||||||||||||
Not Done Inline Actions
kib: | |||||||||||||
Not Done Inline ActionsI looks like this is unnecessary, GCC 9 only needs it on the enum def, uses will automatically be sized correctly: arichardson: I looks like this is unnecessary, GCC 9 only needs it on the enum def, uses will automatically… | |||||||||||||
Not Done Inline Actions
arichardson: |
The general intent with sys/cdefs.h is to provide common facilities to adjust to compiler quirks, for any compilation environment. Also, you explicitly use types (uint8_t) provided by cdefs.h conumers, while sys/cdefs.h is supposed to be self-contained: it is the root of all header dependencies.
Put your hack into implementation namespace (prepend with two _) and find a better way to deal with type dependency.