summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_win_defs.h
diff options
context:
space:
mode:
authorMarcos Pividori <mpividori@google.com>2017-01-31 18:37:07 +0000
committerMarcos Pividori <mpividori@google.com>2017-01-31 18:37:07 +0000
commite09f77e3fabeb98a65936f7bd88e1fe4512489d7 (patch)
tree1d5838221ad2dbcf272ae5fe37e1977fd4d402e6 /lib/sanitizer_common/sanitizer_win_defs.h
parent7fea2f576da853f3b0044ed6bb0331012f9f62b6 (diff)
[sanitizer] Ensure macro parameters are expanded before stringifying.
Add auxiliary macro to ensure parameters are expanded before stringifying. Differential Revision: https://reviews.llvm.org/D29312 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_win_defs.h')
-rw-r--r--lib/sanitizer_common/sanitizer_win_defs.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_win_defs.h b/lib/sanitizer_common/sanitizer_win_defs.h
index 161853251..9f067edff 100644
--- a/lib/sanitizer_common/sanitizer_win_defs.h
+++ b/lib/sanitizer_common/sanitizer_win_defs.h
@@ -23,7 +23,8 @@
#endif
// Intermediate macro to ensure the parameter is expanded before stringified.
-#define STRINGIFY(A) #A
+#define STRINGIFY_(A) #A
+#define STRINGIFY(A) STRINGIFY_(A)
// ----------------- A workaround for the absence of weak symbols --------------
// We don't have a direct equivalent of weak symbols when using MSVC, but we can
@@ -45,13 +46,10 @@
// So, a workaround is to force linkage with the modules that include weak
// definitions, with the following macro: WIN_FORCE_LINK()
-#define WIN_WEAK_ALIAS_(Name, Default) \
+#define WIN_WEAK_ALIAS(Name, Default) \
__pragma(comment(linker, "/alternatename:" WIN_SYM_PREFIX STRINGIFY(Name) "="\
WIN_SYM_PREFIX STRINGIFY(Default)))
-#define WIN_WEAK_ALIAS(Name, Default) \
- WIN_WEAK_ALIAS_(Name, Default)
-
#define WIN_FORCE_LINK(Name) \
__pragma(comment(linker, "/include:" WIN_SYM_PREFIX STRINGIFY(Name)))