From 6f2741c6325e0112f52b537444e1aaac8e746f85 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 14 Oct 2013 09:52:40 +0000 Subject: tsan: allow to override OnPrint() callback in Go runtime git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192576 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_printf.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/sanitizer_common/sanitizer_printf.cc') diff --git a/lib/sanitizer_common/sanitizer_printf.cc b/lib/sanitizer_common/sanitizer_printf.cc index e2331291b..4f3968ad2 100644 --- a/lib/sanitizer_common/sanitizer_printf.cc +++ b/lib/sanitizer_common/sanitizer_printf.cc @@ -195,17 +195,22 @@ void SetPrintfAndReportCallback(void (*callback)(const char *)) { 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); } -- cgit v1.2.3