Skip to content
Permalink
Browse files

[TSan] Add AnnotateIgnoreReadsBegin declaration to tsan/test.h

Declare the family of AnnotateIgnore[Read,Write][Begin,End] TSan
annotations in compiler-rt/test/tsan/test.h so that we don't have to
declare them separately in every test that needs them.  Replace usages.

Leave usages that explicitly test the annotation mechanism:
  thread_end_with_ignore.cpp
  thread_end_with_ignore3.cpp

llvm-svn: 371446
  • Loading branch information...
yln committed Sep 9, 2019
1 parent eae609e commit 6d04ee0f86382a7af9a1063b5d47d146e5c70dda
@@ -11,11 +11,6 @@

#include "../test.h"

void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);

static int *global_ptr;
const mach_vm_size_t alloc_size = sizeof(int);

@@ -1,13 +1,6 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"

extern "C" {
void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);
}

void *Thread(void *p) {
*(int*)p = 42;
barrier_wait(&barrier);
@@ -1,13 +1,6 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"

extern "C" {
void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);
}

int *g;

void *Thread(void *a) {
@@ -3,11 +3,6 @@

int Global;

extern "C" void AnnotateIgnoreWritesBegin(const char *f, int l);
extern "C" void AnnotateIgnoreWritesEnd(const char *f, int l);
extern "C" void AnnotateIgnoreReadsBegin(const char *f, int l);
extern "C" void AnnotateIgnoreReadsEnd(const char *f, int l);

void *Thread(void *x) {
AnnotateIgnoreWritesBegin(__FILE__, __LINE__);
AnnotateIgnoreReadsBegin(__FILE__, __LINE__);
@@ -10,13 +10,6 @@

#include "test.h"

extern "C" {
void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);
}

// Use atomic to ensure we do not have a race for the pointer value itself. We
// only want to check races in the mmap'd memory to isolate the test that mmap
// respects ignore annotations.
@@ -75,6 +75,11 @@ void AnnotateRWLockDestroy(const char *f, int l, void *m);
void AnnotateRWLockAcquired(const char *f, int l, void *m, long is_w);
void AnnotateRWLockReleased(const char *f, int l, void *m, long is_w);

void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);

#ifdef __cplusplus
}
#endif

0 comments on commit 6d04ee0

Please sign in to comment.
You can’t perform that action at this time.