From 49e462fab2c37faa76c8c029ecb90e785d023d14 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 18 Mar 2013 10:10:15 +0000 Subject: [PATCH] tsan: fix clang -Wall build Clang does not like classes with virtual functions but w/o virtual dtor. Go does not like libstdc++ (operator delete). llvm-svn: 177267 --- compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc | 6 +++++- compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h | 3 +++ compiler-rt/lib/tsan/rtl/tsan_rtl.h | 1 + compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc index 87c36b0..3d246fe 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc @@ -22,7 +22,11 @@ ThreadContextBase::ThreadContextBase(u32 tid) name[0] = '\0'; } -ThreadContextBase::~ThreadContextBase() {} +#ifndef SANITIZER_GO +ThreadContextBase::~ThreadContextBase() { + CHECK(0); +} +#endif void ThreadContextBase::SetName(const char *new_name) { name[0] = '\0'; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h index 0e7e8c1..e2ee8f8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h @@ -34,6 +34,9 @@ enum ThreadStatus { class ThreadContextBase { public: explicit ThreadContextBase(u32 tid); +#ifndef SANITIZER_GO // Go does not have libstdc++ + virtual +#endif ~ThreadContextBase(); const u32 tid; // Thread ID. Main thread should have tid = 0. diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h index 52ecf76..0d28a9d 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -419,6 +419,7 @@ struct ThreadDeadInfo { class ThreadContext : public ThreadContextBase { public: explicit ThreadContext(int tid); + ~ThreadContext(); ThreadState *thr; #ifdef TSAN_GO StackTrace creation_stack; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc index 7f0f901..238baef 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc @@ -31,6 +31,11 @@ ThreadContext::ThreadContext(int tid) , dead_info() { } +#ifndef TSAN_GO +ThreadContext::~ThreadContext() { +} +#endif + void ThreadContext::OnDead() { sync.Reset(); } -- 2.7.4