summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/atomic.h10
-rw-r--r--include/qemu/bitmap.h10
-rw-r--r--include/qemu/compiler.h4
-rw-r--r--include/qemu/queue.h2
-rw-r--r--include/qemu/rcu.h6
-rw-r--r--include/qemu/timer.h4
6 files changed, 18 insertions, 18 deletions
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index bd2c075..e2125bd 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -158,13 +158,13 @@
#ifndef atomic_rcu_read
#ifdef __ATOMIC_CONSUME
#define atomic_rcu_read(ptr) ({ \
- typeof(*ptr) _val; \
+ __typeof__(*ptr) _val; \
__atomic_load(ptr, &_val, __ATOMIC_CONSUME); \
_val; \
})
#else
#define atomic_rcu_read(ptr) ({ \
- typeof(*ptr) _val = atomic_read(ptr); \
+ __typeof__(*ptr) _val = atomic_read(ptr); \
smp_read_barrier_depends(); \
_val; \
})
@@ -185,7 +185,7 @@
#ifndef atomic_rcu_set
#ifdef __ATOMIC_RELEASE
#define atomic_rcu_set(ptr, i) do { \
- typeof(*ptr) _val = (i); \
+ __typeof__(*ptr) _val = (i); \
__atomic_store(ptr, &_val, __ATOMIC_RELEASE); \
} while(0)
#else
@@ -220,7 +220,7 @@
*/
#ifndef atomic_mb_read
#define atomic_mb_read(ptr) ({ \
- typeof(*ptr) _val = atomic_read(ptr); \
+ __typeof__(*ptr) _val = atomic_read(ptr); \
smp_rmb(); \
_val; \
})
@@ -239,7 +239,7 @@
#define atomic_xchg(ptr, i) __sync_swap(ptr, i)
#elif defined(__ATOMIC_SEQ_CST)
#define atomic_xchg(ptr, i) ({ \
- typeof(*ptr) _new = (i), _old; \
+ __typeof__(*ptr) _new = (i), _old; \
__atomic_exchange(ptr, &_new, &_old, __ATOMIC_SEQ_CST); \
_old; \
})
diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h
index 86dd9cd..b53f462 100644
--- a/include/qemu/bitmap.h
+++ b/include/qemu/bitmap.h
@@ -71,7 +71,7 @@
unsigned long name[BITS_TO_LONGS(bits)]
#define small_nbits(nbits) \
- ((nbits) <= BITS_PER_LONG)
+ ((nbits) <= (long)BITS_PER_LONG)
int slow_bitmap_empty(const unsigned long *bitmap, long bits);
int slow_bitmap_full(const unsigned long *bitmap, long bits);
@@ -97,7 +97,7 @@ int slow_bitmap_intersects(const unsigned long *bitmap1,
static inline unsigned long *bitmap_try_new(long nbits)
{
long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
- return g_try_malloc0(len);
+ return (unsigned long *)g_try_malloc0(len);
}
static inline unsigned long *bitmap_new(long nbits)
@@ -241,9 +241,9 @@ static inline unsigned long *bitmap_zero_extend(unsigned long *old,
long old_nbits, long new_nbits)
{
long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long);
- unsigned long *new = g_realloc(old, new_len);
- bitmap_clear(new, old_nbits, new_nbits - old_nbits);
- return new;
+ unsigned long *new_bitmap = (unsigned long *)g_realloc(old, new_len);
+ bitmap_clear(new_bitmap, old_nbits, new_nbits - old_nbits);
+ return new_bitmap;
}
#endif /* BITMAP_H */
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index d22eb01..0abf0f8 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -60,7 +60,7 @@
#ifndef container_of
#define container_of(ptr, type, member) ({ \
- const typeof(((type *) 0)->member) *__mptr = (ptr); \
+ const __typeof__(((type *) 0)->member) *__mptr = (ptr); \
(type *) ((char *) __mptr - offsetof(type, member));})
#endif
@@ -74,7 +74,7 @@
#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
#endif
-#define typeof_field(type, field) typeof(((type *)0)->field)
+#define typeof_field(type, field) __typeof__(((type *)0)->field)
#define type_check(t1,t2) ((t1*)0 - (t2*)0)
#ifndef always_inline
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index f781aa2..b56bce5 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -198,7 +198,7 @@ struct { \
} while (/*CONSTCOND*/0)
#define QSLIST_INSERT_HEAD_ATOMIC(head, elm, field) do { \
- typeof(elm) save_sle_next; \
+ __typeof__(elm) save_sle_next; \
do { \
save_sle_next = (elm)->field.sle_next = (head)->slh_first; \
} while (atomic_cmpxchg(&(head)->slh_first, save_sle_next, (elm)) != \
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
index f6d1d56..0d9f677 100644
--- a/include/qemu/rcu.h
+++ b/include/qemu/rcu.h
@@ -135,8 +135,8 @@ extern void call_rcu1(struct rcu_head *head, RCUCBFunc *func);
#define call_rcu(head, func, field) \
call_rcu1(({ \
char __attribute__((unused)) \
- offset_must_be_zero[-offsetof(typeof(*(head)), field)], \
- func_type_invalid = (func) - (void (*)(typeof(head)))(func); \
+ offset_must_be_zero[-offsetof(__typeof__(*(head)), field)], \
+ func_type_invalid = (func) - (void (*)(__typeof__(head)))(func); \
&(head)->field; \
}), \
(RCUCBFunc *)(func))
@@ -144,7 +144,7 @@ extern void call_rcu1(struct rcu_head *head, RCUCBFunc *func);
#define g_free_rcu(obj, field) \
call_rcu1(({ \
char __attribute__((unused)) \
- offset_must_be_zero[-offsetof(typeof(*(obj)), field)]; \
+ offset_must_be_zero[-offsetof(__typeof__(*(obj)), field)]; \
&(obj)->field; \
}), \
(RCUCBFunc *)g_free);
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index d0946cb..a16effa 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -523,7 +523,7 @@ static inline QEMUTimer *timer_new_tl(QEMUTimerList *timer_list,
QEMUTimerCB *cb,
void *opaque)
{
- QEMUTimer *ts = g_malloc0(sizeof(QEMUTimer));
+ QEMUTimer *ts = (QEMUTimer *)g_malloc0(sizeof(QEMUTimer));
timer_init_tl(ts, timer_list, scale, cb, opaque);
return ts;
}
@@ -965,7 +965,7 @@ static inline int64_t cpu_get_host_ticks (void)
#define MIPS_RDHWR(rd, value) { \
__asm__ __volatile__ (".set push\n\t" \
".set mips32r2\n\t" \
- "rdhwr %0, "rd"\n\t" \
+ "rdhwr %0, " rd "\n\t" \
".set pop" \
: "=r" (value)); \
}
OpenPOWER on IntegriCloud