Revision 5c026320 qemu-common.h
b/qemu-common.h | ||
---|---|---|
2 | 2 |
#ifndef QEMU_COMMON_H |
3 | 3 |
#define QEMU_COMMON_H |
4 | 4 |
|
5 |
#include "compiler.h" |
|
5 | 6 |
#include "config-host.h" |
6 | 7 |
|
7 |
#define QEMU_NORETURN __attribute__ ((__noreturn__)) |
|
8 |
#ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT |
|
9 |
#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
|
10 |
#else |
|
11 |
#define QEMU_WARN_UNUSED_RESULT |
|
12 |
#endif |
|
13 |
|
|
14 |
#define QEMU_BUILD_BUG_ON(x) typedef char __build_bug_on__##__LINE__[(x)?-1:1]; |
|
15 | 8 |
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) |
16 | 9 |
|
17 | 10 |
typedef struct QEMUTimer QEMUTimer; |
... | ... | |
82 | 75 |
#include <sys/uio.h> |
83 | 76 |
#endif |
84 | 77 |
|
85 |
#if defined __GNUC__ |
|
86 |
# if (__GNUC__ < 4) || \ |
|
87 |
defined(__GNUC_MINOR__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 4) |
|
88 |
/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */ |
|
89 |
# define GCC_ATTR __attribute__((__unused__, format(printf, 1, 2))) |
|
90 |
# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m))) |
|
91 |
# else |
|
92 |
/* Use gnu_printf when supported (qemu uses standard format strings). */ |
|
93 |
# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2))) |
|
94 |
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) |
|
95 |
# endif |
|
96 |
#else |
|
97 |
#define GCC_ATTR /**/ |
|
98 |
#define GCC_FMT_ATTR(n, m) |
|
99 |
#endif |
|
100 |
|
|
101 | 78 |
typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) |
102 | 79 |
GCC_FMT_ATTR(2, 3); |
103 | 80 |
|
Also available in: Unified diff