Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/assym.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
/* char name ## _datatype_ ## STRINGIFY(typeof(((struct parenttype *)(0x0))-> name)) [1]; */ | /* char name ## _datatype_ ## STRINGIFY(typeof(((struct parenttype *)(0x0))-> name)) [1]; */ | ||||
#ifdef OFFSET_TEST | #ifdef OFFSET_TEST | ||||
#define OFFSET_CTASSERT CTASSERT | #define OFFSET_CTASSERT CTASSERT | ||||
#else | #else | ||||
#define OFFSET_CTASSERT(...) | #define OFFSET_CTASSERT(...) | ||||
#endif | #endif | ||||
#define OFFSYM(name, parenttype, datatype) \ | #define OFFSYM(name, parenttype, datatype) \ | ||||
ASSYM(name, offsetof(struct parenttype, name)); \ | char OfFsEt__ ## parenttype ## __ ## name ## __ ## datatype [offsetof(struct parenttype, name)]; \ | ||||
char name ## _datatype_ ## datatype [1]; \ | char name ## _datatype_ ## datatype [1]; \ | ||||
char name ## _parenttype_ ## parenttype [1]; \ | char name ## _parenttype_ ## parenttype [1]; \ | ||||
markj: IMO it would be nicer to use a namespace prefix instead of mangling the name, maybe… | |||||
Done Inline ActionsI'm agnostic as to the prefix, so I'll change it. imp: I'm agnostic as to the prefix, so I'll change it.
| |||||
CTASSERT(__builtin_types_compatible_p(__typeof(((struct parenttype *)(0x0))-> name), datatype)); \ | CTASSERT(__builtin_types_compatible_p(__typeof(((struct parenttype *)(0x0))-> name), datatype)); \ | ||||
OFFSET_CTASSERT(offsetof(struct parenttype, name) == offsetof(struct parenttype ## _lite, name)) | OFFSET_CTASSERT(offsetof(struct parenttype, name) == offsetof(struct parenttype ## _lite, name)) | ||||
#endif /* !_SYS_ASSYM_H_ */ | #endif /* !_SYS_ASSYM_H_ */ |
IMO it would be nicer to use a namespace prefix instead of mangling the name, maybe __assym_offset or something like that.