6 #include "config-host.h"
8 /*----------------------------------------------------------------------------
9 | The macro QEMU_GNUC_PREREQ tests for minimum version of the GNU C compiler.
10 | The code is a copy of SOFTFLOAT_GNUC_PREREQ, see softfloat-macros.h.
11 *----------------------------------------------------------------------------*/
12 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
13 # define QEMU_GNUC_PREREQ(maj, min) \
14 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
16 # define QEMU_GNUC_PREREQ(maj, min) 0
19 #define QEMU_NORETURN __attribute__ ((__noreturn__))
21 #if QEMU_GNUC_PREREQ(3, 4)
22 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
24 #define QEMU_WARN_UNUSED_RESULT
28 # define QEMU_PACKED __attribute__((gcc_struct, packed))
30 # define QEMU_PACKED __attribute__((packed))
33 #define cat(x,y) x ## y
34 #define cat2(x,y) cat(x,y)
35 #define QEMU_BUILD_BUG_ON(x) \
36 typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1];
39 # if !QEMU_GNUC_PREREQ(4, 4)
40 /* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
41 # define GCC_ATTR __attribute__((__unused__, format(printf, 1, 2)))
42 # define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
44 /* Use gnu_printf when supported (qemu uses standard format strings). */
45 # define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
46 # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
48 #define GCC_WEAK __attribute__((weak))
51 #define GCC_FMT_ATTR(n, m)
54 #endif /* COMPILER_H */