• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * tsan_annotations.cpp -- ThreadSanitizer annotations to support data
3  * race detection in OpenMP programs.
4  */
5 
6 //===----------------------------------------------------------------------===//
7 //
8 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See https://llvm.org/LICENSE.txt for license information.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "tsan_annotations.h"
15 
16 #include <stdio.h>
17 
18 typedef unsigned long uptr;
19 typedef signed long sptr;
20 
AnnotateHappensBefore(const char * f,int l,uptr addr)21 extern "C" __attribute__((weak)) void AnnotateHappensBefore(const char *f,
22                                                             int l, uptr addr) {}
AnnotateHappensAfter(const char * f,int l,uptr addr)23 extern "C" __attribute__((weak)) void AnnotateHappensAfter(const char *f, int l,
24                                                            uptr addr) {}
AnnotateCondVarSignal(const char * f,int l,uptr cv)25 extern "C" __attribute__((weak)) void AnnotateCondVarSignal(const char *f,
26                                                             int l, uptr cv) {}
AnnotateCondVarSignalAll(const char * f,int l,uptr cv)27 extern "C" __attribute__((weak)) void AnnotateCondVarSignalAll(const char *f,
28                                                                int l, uptr cv) {
29 }
AnnotateMutexIsNotPHB(const char * f,int l,uptr mu)30 extern "C" __attribute__((weak)) void AnnotateMutexIsNotPHB(const char *f,
31                                                             int l, uptr mu) {}
AnnotateCondVarWait(const char * f,int l,uptr cv,uptr lock)32 extern "C" __attribute__((weak)) void AnnotateCondVarWait(const char *f, int l,
33                                                           uptr cv, uptr lock) {}
AnnotateRWLockCreate(const char * f,int l,uptr m)34 extern "C" __attribute__((weak)) void AnnotateRWLockCreate(const char *f, int l,
35                                                            uptr m) {}
36 extern "C" __attribute__((weak)) void
AnnotateRWLockCreateStatic(const char * f,int l,uptr m)37 AnnotateRWLockCreateStatic(const char *f, int l, uptr m) {}
AnnotateRWLockDestroy(const char * f,int l,uptr m)38 extern "C" __attribute__((weak)) void AnnotateRWLockDestroy(const char *f,
39                                                             int l, uptr m) {}
40 extern "C" __attribute__((weak)) void
AnnotateRWLockAcquired(const char * f,int l,uptr m,uptr is_w)41 AnnotateRWLockAcquired(const char *f, int l, uptr m, uptr is_w) {}
42 extern "C" __attribute__((weak)) void
AnnotateRWLockReleased(const char * f,int l,uptr m,uptr is_w)43 AnnotateRWLockReleased(const char *f, int l, uptr m, uptr is_w) {}
AnnotateTraceMemory(const char * f,int l,uptr mem)44 extern "C" __attribute__((weak)) void AnnotateTraceMemory(const char *f, int l,
45                                                           uptr mem) {}
AnnotateFlushState(const char * f,int l)46 extern "C" __attribute__((weak)) void AnnotateFlushState(const char *f, int l) {
47 }
AnnotateNewMemory(const char * f,int l,uptr mem,uptr size)48 extern "C" __attribute__((weak)) void AnnotateNewMemory(const char *f, int l,
49                                                         uptr mem, uptr size) {}
AnnotateNoOp(const char * f,int l,uptr mem)50 extern "C" __attribute__((weak)) void AnnotateNoOp(const char *f, int l,
51                                                    uptr mem) {}
AnnotateFlushExpectedRaces(const char * f,int l)52 extern "C" __attribute__((weak)) void AnnotateFlushExpectedRaces(const char *f,
53                                                                  int l) {}
54 extern "C" __attribute__((weak)) void
AnnotateEnableRaceDetection(const char * f,int l,int enable)55 AnnotateEnableRaceDetection(const char *f, int l, int enable) {}
56 extern "C" __attribute__((weak)) void
AnnotateMutexIsUsedAsCondVar(const char * f,int l,uptr mu)57 AnnotateMutexIsUsedAsCondVar(const char *f, int l, uptr mu) {}
AnnotatePCQGet(const char * f,int l,uptr pcq)58 extern "C" __attribute__((weak)) void AnnotatePCQGet(const char *f, int l,
59                                                      uptr pcq) {}
AnnotatePCQPut(const char * f,int l,uptr pcq)60 extern "C" __attribute__((weak)) void AnnotatePCQPut(const char *f, int l,
61                                                      uptr pcq) {}
AnnotatePCQDestroy(const char * f,int l,uptr pcq)62 extern "C" __attribute__((weak)) void AnnotatePCQDestroy(const char *f, int l,
63                                                          uptr pcq) {}
AnnotatePCQCreate(const char * f,int l,uptr pcq)64 extern "C" __attribute__((weak)) void AnnotatePCQCreate(const char *f, int l,
65                                                         uptr pcq) {}
AnnotateExpectRace(const char * f,int l,uptr mem,char * desc)66 extern "C" __attribute__((weak)) void AnnotateExpectRace(const char *f, int l,
67                                                          uptr mem, char *desc) {
68 }
69 extern "C" __attribute__((weak)) void
AnnotateBenignRaceSized(const char * f,int l,uptr mem,uptr size,char * desc)70 AnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr size, char *desc) {
71 }
AnnotateBenignRace(const char * f,int l,uptr mem,char * desc)72 extern "C" __attribute__((weak)) void AnnotateBenignRace(const char *f, int l,
73                                                          uptr mem, char *desc) {
74 }
AnnotateIgnoreReadsBegin(const char * f,int l)75 extern "C" __attribute__((weak)) void AnnotateIgnoreReadsBegin(const char *f,
76                                                                int l) {}
AnnotateIgnoreReadsEnd(const char * f,int l)77 extern "C" __attribute__((weak)) void AnnotateIgnoreReadsEnd(const char *f,
78                                                              int l) {}
AnnotateIgnoreWritesBegin(const char * f,int l)79 extern "C" __attribute__((weak)) void AnnotateIgnoreWritesBegin(const char *f,
80                                                                 int l) {}
AnnotateIgnoreWritesEnd(const char * f,int l)81 extern "C" __attribute__((weak)) void AnnotateIgnoreWritesEnd(const char *f,
82                                                               int l) {}
AnnotateIgnoreSyncBegin(const char * f,int l)83 extern "C" __attribute__((weak)) void AnnotateIgnoreSyncBegin(const char *f,
84                                                               int l) {}
AnnotateIgnoreSyncEnd(const char * f,int l)85 extern "C" __attribute__((weak)) void AnnotateIgnoreSyncEnd(const char *f,
86                                                             int l) {}
87 extern "C" __attribute__((weak)) void
AnnotatePublishMemoryRange(const char * f,int l,uptr addr,uptr size)88 AnnotatePublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
89 extern "C" __attribute__((weak)) void
AnnotateUnpublishMemoryRange(const char * f,int l,uptr addr,uptr size)90 AnnotateUnpublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
AnnotateThreadName(const char * f,int l,char * name)91 extern "C" __attribute__((weak)) void AnnotateThreadName(const char *f, int l,
92                                                          char *name) {}
93 extern "C" __attribute__((weak)) void
WTFAnnotateHappensBefore(const char * f,int l,uptr addr)94 WTFAnnotateHappensBefore(const char *f, int l, uptr addr) {}
95 extern "C" __attribute__((weak)) void
WTFAnnotateHappensAfter(const char * f,int l,uptr addr)96 WTFAnnotateHappensAfter(const char *f, int l, uptr addr) {}
97 extern "C" __attribute__((weak)) void
WTFAnnotateBenignRaceSized(const char * f,int l,uptr mem,uptr sz,char * desc)98 WTFAnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr sz,
99                            char *desc) {}
RunningOnValgrind()100 extern "C" __attribute__((weak)) int RunningOnValgrind() { return 0; }
ValgrindSlowdown(void)101 extern "C" __attribute__((weak)) double ValgrindSlowdown(void) { return 0; }
102 extern "C" __attribute__((weak)) const char __attribute__((weak)) *
ThreadSanitizerQuery(const char * query)103     ThreadSanitizerQuery(const char *query) {
104   return 0;
105 }
106 extern "C" __attribute__((weak)) void
AnnotateMemoryIsInitialized(const char * f,int l,uptr mem,uptr sz)107 AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz) {}
108