^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _TOOLS_LINUX_COMPILER_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Common definitions for all gcc versions go here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef GCC_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define GCC_VERSION (__GNUC__ * 10000 \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) + __GNUC_MINOR__ * 100 \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) + __GNUC_PATCHLEVEL__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #if GCC_VERSION >= 70000 && !defined(__CHECKER__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) # define __fallthrough __attribute__ ((fallthrough))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #if GCC_VERSION >= 40300
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # define __compiletime_error(message) __attribute__((error(message)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #endif /* GCC_VERSION >= 40300 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* &a[0] degrades to a pointer: a different type from an array */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #ifndef __pure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define __pure __attribute__((pure))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define noinline __attribute__((noinline))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #ifndef __packed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define __packed __attribute__((packed))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #ifndef __noreturn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define __noreturn __attribute__((noreturn))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #ifndef __aligned
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define __aligned(x) __attribute__((aligned(x)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define __printf(a, b) __attribute__((format(printf, a, b)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define __scanf(a, b) __attribute__((format(scanf, a, b)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #if GCC_VERSION >= 50100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #endif