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))) 58 #define __deprecated __attribute__((__deprecated__)) 62 #define __packed __attribute__((__packed__)) 66 #define __alloc_size(__args) __attribute__((__alloc_size__(__args))) 69 #define __align_to(__size, __al) (((__size) + (__al) - 1) & (~((__al) - 1))) 75 #define xenomai_count_trailing_zeros(x) \ 76 ((x) == 0 ? (int)(sizeof(x) * __CHAR_BIT__) \ 77 : sizeof(x) <= sizeof(unsigned int) ? \ 78 __builtin_ctz((unsigned int)x) \ 79 : sizeof(x) <= sizeof(unsigned long) ? \ 80 __builtin_ctzl((unsigned long)x) \ 83 #define xenomai_count_leading_zeros(x) \ 84 ((x) == 0 ? (int)(sizeof(x) * __CHAR_BIT__) \ 85 : sizeof(x) <= sizeof(unsigned int) ? \ 86 __builtin_clz((unsigned int)x) + \ 87 (int)(sizeof(unsigned int) - sizeof(x)) \ 88 : sizeof(x) <= sizeof(unsigned long) ? \ 89 __builtin_clzl((unsigned long)x) \