Commit df2542c737ea2f7148136b6525cd56f6fc276d69
1 parent
8a0ef219
Avoid duplicated definitions: move common definitions from exec-all.h
and qemu-common.h to osdep.h. Include this header in translate-op.c. Make sure it's included first in darwin-user/qemu.h. To avoid discarded inlining bug, define inline as always_inline and always_inline as (( attribute (always_inline) )) __inline__. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3698 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
41 additions
and
63 deletions
darwin-user/qemu.h
exec-all.h
... | ... | @@ -21,36 +21,6 @@ |
21 | 21 | /* allow to see translation results - the slowdown should be negligible, so we leave it */ |
22 | 22 | #define DEBUG_DISAS |
23 | 23 | |
24 | -#ifndef glue | |
25 | -#define xglue(x, y) x ## y | |
26 | -#define glue(x, y) xglue(x, y) | |
27 | -#define stringify(s) tostring(s) | |
28 | -#define tostring(s) #s | |
29 | -#endif | |
30 | - | |
31 | -#ifndef likely | |
32 | -#if __GNUC__ < 3 | |
33 | -#define __builtin_expect(x, n) (x) | |
34 | -#endif | |
35 | - | |
36 | -#define likely(x) __builtin_expect(!!(x), 1) | |
37 | -#define unlikely(x) __builtin_expect(!!(x), 0) | |
38 | -#endif | |
39 | - | |
40 | -#ifndef always_inline | |
41 | -#if (__GNUC__ < 3) || defined(__APPLE__) | |
42 | -#define always_inline inline | |
43 | -#else | |
44 | -#define always_inline __attribute__ (( always_inline )) inline | |
45 | -#endif | |
46 | -#endif | |
47 | - | |
48 | -#ifdef __i386__ | |
49 | -#define REGPARM(n) __attribute((regparm(n))) | |
50 | -#else | |
51 | -#define REGPARM(n) | |
52 | -#endif | |
53 | - | |
54 | 24 | /* is_jmp field values */ |
55 | 25 | #define DISAS_NEXT 0 /* next instruction can be analyzed */ |
56 | 26 | #define DISAS_JUMP 1 /* only pc was modified dynamically */ | ... | ... |
osdep.h
... | ... | @@ -3,6 +3,44 @@ |
3 | 3 | |
4 | 4 | #include <stdarg.h> |
5 | 5 | |
6 | +#ifndef glue | |
7 | +#define xglue(x, y) x ## y | |
8 | +#define glue(x, y) xglue(x, y) | |
9 | +#define stringify(s) tostring(s) | |
10 | +#define tostring(s) #s | |
11 | +#endif | |
12 | + | |
13 | +#ifndef likely | |
14 | +#if __GNUC__ < 3 | |
15 | +#define __builtin_expect(x, n) (x) | |
16 | +#endif | |
17 | + | |
18 | +#define likely(x) __builtin_expect(!!(x), 1) | |
19 | +#define unlikely(x) __builtin_expect(!!(x), 0) | |
20 | +#endif | |
21 | + | |
22 | +#ifndef MIN | |
23 | +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) | |
24 | +#endif | |
25 | +#ifndef MAX | |
26 | +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) | |
27 | +#endif | |
28 | + | |
29 | +#ifndef always_inline | |
30 | +#if (__GNUC__ < 3) || defined(__APPLE__) | |
31 | +#define always_inline inline | |
32 | +#else | |
33 | +#define always_inline __attribute__ (( always_inline )) __inline__ | |
34 | +#endif | |
35 | +#endif | |
36 | +#define inline always_inline | |
37 | + | |
38 | +#ifdef __i386__ | |
39 | +#define REGPARM(n) __attribute((regparm(n))) | |
40 | +#else | |
41 | +#define REGPARM(n) | |
42 | +#endif | |
43 | + | |
6 | 44 | #define qemu_printf printf |
7 | 45 | |
8 | 46 | void *qemu_malloc(size_t size); | ... | ... |
qemu-common.h
... | ... | @@ -62,37 +62,6 @@ static inline char *realpath(const char *path, char *resolved_path) |
62 | 62 | |
63 | 63 | #endif /* !defined(NEED_CPU_H) */ |
64 | 64 | |
65 | -#ifndef glue | |
66 | -#define xglue(x, y) x ## y | |
67 | -#define glue(x, y) xglue(x, y) | |
68 | -#define stringify(s) tostring(s) | |
69 | -#define tostring(s) #s | |
70 | -#endif | |
71 | - | |
72 | -#ifndef likely | |
73 | -#if __GNUC__ < 3 | |
74 | -#define __builtin_expect(x, n) (x) | |
75 | -#endif | |
76 | - | |
77 | -#define likely(x) __builtin_expect(!!(x), 1) | |
78 | -#define unlikely(x) __builtin_expect(!!(x), 0) | |
79 | -#endif | |
80 | - | |
81 | -#ifndef MIN | |
82 | -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) | |
83 | -#endif | |
84 | -#ifndef MAX | |
85 | -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) | |
86 | -#endif | |
87 | - | |
88 | -#ifndef always_inline | |
89 | -#if (__GNUC__ < 3) || defined(__APPLE__) | |
90 | -#define always_inline inline | |
91 | -#else | |
92 | -#define always_inline __attribute__ (( always_inline )) inline | |
93 | -#endif | |
94 | -#endif | |
95 | - | |
96 | 65 | /* bottom halves */ |
97 | 66 | typedef struct QEMUBH QEMUBH; |
98 | 67 | ... | ... |