[PATCH] D28596: [compiler-rt] General definition for weak functions.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 10:54:34 PST 2017
rnk added a comment.
In https://reviews.llvm.org/D28596#649052, @aizatsky wrote:
> I suggest to make WIN* macros no-op on all platforms that do not need it.
>
> #if WINDOWS
> #define WIN_WEAK_FN(...) ...
> #else
> #define WIN_WEAK_FN(...)
> #end
>
>
> And have the function definition code look like:
>
> SANITIZER_WEAK_ATTRIBUTE const char *__ubsan_default_options() { return ""; }
> WIN_WEAK_FN(__ubsan_default_options, ...)
>
>
> Notice the absence of ifdefs in the client code and C++ syntax for simple cases.
>
> How about your solution and other platforms? E.g. mac? If you want to push such a heavy interface change you at least should think through how it will solve other problems as well. Does it help other platforms? It wouldn't be great if we had to introduce another level of complexity for another platform.
I don't want it to be possible for non-Windows developers to forget to use WIN_WEAK_FN. I would prefer it if the macro wrapped the function declaration so that it can't be forgotten. The Windows build is too often broken when adding weak functions.
https://reviews.llvm.org/D28596
More information about the llvm-commits
mailing list