0001
0002 #ifndef _TOOLS_LINUX_COMPILER_H_
0003 #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
0004 #endif
0005
0006
0007
0008
0009 #ifndef GCC_VERSION
0010 #define GCC_VERSION (__GNUC__ * 10000 \
0011 + __GNUC_MINOR__ * 100 \
0012 + __GNUC_PATCHLEVEL__)
0013 #endif
0014
0015 #if GCC_VERSION >= 70000 && !defined(__CHECKER__)
0016 # define __fallthrough __attribute__ ((fallthrough))
0017 #endif
0018
0019 #if __has_attribute(__error__)
0020 # define __compiletime_error(message) __attribute__((error(message)))
0021 #endif
0022
0023
0024 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
0025
0026 #ifndef __pure
0027 #define __pure __attribute__((pure))
0028 #endif
0029 #define noinline __attribute__((noinline))
0030 #ifndef __packed
0031 #define __packed __attribute__((packed))
0032 #endif
0033 #ifndef __noreturn
0034 #define __noreturn __attribute__((noreturn))
0035 #endif
0036 #ifndef __aligned
0037 #define __aligned(x) __attribute__((aligned(x)))
0038 #endif
0039 #define __printf(a, b) __attribute__((format(printf, a, b)))
0040 #define __scanf(a, b) __attribute__((format(scanf, a, b)))