Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: base/third_party/dynamic_annotations/dynamic_annotations.h

Issue 6250125: Update the dynamic annotations to the trunk version from... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/third_party/dynamic_annotations/dynamic_annotations.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2008-2009, Google Inc. 1 /* Copyright (c) 2008-2009, Google Inc.
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 This file supports the following dynamic analysis tools: 46 This file supports the following dynamic analysis tools:
47 - None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero). 47 - None (DYNAMIC_ANNOTATIONS_ENABLED is not defined or zero).
48 Macros are defined empty. 48 Macros are defined empty.
49 - ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1). 49 - ThreadSanitizer, Helgrind, DRD (DYNAMIC_ANNOTATIONS_ENABLED is 1).
50 Macros are defined as calls to non-inlinable empty functions 50 Macros are defined as calls to non-inlinable empty functions
51 that are intercepted by Valgrind. */ 51 that are intercepted by Valgrind. */
52 52
53 #ifndef __DYNAMIC_ANNOTATIONS_H__ 53 #ifndef __DYNAMIC_ANNOTATIONS_H__
54 #define __DYNAMIC_ANNOTATIONS_H__ 54 #define __DYNAMIC_ANNOTATIONS_H__
55 55
56 #ifndef DYNAMIC_ANNOTATIONS_PREFIX
57 # define DYNAMIC_ANNOTATIONS_PREFIX
58 #endif
59
60 #ifndef DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND
61 # define DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND 1
62 #endif
63
64 #ifdef DYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK
65 # ifdef __GNUC__
66 # define DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK __attribute__((weak))
67 # else
68 /* TODO(glider): for Windows support we may want to change this macro in order
69 to prepend __declspec(selectany) to the annotations' declarations. */
70 # error weak annotations are not supported for your compiler
71 # endif
72 #else
73 # define DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK
74 #endif
75
76 /* The following preprocessor magic prepends the value of
77 DYNAMIC_ANNOTATIONS_PREFIX to annotation function names. */
78 #define DYNAMIC_ANNOTATIONS_GLUE0(A, B) A##B
79 #define DYNAMIC_ANNOTATIONS_GLUE(A, B) DYNAMIC_ANNOTATIONS_GLUE0(A, B)
80 #define DYNAMIC_ANNOTATIONS_NAME(name) \
81 DYNAMIC_ANNOTATIONS_GLUE(DYNAMIC_ANNOTATIONS_PREFIX, name)
82
56 #ifndef DYNAMIC_ANNOTATIONS_ENABLED 83 #ifndef DYNAMIC_ANNOTATIONS_ENABLED
57 # define DYNAMIC_ANNOTATIONS_ENABLED 0 84 # define DYNAMIC_ANNOTATIONS_ENABLED 0
58 #endif 85 #endif
59 86
60 #if DYNAMIC_ANNOTATIONS_ENABLED != 0 87 #if DYNAMIC_ANNOTATIONS_ENABLED != 0
61 88
62 /* ------------------------------------------------------------- 89 /* -------------------------------------------------------------
63 Annotations useful when implementing condition variables such as CondVar, 90 Annotations useful when implementing condition variables such as CondVar,
64 using conditional critical sections (Await/LockWhen) and when constructing 91 using conditional critical sections (Await/LockWhen) and when constructing
65 user-defined synchronization mechanisms. 92 user-defined synchronization mechanisms.
(...skipping 27 matching lines...) Expand all
93 ANNOTATE_HAPPENS_AFTER(e); 120 ANNOTATE_HAPPENS_AFTER(e);
94 return e; 121 return e;
95 } 122 }
96 123
97 Note: when possible, please use the existing reference counting and message 124 Note: when possible, please use the existing reference counting and message
98 queue implementations instead of inventing new ones. */ 125 queue implementations instead of inventing new ones. */
99 126
100 /* Report that wait on the condition variable at address "cv" has succeeded 127 /* Report that wait on the condition variable at address "cv" has succeeded
101 and the lock at address "lock" is held. */ 128 and the lock at address "lock" is held. */
102 #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \ 129 #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) \
103 AnnotateCondVarWait(__FILE__, __LINE__, cv, lock) 130 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(__FILE__, __LINE__, cv, lock)
104 131
105 /* Report that wait on the condition variable at "cv" has succeeded. Variant 132 /* Report that wait on the condition variable at "cv" has succeeded. Variant
106 w/o lock. */ 133 w/o lock. */
107 #define ANNOTATE_CONDVAR_WAIT(cv) \ 134 #define ANNOTATE_CONDVAR_WAIT(cv) \
108 AnnotateCondVarWait(__FILE__, __LINE__, cv, NULL) 135 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(__FILE__, __LINE__, cv, NULL)
109 136
110 /* Report that we are about to signal on the condition variable at address 137 /* Report that we are about to signal on the condition variable at address
111 "cv". */ 138 "cv". */
112 #define ANNOTATE_CONDVAR_SIGNAL(cv) \ 139 #define ANNOTATE_CONDVAR_SIGNAL(cv) \
113 AnnotateCondVarSignal(__FILE__, __LINE__, cv) 140 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(__FILE__, __LINE__, cv)
114 141
115 /* Report that we are about to signal_all on the condition variable at address 142 /* Report that we are about to signal_all on the condition variable at address
116 "cv". */ 143 "cv". */
117 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \ 144 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) \
118 AnnotateCondVarSignalAll(__FILE__, __LINE__, cv) 145 DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(__FILE__, __LINE__, cv)
119 146
120 /* Annotations for user-defined synchronization mechanisms. */ 147 /* Annotations for user-defined synchronization mechanisms. */
121 #define ANNOTATE_HAPPENS_BEFORE(obj) ANNOTATE_CONDVAR_SIGNAL(obj) 148 #define ANNOTATE_HAPPENS_BEFORE(obj) ANNOTATE_CONDVAR_SIGNAL(obj)
122 #define ANNOTATE_HAPPENS_AFTER(obj) ANNOTATE_CONDVAR_WAIT(obj) 149 #define ANNOTATE_HAPPENS_AFTER(obj) ANNOTATE_CONDVAR_WAIT(obj)
123 150
124 /* Report that the bytes in the range [pointer, pointer+size) are about 151 /* DEPRECATED. Don't use it. */
125 to be published safely. The race checker will create a happens-before
126 arc from the call ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) to
127 subsequent accesses to this memory.
128 Note: this annotation may not work properly if the race detector uses
129 sampling, i.e. does not observe all memory accesses.
130 */
131 #define ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \ 152 #define ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size) \
132 AnnotatePublishMemoryRange(__FILE__, __LINE__, pointer, size) 153 DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(__FILE__, __LINE__, \
154 pointer, size)
133 155
134 /* DEPRECATED. Don't use it. */ 156 /* DEPRECATED. Don't use it. */
135 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size) \ 157 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size) \
136 AnnotateUnpublishMemoryRange(__FILE__, __LINE__, pointer, size) 158 DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(__FILE__, __LINE__, \
159 pointer, size)
137 160
138 /* DEPRECATED. Don't use it. */ 161 /* DEPRECATED. Don't use it. */
139 #define ANNOTATE_SWAP_MEMORY_RANGE(pointer, size) \ 162 #define ANNOTATE_SWAP_MEMORY_RANGE(pointer, size) \
140 do { \ 163 do { \
141 ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size); \ 164 ANNOTATE_UNPUBLISH_MEMORY_RANGE(pointer, size); \
142 ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size); \ 165 ANNOTATE_PUBLISH_MEMORY_RANGE(pointer, size); \
143 } while (0) 166 } while (0)
144 167
145 /* Instruct the tool to create a happens-before arc between mu->Unlock() and 168 /* Instruct the tool to create a happens-before arc between mu->Unlock() and
146 mu->Lock(). This annotation may slow down the race detector and hide real 169 mu->Lock(). This annotation may slow down the race detector and hide real
147 races. Normally it is used only when it would be difficult to annotate each 170 races. Normally it is used only when it would be difficult to annotate each
148 of the mutex's critical sections individually using the annotations above. 171 of the mutex's critical sections individually using the annotations above.
149 This annotation makes sense only for hybrid race detectors. For pure 172 This annotation makes sense only for hybrid race detectors. For pure
150 happens-before detectors this is a no-op. For more details see 173 happens-before detectors this is a no-op. For more details see
151 http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */ 174 http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */
152 #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \ 175 #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) \
153 AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu) 176 DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(__FILE__, __LINE__, \
177 mu)
178
179 /* Opposite to ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX.
180 Instruct the tool to NOT create h-b arcs between Unlock and Lock, even in
181 pure happens-before mode. For a hybrid mode this is a no-op. */
182 #define ANNOTATE_NOT_HAPPENS_BEFORE_MUTEX(mu) \
183 DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(__FILE__, __LINE__, mu)
154 184
155 /* Deprecated. Use ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX. */ 185 /* Deprecated. Use ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX. */
156 #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) \ 186 #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) \
157 AnnotateMutexIsUsedAsCondVar(__FILE__, __LINE__, mu) 187 DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(__FILE__, __LINE__, \
188 mu)
158 189
159 /* ------------------------------------------------------------- 190 /* -------------------------------------------------------------
160 Annotations useful when defining memory allocators, or when memory that 191 Annotations useful when defining memory allocators, or when memory that
161 was protected in one way starts to be protected in another. */ 192 was protected in one way starts to be protected in another. */
162 193
163 /* Report that a new memory at "address" of size "size" has been allocated. 194 /* Report that a new memory at "address" of size "size" has been allocated.
164 This might be used when the memory has been retrieved from a free list and 195 This might be used when the memory has been retrieved from a free list and
165 is about to be reused, or when a the locking discipline for a variable 196 is about to be reused, or when a the locking discipline for a variable
166 changes. */ 197 changes. */
167 #define ANNOTATE_NEW_MEMORY(address, size) \ 198 #define ANNOTATE_NEW_MEMORY(address, size) \
168 AnnotateNewMemory(__FILE__, __LINE__, address, size) 199 DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(__FILE__, __LINE__, address, \
200 size)
169 201
170 /* ------------------------------------------------------------- 202 /* -------------------------------------------------------------
171 Annotations useful when defining FIFO queues that transfer data between 203 Annotations useful when defining FIFO queues that transfer data between
172 threads. */ 204 threads. */
173 205
174 /* Report that the producer-consumer queue (such as ProducerConsumerQueue) at 206 /* Report that the producer-consumer queue (such as ProducerConsumerQueue) at
175 address "pcq" has been created. The ANNOTATE_PCQ_* annotations 207 address "pcq" has been created. The ANNOTATE_PCQ_* annotations
176 should be used only for FIFO queues. For non-FIFO queues use 208 should be used only for FIFO queues. For non-FIFO queues use
177 ANNOTATE_HAPPENS_BEFORE (for put) and ANNOTATE_HAPPENS_AFTER (for get). */ 209 ANNOTATE_HAPPENS_BEFORE (for put) and ANNOTATE_HAPPENS_AFTER (for get). */
178 #define ANNOTATE_PCQ_CREATE(pcq) \ 210 #define ANNOTATE_PCQ_CREATE(pcq) \
179 AnnotatePCQCreate(__FILE__, __LINE__, pcq) 211 DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(__FILE__, __LINE__, pcq)
180 212
181 /* Report that the queue at address "pcq" is about to be destroyed. */ 213 /* Report that the queue at address "pcq" is about to be destroyed. */
182 #define ANNOTATE_PCQ_DESTROY(pcq) \ 214 #define ANNOTATE_PCQ_DESTROY(pcq) \
183 AnnotatePCQDestroy(__FILE__, __LINE__, pcq) 215 DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(__FILE__, __LINE__, pcq)
184 216
185 /* Report that we are about to put an element into a FIFO queue at address 217 /* Report that we are about to put an element into a FIFO queue at address
186 "pcq". */ 218 "pcq". */
187 #define ANNOTATE_PCQ_PUT(pcq) \ 219 #define ANNOTATE_PCQ_PUT(pcq) \
188 AnnotatePCQPut(__FILE__, __LINE__, pcq) 220 DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(__FILE__, __LINE__, pcq)
189 221
190 /* Report that we've just got an element from a FIFO queue at address 222 /* Report that we've just got an element from a FIFO queue at address
191 "pcq". */ 223 "pcq". */
192 #define ANNOTATE_PCQ_GET(pcq) \ 224 #define ANNOTATE_PCQ_GET(pcq) \
193 AnnotatePCQGet(__FILE__, __LINE__, pcq) 225 DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(__FILE__, __LINE__, pcq)
194 226
195 /* ------------------------------------------------------------- 227 /* -------------------------------------------------------------
196 Annotations that suppress errors. It is usually better to express the 228 Annotations that suppress errors. It is usually better to express the
197 program's synchronization using the other annotations, but these can 229 program's synchronization using the other annotations, but these can
198 be used when all else fails. */ 230 be used when all else fails. */
199 231
200 /* Report that we may have a benign race at "pointer", with size 232 /* Report that we may have a benign race at "pointer", with size
201 "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the 233 "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the
202 point where "pointer" has been allocated, preferably close to the point 234 point where "pointer" has been allocated, preferably close to the point
203 where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. */ 235 where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. */
204 #define ANNOTATE_BENIGN_RACE(pointer, description) \ 236 #define ANNOTATE_BENIGN_RACE(pointer, description) \
205 AnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \ 237 DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(__FILE__, __LINE__, \
206 sizeof(*(pointer)), description) 238 pointer, sizeof(*(pointer)), description)
207 239
208 /* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to 240 /* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to
209 the memory range [address, address+size). */ 241 the memory range [address, address+size). */
210 #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ 242 #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
211 AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description) 243 DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(__FILE__, __LINE__, \
244 address, size, description)
212 245
213 /* Request the analysis tool to ignore all reads in the current thread 246 /* Request the analysis tool to ignore all reads in the current thread
214 until ANNOTATE_IGNORE_READS_END is called. 247 until ANNOTATE_IGNORE_READS_END is called.
215 Useful to ignore intentional racey reads, while still checking 248 Useful to ignore intentional racey reads, while still checking
216 other reads and all writes. 249 other reads and all writes.
217 See also ANNOTATE_UNPROTECTED_READ. */ 250 See also ANNOTATE_UNPROTECTED_READ. */
218 #define ANNOTATE_IGNORE_READS_BEGIN() \ 251 #define ANNOTATE_IGNORE_READS_BEGIN() \
219 AnnotateIgnoreReadsBegin(__FILE__, __LINE__) 252 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(__FILE__, __LINE__)
220 253
221 /* Stop ignoring reads. */ 254 /* Stop ignoring reads. */
222 #define ANNOTATE_IGNORE_READS_END() \ 255 #define ANNOTATE_IGNORE_READS_END() \
223 AnnotateIgnoreReadsEnd(__FILE__, __LINE__) 256 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(__FILE__, __LINE__)
224 257
225 /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */ 258 /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */
226 #define ANNOTATE_IGNORE_WRITES_BEGIN() \ 259 #define ANNOTATE_IGNORE_WRITES_BEGIN() \
227 AnnotateIgnoreWritesBegin(__FILE__, __LINE__) 260 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(__FILE__, __LINE__)
228 261
229 /* Stop ignoring writes. */ 262 /* Stop ignoring writes. */
230 #define ANNOTATE_IGNORE_WRITES_END() \ 263 #define ANNOTATE_IGNORE_WRITES_END() \
231 AnnotateIgnoreWritesEnd(__FILE__, __LINE__) 264 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(__FILE__, __LINE__)
232 265
233 /* Start ignoring all memory accesses (reads and writes). */ 266 /* Start ignoring all memory accesses (reads and writes). */
234 #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ 267 #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \
235 do {\ 268 do {\
236 ANNOTATE_IGNORE_READS_BEGIN();\ 269 ANNOTATE_IGNORE_READS_BEGIN();\
237 ANNOTATE_IGNORE_WRITES_BEGIN();\ 270 ANNOTATE_IGNORE_WRITES_BEGIN();\
238 }while(0)\ 271 }while(0)\
239 272
240 /* Stop ignoring all memory accesses. */ 273 /* Stop ignoring all memory accesses. */
241 #define ANNOTATE_IGNORE_READS_AND_WRITES_END() \ 274 #define ANNOTATE_IGNORE_READS_AND_WRITES_END() \
242 do {\ 275 do {\
243 ANNOTATE_IGNORE_WRITES_END();\ 276 ANNOTATE_IGNORE_WRITES_END();\
244 ANNOTATE_IGNORE_READS_END();\ 277 ANNOTATE_IGNORE_READS_END();\
245 }while(0)\ 278 }while(0)\
246 279
247 /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events: 280 /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events:
248 RWLOCK* and CONDVAR*. */ 281 RWLOCK* and CONDVAR*. */
249 #define ANNOTATE_IGNORE_SYNC_BEGIN() \ 282 #define ANNOTATE_IGNORE_SYNC_BEGIN() \
250 AnnotateIgnoreSyncBegin(__FILE__, __LINE__) 283 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(__FILE__, __LINE__)
251 284
252 /* Stop ignoring sync events. */ 285 /* Stop ignoring sync events. */
253 #define ANNOTATE_IGNORE_SYNC_END() \ 286 #define ANNOTATE_IGNORE_SYNC_END() \
254 AnnotateIgnoreSyncEnd(__FILE__, __LINE__) 287 DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(__FILE__, __LINE__)
255 288
256 289
257 /* Enable (enable!=0) or disable (enable==0) race detection for all threads. 290 /* Enable (enable!=0) or disable (enable==0) race detection for all threads.
258 This annotation could be useful if you want to skip expensive race analysis 291 This annotation could be useful if you want to skip expensive race analysis
259 during some period of program execution, e.g. during initialization. */ 292 during some period of program execution, e.g. during initialization. */
260 #define ANNOTATE_ENABLE_RACE_DETECTION(enable) \ 293 #define ANNOTATE_ENABLE_RACE_DETECTION(enable) \
261 AnnotateEnableRaceDetection(__FILE__, __LINE__, enable) 294 DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(__FILE__, __LINE__, \
295 enable)
262 296
263 /* ------------------------------------------------------------- 297 /* -------------------------------------------------------------
264 Annotations useful for debugging. */ 298 Annotations useful for debugging. */
265 299
266 /* Request to trace every access to "address". */ 300 /* Request to trace every access to "address". */
267 #define ANNOTATE_TRACE_MEMORY(address) \ 301 #define ANNOTATE_TRACE_MEMORY(address) \
268 AnnotateTraceMemory(__FILE__, __LINE__, address) 302 DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(__FILE__, __LINE__, address)
269 303
270 /* Report the current thread name to a race detector. */ 304 /* Report the current thread name to a race detector. */
271 #define ANNOTATE_THREAD_NAME(name) \ 305 #define ANNOTATE_THREAD_NAME(name) \
272 AnnotateThreadName(__FILE__, __LINE__, name) 306 DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(__FILE__, __LINE__, name)
273 307
274 /* ------------------------------------------------------------- 308 /* -------------------------------------------------------------
275 Annotations useful when implementing locks. They are not 309 Annotations useful when implementing locks. They are not
276 normally needed by modules that merely use locks. 310 normally needed by modules that merely use locks.
277 The "lock" argument is a pointer to the lock object. */ 311 The "lock" argument is a pointer to the lock object. */
278 312
279 /* Report that a lock has been created at address "lock". */ 313 /* Report that a lock has been created at address "lock". */
280 #define ANNOTATE_RWLOCK_CREATE(lock) \ 314 #define ANNOTATE_RWLOCK_CREATE(lock) \
281 AnnotateRWLockCreate(__FILE__, __LINE__, lock) 315 DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(__FILE__, __LINE__, lock)
282 316
283 /* Report that the lock at address "lock" is about to be destroyed. */ 317 /* Report that the lock at address "lock" is about to be destroyed. */
284 #define ANNOTATE_RWLOCK_DESTROY(lock) \ 318 #define ANNOTATE_RWLOCK_DESTROY(lock) \
285 AnnotateRWLockDestroy(__FILE__, __LINE__, lock) 319 DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(__FILE__, __LINE__, lock)
286 320
287 /* Report that the lock at address "lock" has been acquired. 321 /* Report that the lock at address "lock" has been acquired.
288 is_w=1 for writer lock, is_w=0 for reader lock. */ 322 is_w=1 for writer lock, is_w=0 for reader lock. */
289 #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ 323 #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \
290 AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w) 324 DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(__FILE__, __LINE__, lock, \
325 is_w)
291 326
292 /* Report that the lock at address "lock" is about to be released. */ 327 /* Report that the lock at address "lock" is about to be released. */
293 #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ 328 #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
294 AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w) 329 DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(__FILE__, __LINE__, lock, \
330 is_w)
295 331
296 /* ------------------------------------------------------------- 332 /* -------------------------------------------------------------
297 Annotations useful when implementing barriers. They are not 333 Annotations useful when implementing barriers. They are not
298 normally needed by modules that merely use barriers. 334 normally needed by modules that merely use barriers.
299 The "barrier" argument is a pointer to the barrier object. */ 335 The "barrier" argument is a pointer to the barrier object. */
300 336
301 /* Report that the "barrier" has been initialized with initial "count". 337 /* Report that the "barrier" has been initialized with initial "count".
302 If 'reinitialization_allowed' is true, initialization is allowed to happen 338 If 'reinitialization_allowed' is true, initialization is allowed to happen
303 multiple times w/o calling barrier_destroy() */ 339 multiple times w/o calling barrier_destroy() */
304 #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \ 340 #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) \
305 AnnotateBarrierInit(__FILE__, __LINE__, barrier, count, \ 341 DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(__FILE__, __LINE__, barrier, \
306 reinitialization_allowed) 342 count, reinitialization_allowed)
307 343
308 /* Report that we are about to enter barrier_wait("barrier"). */ 344 /* Report that we are about to enter barrier_wait("barrier"). */
309 #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \ 345 #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) \
310 AnnotateBarrierWaitBefore(__FILE__, __LINE__, barrier) 346 DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(__FILE__, __LINE__, \
347 barrier)
311 348
312 /* Report that we just exited barrier_wait("barrier"). */ 349 /* Report that we just exited barrier_wait("barrier"). */
313 #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) \ 350 #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) \
314 AnnotateBarrierWaitAfter(__FILE__, __LINE__, barrier) 351 DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(__FILE__, __LINE__, \
352 barrier)
315 353
316 /* Report that the "barrier" has been destroyed. */ 354 /* Report that the "barrier" has been destroyed. */
317 #define ANNOTATE_BARRIER_DESTROY(barrier) \ 355 #define ANNOTATE_BARRIER_DESTROY(barrier) \
318 AnnotateBarrierDestroy(__FILE__, __LINE__, barrier) 356 DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(__FILE__, __LINE__, \
357 barrier)
319 358
320 /* ------------------------------------------------------------- 359 /* -------------------------------------------------------------
321 Annotations useful for testing race detectors. */ 360 Annotations useful for testing race detectors. */
322 361
323 /* Report that we expect a race on the variable at "address". 362 /* Report that we expect a race on the variable at "address".
324 Use only in unit tests for a race detector. */ 363 Use only in unit tests for a race detector. */
325 #define ANNOTATE_EXPECT_RACE(address, description) \ 364 #define ANNOTATE_EXPECT_RACE(address, description) \
326 AnnotateExpectRace(__FILE__, __LINE__, address, description) 365 DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(__FILE__, __LINE__, address, \
366 description)
367
368 #define ANNOTATE_FLUSH_EXPECTED_RACES() \
369 DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(__FILE__, __LINE__)
327 370
328 /* A no-op. Insert where you like to test the interceptors. */ 371 /* A no-op. Insert where you like to test the interceptors. */
329 #define ANNOTATE_NO_OP(arg) \ 372 #define ANNOTATE_NO_OP(arg) \
330 AnnotateNoOp(__FILE__, __LINE__, arg) 373 DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(__FILE__, __LINE__, arg)
331 374
332 /* Force the race detector to flush its state. The actual effect depends on 375 /* Force the race detector to flush its state. The actual effect depends on
333 * the implementation of the detector. */ 376 * the implementation of the detector. */
334 #define ANNOTATE_FLUSH_STATE() \ 377 #define ANNOTATE_FLUSH_STATE() \
335 AnnotateFlushState(__FILE__, __LINE__) 378 DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(__FILE__, __LINE__)
336 379
337 380
338 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ 381 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
339 382
340 #define ANNOTATE_RWLOCK_CREATE(lock) /* empty */ 383 #define ANNOTATE_RWLOCK_CREATE(lock) /* empty */
341 #define ANNOTATE_RWLOCK_DESTROY(lock) /* empty */ 384 #define ANNOTATE_RWLOCK_DESTROY(lock) /* empty */
342 #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */ 385 #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) /* empty */
343 #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */ 386 #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) /* empty */
344 #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */ 387 #define ANNOTATE_BARRIER_INIT(barrier, count, reinitialization_allowed) /* */
345 #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */ 388 #define ANNOTATE_BARRIER_WAIT_BEFORE(barrier) /* empty */
346 #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */ 389 #define ANNOTATE_BARRIER_WAIT_AFTER(barrier) /* empty */
347 #define ANNOTATE_BARRIER_DESTROY(barrier) /* empty */ 390 #define ANNOTATE_BARRIER_DESTROY(barrier) /* empty */
348 #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */ 391 #define ANNOTATE_CONDVAR_LOCK_WAIT(cv, lock) /* empty */
349 #define ANNOTATE_CONDVAR_WAIT(cv) /* empty */ 392 #define ANNOTATE_CONDVAR_WAIT(cv) /* empty */
350 #define ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */ 393 #define ANNOTATE_CONDVAR_SIGNAL(cv) /* empty */
351 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */ 394 #define ANNOTATE_CONDVAR_SIGNAL_ALL(cv) /* empty */
352 #define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ 395 #define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
353 #define ANNOTATE_HAPPENS_AFTER(obj) /* empty */ 396 #define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
354 #define ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */ 397 #define ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) /* empty */
355 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */ 398 #define ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) /* empty */
356 #define ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */ 399 #define ANNOTATE_SWAP_MEMORY_RANGE(address, size) /* empty */
357 #define ANNOTATE_PCQ_CREATE(pcq) /* empty */ 400 #define ANNOTATE_PCQ_CREATE(pcq) /* empty */
358 #define ANNOTATE_PCQ_DESTROY(pcq) /* empty */ 401 #define ANNOTATE_PCQ_DESTROY(pcq) /* empty */
359 #define ANNOTATE_PCQ_PUT(pcq) /* empty */ 402 #define ANNOTATE_PCQ_PUT(pcq) /* empty */
360 #define ANNOTATE_PCQ_GET(pcq) /* empty */ 403 #define ANNOTATE_PCQ_GET(pcq) /* empty */
361 #define ANNOTATE_NEW_MEMORY(address, size) /* empty */ 404 #define ANNOTATE_NEW_MEMORY(address, size) /* empty */
362 #define ANNOTATE_EXPECT_RACE(address, description) /* empty */ 405 #define ANNOTATE_EXPECT_RACE(address, description) /* empty */
406 #define ANNOTATE_FLUSH_EXPECTED_RACES(address, description) /* empty */
363 #define ANNOTATE_BENIGN_RACE(address, description) /* empty */ 407 #define ANNOTATE_BENIGN_RACE(address, description) /* empty */
364 #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */ 408 #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) /* empty */
365 #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */ 409 #define ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX(mu) /* empty */
366 #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */ 410 #define ANNOTATE_MUTEX_IS_USED_AS_CONDVAR(mu) /* empty */
367 #define ANNOTATE_TRACE_MEMORY(arg) /* empty */ 411 #define ANNOTATE_TRACE_MEMORY(arg) /* empty */
368 #define ANNOTATE_THREAD_NAME(name) /* empty */ 412 #define ANNOTATE_THREAD_NAME(name) /* empty */
369 #define ANNOTATE_IGNORE_READS_BEGIN() /* empty */ 413 #define ANNOTATE_IGNORE_READS_BEGIN() /* empty */
370 #define ANNOTATE_IGNORE_READS_END() /* empty */ 414 #define ANNOTATE_IGNORE_READS_END() /* empty */
371 #define ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */ 415 #define ANNOTATE_IGNORE_WRITES_BEGIN() /* empty */
372 #define ANNOTATE_IGNORE_WRITES_END() /* empty */ 416 #define ANNOTATE_IGNORE_WRITES_END() /* empty */
373 #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */ 417 #define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() /* empty */
374 #define ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */ 418 #define ANNOTATE_IGNORE_READS_AND_WRITES_END() /* empty */
375 #define ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */ 419 #define ANNOTATE_IGNORE_SYNC_BEGIN() /* empty */
376 #define ANNOTATE_IGNORE_SYNC_END() /* empty */ 420 #define ANNOTATE_IGNORE_SYNC_END() /* empty */
377 #define ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */ 421 #define ANNOTATE_ENABLE_RACE_DETECTION(enable) /* empty */
378 #define ANNOTATE_NO_OP(arg) /* empty */ 422 #define ANNOTATE_NO_OP(arg) /* empty */
379 #define ANNOTATE_FLUSH_STATE() /* empty */ 423 #define ANNOTATE_FLUSH_STATE() /* empty */
380 424
381 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ 425 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */
382 426
383 /* Use the macros above rather than using these functions directly. */ 427 /* Use the macros above rather than using these functions directly. */
384 #ifdef __cplusplus 428 #ifdef __cplusplus
385 extern "C" { 429 extern "C" {
386 #endif 430 #endif
387 void AnnotateRWLockCreate(const char *file, int line,
388 const volatile void *lock);
389 void AnnotateRWLockDestroy(const char *file, int line,
390 const volatile void *lock);
391 void AnnotateRWLockAcquired(const char *file, int line,
392 const volatile void *lock, long is_w);
393 void AnnotateRWLockReleased(const char *file, int line,
394 const volatile void *lock, long is_w);
395 void AnnotateBarrierInit(const char *file, int line,
396 const volatile void *barrier, long count,
397 long reinitialization_allowed);
398 void AnnotateBarrierWaitBefore(const char *file, int line,
399 const volatile void *barrier);
400 void AnnotateBarrierWaitAfter(const char *file, int line,
401 const volatile void *barrier);
402 void AnnotateBarrierDestroy(const char *file, int line,
403 const volatile void *barrier);
404 void AnnotateCondVarWait(const char *file, int line,
405 const volatile void *cv,
406 const volatile void *lock);
407 void AnnotateCondVarSignal(const char *file, int line,
408 const volatile void *cv);
409 void AnnotateCondVarSignalAll(const char *file, int line,
410 const volatile void *cv);
411 void AnnotatePublishMemoryRange(const char *file, int line,
412 const volatile void *address,
413 long size);
414 void AnnotateUnpublishMemoryRange(const char *file, int line,
415 const volatile void *address,
416 long size);
417 void AnnotatePCQCreate(const char *file, int line,
418 const volatile void *pcq);
419 void AnnotatePCQDestroy(const char *file, int line,
420 const volatile void *pcq);
421 void AnnotatePCQPut(const char *file, int line,
422 const volatile void *pcq);
423 void AnnotatePCQGet(const char *file, int line,
424 const volatile void *pcq);
425 void AnnotateNewMemory(const char *file, int line,
426 const volatile void *address,
427 long size);
428 void AnnotateExpectRace(const char *file, int line,
429 const volatile void *address,
430 const char *description);
431 void AnnotateBenignRace(const char *file, int line,
432 const volatile void *address,
433 const char *description);
434 void AnnotateBenignRaceSized(const char *file, int line,
435 const volatile void *address,
436 long size,
437 const char *description);
438 void AnnotateMutexIsUsedAsCondVar(const char *file, int line,
439 const volatile void *mu);
440 void AnnotateTraceMemory(const char *file, int line,
441 const volatile void *arg);
442 void AnnotateThreadName(const char *file, int line,
443 const char *name);
444 void AnnotateIgnoreReadsBegin(const char *file, int line);
445 void AnnotateIgnoreReadsEnd(const char *file, int line);
446 void AnnotateIgnoreWritesBegin(const char *file, int line);
447 void AnnotateIgnoreWritesEnd(const char *file, int line);
448 void AnnotateEnableRaceDetection(const char *file, int line, int enable);
449 void AnnotateNoOp(const char *file, int line,
450 const volatile void *arg);
451 void AnnotateFlushState(const char *file, int line);
452 431
432
433 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockCreate)(
434 const char *file, int line,
435 const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
436 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockDestroy)(
437 const char *file, int line,
438 const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
439 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockAcquired)(
440 const char *file, int line,
441 const volatile void *lock, long is_w) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
442 void DYNAMIC_ANNOTATIONS_NAME(AnnotateRWLockReleased)(
443 const char *file, int line,
444 const volatile void *lock, long is_w) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
445 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierInit)(
446 const char *file, int line, const volatile void *barrier, long count,
447 long reinitialization_allowed) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
448 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitBefore)(
449 const char *file, int line,
450 const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
451 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierWaitAfter)(
452 const char *file, int line,
453 const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
454 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBarrierDestroy)(
455 const char *file, int line,
456 const volatile void *barrier) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
457 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarWait)(
458 const char *file, int line, const volatile void *cv,
459 const volatile void *lock) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
460 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignal)(
461 const char *file, int line,
462 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
463 void DYNAMIC_ANNOTATIONS_NAME(AnnotateCondVarSignalAll)(
464 const char *file, int line,
465 const volatile void *cv) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
466 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePublishMemoryRange)(
467 const char *file, int line,
468 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
469 void DYNAMIC_ANNOTATIONS_NAME(AnnotateUnpublishMemoryRange)(
470 const char *file, int line,
471 const volatile void *address, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
472 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQCreate)(
473 const char *file, int line,
474 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
475 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQDestroy)(
476 const char *file, int line,
477 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
478 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQPut)(
479 const char *file, int line,
480 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
481 void DYNAMIC_ANNOTATIONS_NAME(AnnotatePCQGet)(
482 const char *file, int line,
483 const volatile void *pcq) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
484 void DYNAMIC_ANNOTATIONS_NAME(AnnotateNewMemory)(
485 const char *file, int line,
486 const volatile void *mem, long size) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
487 void DYNAMIC_ANNOTATIONS_NAME(AnnotateExpectRace)(
488 const char *file, int line, const volatile void *mem,
489 const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
490 void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushExpectedRaces)(
491 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
492 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRace)(
493 const char *file, int line, const volatile void *mem,
494 const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
495 void DYNAMIC_ANNOTATIONS_NAME(AnnotateBenignRaceSized)(
496 const char *file, int line, const volatile void *mem, long size,
497 const char *description) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
498 void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsUsedAsCondVar)(
499 const char *file, int line,
500 const volatile void *mu) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
501 void DYNAMIC_ANNOTATIONS_NAME(AnnotateMutexIsNotPHB)(
502 const char *file, int line,
503 const volatile void *mu) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
504 void DYNAMIC_ANNOTATIONS_NAME(AnnotateTraceMemory)(
505 const char *file, int line,
506 const volatile void *arg) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
507 void DYNAMIC_ANNOTATIONS_NAME(AnnotateThreadName)(
508 const char *file, int line,
509 const char *name) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
510 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsBegin)(
511 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
512 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreReadsEnd)(
513 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
514 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesBegin)(
515 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
516 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreWritesEnd)(
517 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
518 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncBegin)(
519 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
520 void DYNAMIC_ANNOTATIONS_NAME(AnnotateIgnoreSyncEnd)(
521 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
522 void DYNAMIC_ANNOTATIONS_NAME(AnnotateEnableRaceDetection)(
523 const char *file, int line, int enable) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
524 void DYNAMIC_ANNOTATIONS_NAME(AnnotateNoOp)(
525 const char *file, int line,
526 const volatile void *arg) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
527 void DYNAMIC_ANNOTATIONS_NAME(AnnotateFlushState)(
528 const char *file, int line) DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK;
529
530 #if DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1
453 /* Return non-zero value if running under valgrind. 531 /* Return non-zero value if running under valgrind.
454 532
455 If "valgrind.h" is included into dynamic_annotations.c, 533 If "valgrind.h" is included into dynamic_annotations.c,
456 the regular valgrind mechanism will be used. 534 the regular valgrind mechanism will be used.
457 See http://valgrind.org/docs/manual/manual-core-adv.html about 535 See http://valgrind.org/docs/manual/manual-core-adv.html about
458 RUNNING_ON_VALGRIND and other valgrind "client requests". 536 RUNNING_ON_VALGRIND and other valgrind "client requests".
459 The file "valgrind.h" may be obtained by doing 537 The file "valgrind.h" may be obtained by doing
460 svn co svn://svn.valgrind.org/valgrind/trunk/include 538 svn co svn://svn.valgrind.org/valgrind/trunk/include
461 539
462 If for some reason you can't use "valgrind.h" or want to fake valgrind, 540 If for some reason you can't use "valgrind.h" or want to fake valgrind,
463 there are two ways to make this function return non-zero: 541 there are two ways to make this function return non-zero:
464 - Use environment variable: export RUNNING_ON_VALGRIND=1 542 - Use environment variable: export RUNNING_ON_VALGRIND=1
465 - Make your tool intercept the function RunningOnValgrind() and 543 - Make your tool intercept the function RunningOnValgrind() and
466 change its return value. 544 change its return value.
467 */ 545 */
468 int RunningOnValgrind(void); 546 int RunningOnValgrind(void);
547 #endif /* DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND == 1 */
469 548
470 #ifdef __cplusplus 549 #ifdef __cplusplus
471 } 550 }
472 #endif 551 #endif
473 552
474 #if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus) 553 #if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
475 554
476 /* ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. 555 /* ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
477 556
478 Instead of doing 557 Instead of doing
(...skipping 23 matching lines...) Expand all
502 static static_var ## _annotator the ## static_var ## _annotator;\ 581 static static_var ## _annotator the ## static_var ## _annotator;\
503 } 582 }
504 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ 583 #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
505 584
506 #define ANNOTATE_UNPROTECTED_READ(x) (x) 585 #define ANNOTATE_UNPROTECTED_READ(x) (x)
507 #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */ 586 #define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) /* empty */
508 587
509 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */ 588 #endif /* DYNAMIC_ANNOTATIONS_ENABLED */
510 589
511 #endif /* __DYNAMIC_ANNOTATIONS_H__ */ 590 #endif /* __DYNAMIC_ANNOTATIONS_H__ */
OLDNEW
« no previous file with comments | « no previous file | base/third_party/dynamic_annotations/dynamic_annotations.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698