[compiler-rt] r371446 - [TSan] Add AnnotateIgnoreReadsBegin declaration to tsan/test.h

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 13:07:03 PDT 2019


Author: yln
Date: Mon Sep  9 13:07:03 2019
New Revision: 371446

URL: http://llvm.org/viewvc/llvm-project?rev=371446&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/test/tsan/Darwin/mach_vm_allocate.c
    compiler-rt/trunk/test/tsan/ignore_free.cpp
    compiler-rt/trunk/test/tsan/ignore_malloc.cpp
    compiler-rt/trunk/test/tsan/ignore_race.cpp
    compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp
    compiler-rt/trunk/test/tsan/test.h

Modified: compiler-rt/trunk/test/tsan/Darwin/mach_vm_allocate.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/mach_vm_allocate.c?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/mach_vm_allocate.c (original)
+++ compiler-rt/trunk/test/tsan/Darwin/mach_vm_allocate.c Mon Sep  9 13:07:03 2019
@@ -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);
 

Modified: compiler-rt/trunk/test/tsan/ignore_free.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignore_free.cpp?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignore_free.cpp (original)
+++ compiler-rt/trunk/test/tsan/ignore_free.cpp Mon Sep  9 13:07:03 2019
@@ -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);

Modified: compiler-rt/trunk/test/tsan/ignore_malloc.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignore_malloc.cpp?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignore_malloc.cpp (original)
+++ compiler-rt/trunk/test/tsan/ignore_malloc.cpp Mon Sep  9 13:07:03 2019
@@ -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) {

Modified: compiler-rt/trunk/test/tsan/ignore_race.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignore_race.cpp?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignore_race.cpp (original)
+++ compiler-rt/trunk/test/tsan/ignore_race.cpp Mon Sep  9 13:07:03 2019
@@ -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__);

Modified: compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp (original)
+++ compiler-rt/trunk/test/tsan/ignored-interceptors-mmap.cpp Mon Sep  9 13:07:03 2019
@@ -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.

Modified: compiler-rt/trunk/test/tsan/test.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test.h?rev=371446&r1=371445&r2=371446&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test.h (original)
+++ compiler-rt/trunk/test/tsan/test.h Mon Sep  9 13:07:03 2019
@@ -75,6 +75,11 @@ void AnnotateRWLockDestroy(const char *f
 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




More information about the llvm-commits mailing list