mirror of https://github.com/xemu-project/xemu.git
includes: Resolve some minor C++ incompatibilties
This commit is contained in:
parent
658b354723
commit
64cacd4564
|
@ -70,7 +70,7 @@
|
||||||
unsigned long name[BITS_TO_LONGS(bits)]
|
unsigned long name[BITS_TO_LONGS(bits)]
|
||||||
|
|
||||||
#define small_nbits(nbits) \
|
#define small_nbits(nbits) \
|
||||||
((nbits) <= BITS_PER_LONG)
|
((unsigned long)(nbits) <= BITS_PER_LONG)
|
||||||
|
|
||||||
int slow_bitmap_empty(const unsigned long *bitmap, long bits);
|
int slow_bitmap_empty(const unsigned long *bitmap, long bits);
|
||||||
int slow_bitmap_full(const unsigned long *bitmap, long bits);
|
int slow_bitmap_full(const unsigned long *bitmap, long bits);
|
||||||
|
@ -93,7 +93,7 @@ long slow_bitmap_count_one(const unsigned long *bitmap, long nbits);
|
||||||
static inline unsigned long *bitmap_try_new(long nbits)
|
static inline unsigned long *bitmap_try_new(long nbits)
|
||||||
{
|
{
|
||||||
long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
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)
|
static inline unsigned long *bitmap_new(long nbits)
|
||||||
|
@ -265,9 +265,9 @@ static inline unsigned long *bitmap_zero_extend(unsigned long *old,
|
||||||
long old_nbits, long new_nbits)
|
long old_nbits, long new_nbits)
|
||||||
{
|
{
|
||||||
long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long);
|
long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long);
|
||||||
unsigned long *new = g_realloc(old, new_len);
|
unsigned long *new_ = (unsigned long *)g_realloc(old, new_len);
|
||||||
bitmap_clear(new, old_nbits, new_nbits - old_nbits);
|
bitmap_clear(new_, old_nbits, new_nbits - old_nbits);
|
||||||
return new;
|
return new_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bitmap_to_le(unsigned long *dst, const unsigned long *src,
|
void bitmap_to_le(unsigned long *dst, const unsigned long *src,
|
||||||
|
|
|
@ -90,7 +90,11 @@
|
||||||
* message (but as it remains present in the source code, it can still
|
* message (but as it remains present in the source code, it can still
|
||||||
* be useful when debugging). */
|
* be useful when debugging). */
|
||||||
#if defined(CONFIG_STATIC_ASSERT)
|
#if defined(CONFIG_STATIC_ASSERT)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define QEMU_BUILD_BUG_MSG(x, msg) static_assert(!(x), msg)
|
||||||
|
#else
|
||||||
#define QEMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg)
|
#define QEMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg)
|
||||||
|
#endif
|
||||||
#elif defined(__COUNTER__)
|
#elif defined(__COUNTER__)
|
||||||
#define QEMU_BUILD_BUG_MSG(x, msg) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \
|
#define QEMU_BUILD_BUG_MSG(x, msg) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \
|
||||||
glue(qemu_build_bug_on__, __COUNTER__) __attribute__((unused))
|
glue(qemu_build_bug_on__, __COUNTER__) __attribute__((unused))
|
||||||
|
|
|
@ -527,7 +527,7 @@ static inline QEMUTimer *timer_new_full(QEMUTimerListGroup *timer_list_group,
|
||||||
int scale, int attributes,
|
int scale, int attributes,
|
||||||
QEMUTimerCB *cb, void *opaque)
|
QEMUTimerCB *cb, void *opaque)
|
||||||
{
|
{
|
||||||
QEMUTimer *ts = g_malloc0(sizeof(QEMUTimer));
|
QEMUTimer *ts = (QEMUTimer *)g_malloc0(sizeof(QEMUTimer));
|
||||||
timer_init_full(ts, timer_list_group, type, scale, attributes, cb, opaque);
|
timer_init_full(ts, timer_list_group, type, scale, attributes, cb, opaque);
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
#ifndef QEMU_OBJECT_H
|
#ifndef QEMU_OBJECT_H
|
||||||
#define QEMU_OBJECT_H
|
#define QEMU_OBJECT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define class qom_class
|
||||||
|
#define typename qom_typename
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "qapi/qapi-builtin-types.h"
|
#include "qapi/qapi-builtin-types.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
||||||
|
@ -1884,4 +1889,9 @@ char *object_property_help(const char *name, const char *type,
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Object, object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Object, object_unref)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#undef class
|
||||||
|
#undef typename
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue