From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 03/11] compiler: use weak aliases to provide default definitions
Date: Mon, 29 Oct 2012 19:07:10 +0100 [thread overview]
Message-ID: <1351534038-15503-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1351534038-15503-1-git-send-email-pbonzini@redhat.com>
This is simpler and more portable.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch_init.h | 2 +-
compiler.h | 11 ++++-------
qmp.c | 3 ++-
3 file modificati, 7 inserzioni(+), 9 rimozioni(-)
diff --git a/arch_init.h b/arch_init.h
index d9c572a..5fc780c 100644
--- a/arch_init.h
+++ b/arch_init.h
@@ -34,6 +34,6 @@ int tcg_available(void);
int kvm_available(void);
int xen_available(void);
-CpuDefinitionInfoList GCC_WEAK_DECL *arch_query_cpu_definitions(Error **errp);
+CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
#endif
diff --git a/compiler.h b/compiler.h
index c734a71..58865d6 100644
--- a/compiler.h
+++ b/compiler.h
@@ -50,16 +50,13 @@
# define __printf__ __gnu_printf__
# endif
# endif
-#if defined(_WIN32)
-#define GCC_WEAK __attribute__((weak))
-#define GCC_WEAK_DECL GCC_WEAK
-#else
-#define GCC_WEAK __attribute__((weak))
-#define GCC_WEAK_DECL
-#endif
+# define QEMU_WEAK_ALIAS(newname, oldname) \
+ typeof(oldname) newname __attribute__((weak, alias (#oldname)))
#else
#define GCC_ATTR /**/
#define GCC_FMT_ATTR(n, m)
+#define QEMU_WEAK_ALIAS(newname, oldname) \
+ _Pragma("weak " #newname "=" #oldname)
#endif
#endif /* COMPILER_H */
diff --git a/qmp.c b/qmp.c
index d8a3c00..638888a 100644
--- a/qmp.c
+++ b/qmp.c
@@ -471,11 +471,12 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
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);
return NULL;
}
+QEMU_WEAK_ALIAS(arch_query_cpu_definitions, default_arch_query_cpu_definitions);
CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
{
--
1.7.12.1
next prev parent reply other threads:[~2012-10-29 18:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 18:07 [Qemu-devel] [PATCH 00/11] Trim dependencies of qemu-ga, vscclient, tests Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 01/11] janitor: move iovector functions out of cutils.c Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 02/11] build: move cutils.o and qemu-timer-common.o to oslib-obj-y Paolo Bonzini
2012-10-29 18:07 ` Paolo Bonzini [this message]
2012-10-29 18:07 ` [Qemu-devel] [PATCH 04/11] sockets: use weak aliases instead of qemu-tool.c Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 05/11] fdsets: use weak aliases instead of qemu-tool.c/qemu-user.c Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 06/11] iohandler: add weak alias in qemu-sockets.c, for qemu-ga Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 07/11] win32: add weak version of qemu_fd_register Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 08/11] qemu-timer: make initialization functions idempotent Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 09/11] main-loop: unify qemu_init_main_loop between QEMU and tools Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 10/11] qemu-tool: do not depend on qemu-timer.c Paolo Bonzini
2012-10-29 18:07 ` [Qemu-devel] [PATCH 11/11] build: do not include main loop where it is not actually used Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351534038-15503-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).