1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2 3 #ifndef _LINUX_COMPILER_H_ 4 #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." 5 #endif 6 7 /* 8 * Common definitions for all gcc versions go here. 9 */ 10 #ifndef GCC_VERSION 11 #define GCC_VERSION (__GNUC__ * 10000 \ 12 + __GNUC_MINOR__ * 100 \ 13 + __GNUC_PATCHLEVEL__) 14 #endif 15 16 #if __has_attribute(__fallthrough__) 17 # define fallthrough __attribute__((__fallthrough__)) 18 #else 19 # define fallthrough do {} while (0) /* fallthrough */ 20 #endif 21 22 #if __has_attribute(__error__) 23 # define __compiletime_error(message) __attribute__((error(message))) 24 #endif 25 26 /* &a[0] degrades to a pointer: a different type from an array */ 27 #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) 28 #ifndef __noreturn 29 #define __noreturn __attribute__((noreturn)) 30 #endif 31 #define __printf(a, b) __attribute__((format(printf, a, b))) 32