18 #ifndef _BOILERPLATE_COMPILER_H
19 #define _BOILERPLATE_COMPILER_H
23 #define container_of(ptr, type, member) \
25 const __typeof__(((type *)0)->member) *__mptr = (ptr); \
26 (type *)((char *)__mptr - offsetof(type, member)); \
29 #define __stringify_1(x...) #x
30 #define __stringify(x...) __stringify_1(x)
33 #define likely(x) __builtin_expect(!!(x), 1)
34 #define unlikely(x) __builtin_expect(!!(x), 0)
38 #define __noreturn __attribute__((__noreturn__))
42 #define __must_check __attribute__((__warn_unused_result__))
46 #define __weak __attribute__((__weak__))
49 #ifndef __maybe_unused
50 #define __maybe_unused __attribute__((__unused__))
54 #define __aligned(__n) __attribute__((aligned (__n)))