[compiler-rt] r192576 - tsan: allow to override OnPrint() callback in Go runtime
Dmitry Vyukov
dvyukov at google.com
Mon Oct 14 02:52:40 PDT 2013
Author: dvyukov
Date: Mon Oct 14 04:52:40 2013
New Revision: 192576
URL: http://llvm.org/viewvc/llvm-project?rev=192576&view=rev
Log:
tsan: allow to override OnPrint() callback in Go runtime
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc?rev=192576&r1=192575&r2=192576&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_printf.cc Mon Oct 14 04:52:40 2013
@@ -195,17 +195,22 @@ void SetPrintfAndReportCallback(void (*c
PrintfAndReportCallback = callback;
}
-#if SANITIZER_SUPPORTS_WEAK_HOOKS
// Can be overriden in frontend.
+#if SANITIZER_SUPPORTS_WEAK_HOOKS
SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+void OnPrint(const char *str) {
+ (void)str;
+}
+#elif defined(SANITIZER_GO) && defined(TSAN_EXTERNAL_HOOKS)
void OnPrint(const char *str);
+#else
+void OnPrint(const char *str) {
+ (void)str;
+}
#endif
static void CallPrintfAndReportCallback(const char *str) {
-#if SANITIZER_SUPPORTS_WEAK_HOOKS
- if (&OnPrint != NULL)
- OnPrint(str);
-#endif
+ OnPrint(str);
if (PrintfAndReportCallback)
PrintfAndReportCallback(str);
}
More information about the llvm-commits
mailing list