2 * tsan_annotations.cpp -- ThreadSanitizer annotations to support data
3 * race detection in OpenMP programs.
6 //===----------------------------------------------------------------------===//
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
12 //===----------------------------------------------------------------------===//
14 #include "tsan_annotations.h"
18 typedef unsigned long uptr;
19 typedef signed long sptr;
21 extern "C" __attribute__((weak)) void AnnotateHappensBefore(const char *f,
23 extern "C" __attribute__((weak)) void AnnotateHappensAfter(const char *f, int l,
25 extern "C" __attribute__((weak)) void AnnotateCondVarSignal(const char *f,
27 extern "C" __attribute__((weak)) void AnnotateCondVarSignalAll(const char *f,
30 extern "C" __attribute__((weak)) void AnnotateMutexIsNotPHB(const char *f,
32 extern "C" __attribute__((weak)) void AnnotateCondVarWait(const char *f, int l,
33 uptr cv, uptr lock) {}
34 extern "C" __attribute__((weak)) void AnnotateRWLockCreate(const char *f, int l,
36 extern "C" __attribute__((weak)) void
37 AnnotateRWLockCreateStatic(const char *f, int l, uptr m) {}
38 extern "C" __attribute__((weak)) void AnnotateRWLockDestroy(const char *f,
40 extern "C" __attribute__((weak)) void
41 AnnotateRWLockAcquired(const char *f, int l, uptr m, uptr is_w) {}
42 extern "C" __attribute__((weak)) void
43 AnnotateRWLockReleased(const char *f, int l, uptr m, uptr is_w) {}
44 extern "C" __attribute__((weak)) void AnnotateTraceMemory(const char *f, int l,
46 extern "C" __attribute__((weak)) void AnnotateFlushState(const char *f, int l) {
48 extern "C" __attribute__((weak)) void AnnotateNewMemory(const char *f, int l,
49 uptr mem, uptr size) {}
50 extern "C" __attribute__((weak)) void AnnotateNoOp(const char *f, int l,
52 extern "C" __attribute__((weak)) void AnnotateFlushExpectedRaces(const char *f,
54 extern "C" __attribute__((weak)) void
55 AnnotateEnableRaceDetection(const char *f, int l, int enable) {}
56 extern "C" __attribute__((weak)) void
57 AnnotateMutexIsUsedAsCondVar(const char *f, int l, uptr mu) {}
58 extern "C" __attribute__((weak)) void AnnotatePCQGet(const char *f, int l,
60 extern "C" __attribute__((weak)) void AnnotatePCQPut(const char *f, int l,
62 extern "C" __attribute__((weak)) void AnnotatePCQDestroy(const char *f, int l,
64 extern "C" __attribute__((weak)) void AnnotatePCQCreate(const char *f, int l,
66 extern "C" __attribute__((weak)) void AnnotateExpectRace(const char *f, int l,
67 uptr mem, char *desc) {
69 extern "C" __attribute__((weak)) void
70 AnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr size, char *desc) {
72 extern "C" __attribute__((weak)) void AnnotateBenignRace(const char *f, int l,
73 uptr mem, char *desc) {
75 extern "C" __attribute__((weak)) void AnnotateIgnoreReadsBegin(const char *f,
77 extern "C" __attribute__((weak)) void AnnotateIgnoreReadsEnd(const char *f,
79 extern "C" __attribute__((weak)) void AnnotateIgnoreWritesBegin(const char *f,
81 extern "C" __attribute__((weak)) void AnnotateIgnoreWritesEnd(const char *f,
83 extern "C" __attribute__((weak)) void AnnotateIgnoreSyncBegin(const char *f,
85 extern "C" __attribute__((weak)) void AnnotateIgnoreSyncEnd(const char *f,
87 extern "C" __attribute__((weak)) void
88 AnnotatePublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
89 extern "C" __attribute__((weak)) void
90 AnnotateUnpublishMemoryRange(const char *f, int l, uptr addr, uptr size) {}
91 extern "C" __attribute__((weak)) void AnnotateThreadName(const char *f, int l,
93 extern "C" __attribute__((weak)) void
94 WTFAnnotateHappensBefore(const char *f, int l, uptr addr) {}
95 extern "C" __attribute__((weak)) void
96 WTFAnnotateHappensAfter(const char *f, int l, uptr addr) {}
97 extern "C" __attribute__((weak)) void
98 WTFAnnotateBenignRaceSized(const char *f, int l, uptr mem, uptr sz,
100 extern "C" __attribute__((weak)) int RunningOnValgrind() { return 0; }
101 extern "C" __attribute__((weak)) double ValgrindSlowdown(void) { return 0; }
102 extern "C" __attribute__((weak)) const char __attribute__((weak)) *
103 ThreadSanitizerQuery(const char *query) {
106 extern "C" __attribute__((weak)) void
107 AnnotateMemoryIsInitialized(const char *f, int l, uptr mem, uptr sz) {}