mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-07 18:57:14 +00:00
compiler: use weak aliases to provide default definitions
This is simpler and more portable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f3192e8fb2
commit
67d223be90
@ -34,6 +34,6 @@ int tcg_available(void);
|
|||||||
int kvm_available(void);
|
int kvm_available(void);
|
||||||
int xen_available(void);
|
int xen_available(void);
|
||||||
|
|
||||||
CpuDefinitionInfoList GCC_WEAK_DECL *arch_query_cpu_definitions(Error **errp);
|
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
11
compiler.h
11
compiler.h
@ -50,16 +50,13 @@
|
|||||||
# define __printf__ __gnu_printf__
|
# define __printf__ __gnu_printf__
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#if defined(_WIN32)
|
# define QEMU_WEAK_ALIAS(newname, oldname) \
|
||||||
#define GCC_WEAK __attribute__((weak))
|
typeof(oldname) newname __attribute__((weak, alias (#oldname)))
|
||||||
#define GCC_WEAK_DECL GCC_WEAK
|
|
||||||
#else
|
|
||||||
#define GCC_WEAK __attribute__((weak))
|
|
||||||
#define GCC_WEAK_DECL
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#define GCC_ATTR /**/
|
#define GCC_ATTR /**/
|
||||||
#define GCC_FMT_ATTR(n, m)
|
#define GCC_FMT_ATTR(n, m)
|
||||||
|
#define QEMU_WEAK_ALIAS(newname, oldname) \
|
||||||
|
_Pragma("weak " #newname "=" #oldname)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* COMPILER_H */
|
#endif /* COMPILER_H */
|
||||||
|
3
qmp.c
3
qmp.c
@ -466,11 +466,12 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
|
|||||||
return prop_list;
|
return prop_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
CpuDefinitionInfoList GCC_WEAK *arch_query_cpu_definitions(Error **errp)
|
static CpuDefinitionInfoList *default_arch_query_cpu_definitions(Error **errp)
|
||||||
{
|
{
|
||||||
error_set(errp, QERR_NOT_SUPPORTED);
|
error_set(errp, QERR_NOT_SUPPORTED);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
QEMU_WEAK_ALIAS(arch_query_cpu_definitions, default_arch_query_cpu_definitions);
|
||||||
|
|
||||||
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user