[PATCH] D28596: [compiler-rt] General definition for weak functions.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 16:18:36 PST 2017


mpividori added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_win_defs.h:91
+  extern "C" __declspec(dllexport)                                             \
+  ReturnType WEAK_EXPORT_NAME(Name)(__VA_ARGS__)
+
----------------
rnk wrote:
> Remind me why we need to declare the *__dll variants in headers? Can this be a .cc file implementation detail?
> 
> If we don't need to declare both foo and foo__dll, then we can get rid of WEAK_DECL and go back to something more like:
>   extern "C" void SANITIZER_WEAK_DECL sancov_blah(int params);
@rnk  I think that macro is appropriate. Every time we declare a weak function in Windows, we are declaring 2 functions. So, when we include that header, we are also including both declarations, which is what is expected.
So, for example in: https://reviews.llvm.org/D28598  when I include the header: `sanitizer_common/sanitizer_interface_internal.h` , it include both declarations, and I don't need to add extra declarations.


https://reviews.llvm.org/D28596





More information about the llvm-commits mailing list