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