diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-10-17 08:13:38 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-10-17 08:13:38 +0000 |
commit | 1a3f1ea833b151fc6554a7f910f8e0185f513a35 (patch) | |
tree | 2a6a85a5b916a22aec1c2385c2a44e59d8c442cc | |
parent | 782cbdca4e926cb7b640d194531a07c431990ee3 (diff) | |
download | compiler-rt-1a3f1ea833b151fc6554a7f910f8e0185f513a35.tar.gz compiler-rt-1a3f1ea833b151fc6554a7f910f8e0185f513a35.tar.bz2 compiler-rt-1a3f1ea833b151fc6554a7f910f8e0185f513a35.tar.xz |
tsan: add a test for __tsan_default_options()
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192873 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/tsan/lit_tests/default_options.cc | 32 | ||||
-rw-r--r-- | lib/tsan/rtl/tsan_flags.cc | 8 |
2 files changed, 32 insertions, 8 deletions
diff --git a/lib/tsan/lit_tests/default_options.cc b/lib/tsan/lit_tests/default_options.cc new file mode 100644 index 00000000..652a7bf1 --- /dev/null +++ b/lib/tsan/lit_tests/default_options.cc @@ -0,0 +1,32 @@ +// RUN: %clang_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <stdio.h> + +extern "C" const char *__tsan_default_options() { + return "report_bugs=0"; +} + +int Global; + +void *Thread1(void *x) { + Global = 42; + return NULL; +} + +void *Thread2(void *x) { + Global = 43; + return NULL; +} + +int main() { + pthread_t t[2]; + pthread_create(&t[0], NULL, Thread1, NULL); + pthread_create(&t[1], NULL, Thread2, NULL); + pthread_join(t[0], NULL); + pthread_join(t[1], NULL); + fprintf(stderr, "DONE\n"); + return 0; +} + +// CHECK-NOT: WARNING: ThreadSanitizer: data race +// CHECK: DONE diff --git a/lib/tsan/rtl/tsan_flags.cc b/lib/tsan/rtl/tsan_flags.cc index 247bf784..cf699f20 100644 --- a/lib/tsan/rtl/tsan_flags.cc +++ b/lib/tsan/rtl/tsan_flags.cc @@ -23,14 +23,6 @@ Flags *flags() { return &CTX()->flags; } -#if !SANITIZER_SUPPORTS_WEAK_HOOKS -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -const char* __asan_default_options() { return ""; } -} // extern "C" -#endif - - // Can be overriden in frontend. #ifdef TSAN_EXTERNAL_HOOKS void OverrideFlags(Flags *f); |