[compiler-rt] r293671 - [sanitizer] Ensure macro parameters are expanded before stringifying.

Marcos Pividori via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 10:37:08 PST 2017

Author: mpividori
Date: Tue Jan 31 12:37:07 2017
New Revision: 293671

URL: http://llvm.org/viewvc/llvm-project?rev=293671&view=rev
[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


Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h?rev=293671&r1=293670&r2=293671&view=diff
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win_defs.h Tue Jan 31 12:37:07 2017
@@ -23,7 +23,8 @@
 // Intermediate macro to ensure the parameter is expanded before stringified.
-#define STRINGIFY(A) #A
+#define STRINGIFY_(A) #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)))

More information about the llvm-commits mailing list