tsan: fix clang -Wall build
authorDmitry Vyukov <dvyukov@google.com>
Mon, 18 Mar 2013 10:10:15 +0000 (10:10 +0000)
committerDmitry Vyukov <dvyukov@google.com>
Mon, 18 Mar 2013 10:10:15 +0000 (10:10 +0000)
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
compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
compiler-rt/lib/tsan/rtl/tsan_rtl.h
compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc

index 87c36b0..3d246fe 100644 (file)
@@ -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';
index 0e7e8c1..e2ee8f8 100644 (file)
@@ -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.
index 52ecf76..0d28a9d 100644 (file)
@@ -419,6 +419,7 @@ struct ThreadDeadInfo {
 class ThreadContext : public ThreadContextBase {
  public:
   explicit ThreadContext(int tid);
+  ~ThreadContext();
   ThreadState *thr;
 #ifdef TSAN_GO
   StackTrace creation_stack;
index 7f0f901..238baef 100644 (file)
@@ -31,6 +31,11 @@ ThreadContext::ThreadContext(int tid)
   , dead_info() {
 }
 
+#ifndef TSAN_GO
+ThreadContext::~ThreadContext() {
+}
+#endif
+
 void ThreadContext::OnDead() {
   sync.Reset();
 }