/* Force a compilation error if condition is true */ #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) /* Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so the expression can be used e.g. in a structure initializer (or where-ever else comma expressions aren't permitted). */ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) struct branch { unsigned char opcode; int delta; } __attribute__((packed)); unsigned paravirt_patch_call(void *insnbuf) { struct branch *b = insnbuf; b->opcode = 0xe8; /* call */ b->delta = 0x1234; BUILD_BUG_ON(sizeof(*b) != 5); return 5; } int main(int argc, char *argv[]) { }