diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-10-14 09:52:40 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-10-14 09:52:40 +0000 |
commit | 6f2741c6325e0112f52b537444e1aaac8e746f85 (patch) | |
tree | 8012bcca86f8898e8930d7a9343735c5626a5a70 /lib/sanitizer_common/sanitizer_printf.cc | |
parent | d09c91ac4e2f544651921b7cb307e8aaae8948d1 (diff) |
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
Diffstat (limited to 'lib/sanitizer_common/sanitizer_printf.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_printf.cc | 15 |
1 files changed, 10 insertions, 5 deletions
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); } |