aboutsummaryrefslogtreecommitdiff
path: root/compiler.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-08-14 22:17:36 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2012-08-15 13:26:03 -0500
commit76b64a7aa84965ee9c7594058a43b00c2a14c72e (patch)
treeee5e9b954e92ace0090d47aa811c76129da8e34f /compiler.h
parentd1186a33efa74c91b01e1b5d9918c61d109f1b54 (diff)
win32: provide separate macros for weak decls and definitions
mingw32 seems to want the declaration to also carry the weak attribute. Strangely, gcc on Linux absolutely does not want the declaration to be marked as weak. This may not be the right fix, but it seems to do the trick. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'compiler.h')
-rw-r--r--compiler.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler.h b/compiler.h
index f76921e5b0..07ba1f8113 100644
--- a/compiler.h
+++ b/compiler.h
@@ -45,7 +45,13 @@
# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
# 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
#else
#define GCC_ATTR /**/
#define GCC_FMT_ATTR(n, m)