summaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-29 15:11:30 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-10-30 09:18:43 +0100
commit67d223be90178f7142b4f566358cea446af8df74 (patch)
treef8ac837c1e6ef1629810bc646256efc4dbf4da36 /compiler.h
parentf3192e8fb28529dd4fd777f916c437f49098ad39 (diff)
downloadqemu-67d223be90178f7142b4f566358cea446af8df74.tar.gz
compiler: use weak aliases to provide default definitions
This is simpler and more portable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler.h b/compiler.h
index c734a71c67..58865d65e8 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 */