summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-09-18 08:33:37 +0000
committerAlexey Samsonov <samsonov@google.com>2012-09-18 08:33:37 +0000
commit3040830fcd40a0a00f954def1cbc65c66216c1ca (patch)
tree6bd9656a662b18e71dbfabd945c3af06aafcc75a
parentea05256b587e1da4593b92a6e22ec012596b7609 (diff)
downloadbcm5719-llvm-3040830fcd40a0a00f954def1cbc65c66216c1ca.tar.gz
bcm5719-llvm-3040830fcd40a0a00f954def1cbc65c66216c1ca.zip
[TSan] fix a typo in test dependencies. Silence few remaining pedantic gcc warnings in TSan tests.
llvm-svn: 164115
-rw-r--r--compiler-rt/lib/tsan/lit_tests/CMakeLists.txt2
-rw-r--r--compiler-rt/lib/tsan/tests/rtl/tsan_test.cc10
-rw-r--r--compiler-rt/lib/tsan/tests/rtl/tsan_test_util_linux.cc2
-rw-r--r--compiler-rt/lib/tsan/tests/unit/tsan_flags_test.cc4
4 files changed, 12 insertions, 6 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt b/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
index 4e3273b3ac5..1958ebf5781 100644
--- a/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/lit_tests/CMakeLists.txt
@@ -19,7 +19,7 @@ if("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}")
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}
diff --git a/compiler-rt/lib/tsan/tests/rtl/tsan_test.cc b/compiler-rt/lib/tsan/tests/rtl/tsan_test.cc
index 71641400efe..50fee84ace3 100644
--- a/compiler-rt/lib/tsan/tests/rtl/tsan_test.cc
+++ b/compiler-rt/lib/tsan/tests/rtl/tsan_test.cc
@@ -28,11 +28,13 @@ TEST(ThreadSanitizer, FuncCall) {
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 @@ int main(int argc, char **argv) {
__tsan_func_exit();
return res;
}
+
+int main(int argc, char **argv) {
+ return run_tests(argc, argv);
+}
diff --git a/compiler-rt/lib/tsan/tests/rtl/tsan_test_util_linux.cc b/compiler-rt/lib/tsan/tests/rtl/tsan_test_util_linux.cc
index 5bc393bf6c2..dce8db90de7 100644
--- a/compiler-rt/lib/tsan/tests/rtl/tsan_test_util_linux.cc
+++ b/compiler-rt/lib/tsan/tests/rtl/tsan_test_util_linux.cc
@@ -397,7 +397,7 @@ void ScopedThread::VptrUpdate(const MemLoc &vptr,
}
void ScopedThread::Call(void(*pc)()) {
- Event event(Event::CALL, (void*)pc);
+ Event event(Event::CALL, (void*)((uintptr_t)pc));
impl_->send(&event);
}
diff --git a/compiler-rt/lib/tsan/tests/unit/tsan_flags_test.cc b/compiler-rt/lib/tsan/tests/unit/tsan_flags_test.cc
index d344cb55b1b..ffb9c55b605 100644
--- a/compiler-rt/lib/tsan/tests/unit/tsan_flags_test.cc
+++ b/compiler-rt/lib/tsan/tests/unit/tsan_flags_test.cc
@@ -19,14 +19,14 @@ namespace __tsan {
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;
OpenPOWER on IntegriCloud