00001
00041 #ifndef COMPILER_GCC_H_INCLUDED
00042 #define COMPILER_GCC_H_INCLUDED
00043
00051 #define __noreturn __attribute__((noreturn))
00052
00058 #define __must_check __attribute__((warn_unused_result))
00059
00066 #define __packed __attribute__((packed))
00067
00073 #define __section(name) __attribute__((section(name)))
00074
00082 #define __weak __attribute__((weak))
00083
00092 #define __used __attribute__((used))
00093
00100 #define __always_inline inline __attribute__((always_inline))
00101
00107 #define __printf_format(fmt_index, first_arg_index) \
00108 __attribute__((format(printf, fmt_index, first_arg_index)))
00109
00113 #define likely(exp) __builtin_expect(!!(exp), 1)
00114
00117 #define unlikely(exp) __builtin_expect(!!(exp), 0)
00118
00126 #define is_constant(exp) __builtin_constant_p(exp)
00127
00135 #define barrier() asm volatile("" ::: "memory")
00136
00143 #define count_leading_zeroes(x) __builtin_clz(x)
00144
00151 #define min(x,y) \
00152 ({ \
00153 typeof(x) __x = (x); \
00154 typeof(y) __y = (y); \
00155 __x < __y ? __x : __y; \
00156 })
00157
00164 #define max(x,y) \
00165 ({ \
00166 typeof(x) __x = (x); \
00167 typeof(y) __y = (y); \
00168 __x > __y ? __x : __y; \
00169 })
00170
00171
00172 #include <arch/compiler-gcc.h>
00173
00174 #endif