[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / ignore_race.cc
blob23d74d0ed84077e308acd607e9068727bfda2557
1 // RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <unistd.h>
6 int Global;
8 extern "C" void AnnotateIgnoreWritesBegin(const char *f, int l);
9 extern "C" void AnnotateIgnoreWritesEnd(const char *f, int l);
10 extern "C" void AnnotateIgnoreReadsBegin(const char *f, int l);
11 extern "C" void AnnotateIgnoreReadsEnd(const char *f, int l);
13 void *Thread(void *x) {
14 AnnotateIgnoreWritesBegin(__FILE__, __LINE__);
15 AnnotateIgnoreReadsBegin(__FILE__, __LINE__);
16 Global = 42;
17 AnnotateIgnoreReadsEnd(__FILE__, __LINE__);
18 AnnotateIgnoreWritesEnd(__FILE__, __LINE__);
19 return 0;
22 int main() {
23 pthread_t t;
24 pthread_create(&t, 0, Thread, 0);
25 sleep(1);
26 Global = 43;
27 pthread_join(t, 0);
28 printf("OK\n");
31 // CHECK-NOT: WARNING: ThreadSanitizer: data race