00001
00038 #ifndef COMPILER_GCC_H_INCLUDED
00039 #define COMPILER_GCC_H_INCLUDED
00040
00041 #define __noreturn __attribute__((noreturn))
00042 #define __must_check __attribute__((warn_unused_result))
00043 #define __used __attribute__((used))
00044 #define __always_inline inline __attribute__((always_inline))
00045 #define __nonnull(...) __attribute__((nonnull (__VA_ARGS__)))
00046 #define __printf_format(fmt_index, first_arg_index) \
00047 __attribute__((format(printf, fmt_index, first_arg_index)))
00048
00049 #define compiler_align_data(byte_alignment) \
00050 __attribute__((aligned(byte_alignment)))
00051
00052 #define likely(exp) __builtin_expect(!!(exp), 1)
00053 #define unlikely(exp) __builtin_expect(!!(exp), 0)
00054 #define is_constant(exp) __builtin_constant_p(exp)
00055 #define barrier() asm volatile("" ::: "memory")
00056
00057 #if defined(__GNUC__)
00058 # if __NO_INLINE__
00059 # define ERROR_FUNC(name, msg) \
00060 extern int name(void) {}
00061 # else
00062 # if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
00063 # define ERROR_FUNC(name, msg) \
00064 extern __attribute__((error(msg))) int name(void)
00065 # endif
00066 # endif
00067 #endif
00068
00069
00070 #include <arch/compiler-gcc.h>
00071
00072 #endif