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

Mike Aizatsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 17:08:29 PST 2017


aizatsky added a comment.

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.


https://reviews.llvm.org/D28596





More information about the llvm-commits mailing list