[llvm-commits] [compiler-rt] r164115 - in /compiler-rt/trunk/lib/tsan: lit_tests/CMakeLists.txt tests/rtl/tsan_test.cc tests/rtl/tsan_test_util_linux.cc tests/unit/tsan_flags_test.cc

Alexey Samsonov samsonov at google.com
Tue Sep 18 01:33:38 PDT 2012


Author: samsonov
Date: Tue Sep 18 03:33:37 2012
New Revision: 164115

URL: http://llvm.org/viewvc/llvm-project?rev=164115&view=rev
Log:
[TSan] fix a typo in test dependencies. Silence few remaining pedantic gcc warnings in TSan tests.

Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test.cc
    compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test_util_linux.cc
    compiler-rt/trunk/lib/tsan/tests/unit/tsan_flags_test.cc

Modified: compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt?rev=164115&r1=164114&r2=164115&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/CMakeLists.txt Tue Sep 18 03:33:37 2012
@@ -19,7 +19,7 @@
     tsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     )
   if(LLVM_INCLUDE_TESTS)
-    list(APPEND ASAN_TEST_DEPS TsanUnitTests)
+    list(APPEND TSAN_TEST_DEPS TsanUnitTests)
   endif()
   add_lit_testsuite(check-tsan "Running ThreadSanitizer tests"
     ${CMAKE_CURRENT_BINARY_DIR}

Modified: compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test.cc?rev=164115&r1=164114&r2=164115&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test.cc Tue Sep 18 03:33:37 2012
@@ -28,11 +28,13 @@
   t2.Return();
 }
 
-int main(int argc, char **argv) {
+// We use this function instead of main, as ISO C++ forbids taking the address
+// of main, which we need to pass inside __tsan_func_entry.
+int run_tests(int argc, char **argv) {
   TestMutexBeforeInit();  // Mutexes must be usable before __tsan_init();
   __tsan_init();
   __tsan_func_entry(__builtin_return_address(0));
-  __tsan_func_entry((char*)&main + 1);
+  __tsan_func_entry((void*)((uintptr_t)&run_tests + 1));
 
   testing::GTEST_FLAG(death_test_style) = "threadsafe";
   testing::InitGoogleTest(&argc, argv);
@@ -42,3 +44,7 @@
   __tsan_func_exit();
   return res;
 }
+
+int main(int argc, char **argv) {
+  return run_tests(argc, argv);
+}

Modified: compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test_util_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test_util_linux.cc?rev=164115&r1=164114&r2=164115&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test_util_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/tests/rtl/tsan_test_util_linux.cc Tue Sep 18 03:33:37 2012
@@ -397,7 +397,7 @@
 }
 
 void ScopedThread::Call(void(*pc)()) {
-  Event event(Event::CALL, (void*)pc);
+  Event event(Event::CALL, (void*)((uintptr_t)pc));
   impl_->send(&event);
 }
 

Modified: compiler-rt/trunk/lib/tsan/tests/unit/tsan_flags_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/unit/tsan_flags_test.cc?rev=164115&r1=164114&r2=164115&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/unit/tsan_flags_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/tests/unit/tsan_flags_test.cc Tue Sep 18 03:33:37 2012
@@ -19,14 +19,14 @@
 TEST(Flags, Basic) {
   ScopedInRtl in_rtl;
   // At least should not crash.
-  Flags f = {};
+  Flags f;
   InitializeFlags(&f, 0);
   InitializeFlags(&f, "");
 }
 
 TEST(Flags, DefaultValues) {
   ScopedInRtl in_rtl;
-  Flags f = {};
+  Flags f;
 
   f.enable_annotations = false;
   f.exitcode = -11;





More information about the llvm-commits mailing list