103103
104104 /* Report that wait on the condition variable at address "cv" has succeeded
105105 and the lock at address "lock" is held. */
106- #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT (cv, lock ) \
106+ #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT (cv, lock ) \
107107 AnnotateCondVarWait (__FILE__, __LINE__, cv, lock)
108108
109109 /* Report that wait on the condition variable at "cv" has succeeded. Variant
110110 w/o lock. */
111- #define _Py_ANNOTATE_CONDVAR_WAIT (cv) \
111+ #define _Py_ANNOTATE_CONDVAR_WAIT (cv ) \
112112 AnnotateCondVarWait (__FILE__, __LINE__, cv, NULL )
113113
114114 /* Report that we are about to signal on the condition variable at address
115115 "cv". */
116- #define _Py_ANNOTATE_CONDVAR_SIGNAL (cv) \
116+ #define _Py_ANNOTATE_CONDVAR_SIGNAL (cv ) \
117117 AnnotateCondVarSignal (__FILE__, __LINE__, cv)
118118
119119 /* Report that we are about to signal_all on the condition variable at "cv". */
120- #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL (cv) \
120+ #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL (cv ) \
121121 AnnotateCondVarSignalAll (__FILE__, __LINE__, cv)
122122
123123 /* Annotations for user-defined synchronization mechanisms. */
124- #define _Py_ANNOTATE_HAPPENS_BEFORE (obj) _Py_ANNOTATE_CONDVAR_SIGNAL(obj)
125- #define _Py_ANNOTATE_HAPPENS_AFTER (obj) _Py_ANNOTATE_CONDVAR_WAIT(obj)
124+ #define _Py_ANNOTATE_HAPPENS_BEFORE (obj ) _Py_ANNOTATE_CONDVAR_SIGNAL(obj)
125+ #define _Py_ANNOTATE_HAPPENS_AFTER (obj ) _Py_ANNOTATE_CONDVAR_WAIT(obj)
126126
127127 /* Report that the bytes in the range [pointer, pointer+size) are about
128128 to be published safely. The race checker will create a happens-before
131131 Note: this annotation may not work properly if the race detector uses
132132 sampling, i.e. does not observe all memory accesses.
133133 */
134- #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE (pointer, size) \
134+ #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE (pointer, size ) \
135135 AnnotatePublishMemoryRange (__FILE__, __LINE__, pointer, size)
136136
137137 /* Instruct the tool to create a happens-before arc between mu->Unlock() and
141141 This annotation makes sense only for hybrid race detectors. For pure
142142 happens-before detectors this is a no-op. For more details see
143143 http://code.google.com/p/data-race-test/wiki/PureHappensBeforeVsHybrid . */
144- #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX (mu) \
144+ #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX (mu ) \
145145 AnnotateMutexIsUsedAsCondVar (__FILE__, __LINE__, mu)
146146
147147 /* -------------------------------------------------------------
152152 This might be used when the memory has been retrieved from a free list and
153153 is about to be reused, or when a the locking discipline for a variable
154154 changes. */
155- #define _Py_ANNOTATE_NEW_MEMORY (address, size) \
155+ #define _Py_ANNOTATE_NEW_MEMORY (address, size ) \
156156 AnnotateNewMemory (__FILE__, __LINE__, address, size)
157157
158158 /* -------------------------------------------------------------
164164 be used only for FIFO queues. For non-FIFO queues use
165165 _Py_ANNOTATE_HAPPENS_BEFORE (for put) and _Py_ANNOTATE_HAPPENS_AFTER (for
166166 get). */
167- #define _Py_ANNOTATE_PCQ_CREATE (pcq) \
167+ #define _Py_ANNOTATE_PCQ_CREATE (pcq ) \
168168 AnnotatePCQCreate (__FILE__, __LINE__, pcq)
169169
170170 /* Report that the queue at address "pcq" is about to be destroyed. */
171- #define _Py_ANNOTATE_PCQ_DESTROY (pcq) \
171+ #define _Py_ANNOTATE_PCQ_DESTROY (pcq ) \
172172 AnnotatePCQDestroy (__FILE__, __LINE__, pcq)
173173
174174 /* Report that we are about to put an element into a FIFO queue at address
175175 "pcq". */
176- #define _Py_ANNOTATE_PCQ_PUT (pcq) \
176+ #define _Py_ANNOTATE_PCQ_PUT (pcq ) \
177177 AnnotatePCQPut (__FILE__, __LINE__, pcq)
178178
179179 /* Report that we've just got an element from a FIFO queue at address "pcq". */
180- #define _Py_ANNOTATE_PCQ_GET (pcq) \
180+ #define _Py_ANNOTATE_PCQ_GET (pcq ) \
181181 AnnotatePCQGet (__FILE__, __LINE__, pcq)
182182
183183 /* -------------------------------------------------------------
189189 "sizeof(*(pointer))". "pointer" must be a non-void* pointer. Insert at the
190190 point where "pointer" has been allocated, preferably close to the point
191191 where the race happens. See also _Py_ANNOTATE_BENIGN_RACE_STATIC. */
192- #define _Py_ANNOTATE_BENIGN_RACE (pointer, description) \
192+ #define _Py_ANNOTATE_BENIGN_RACE (pointer, description ) \
193193 AnnotateBenignRaceSized (__FILE__, __LINE__, pointer, \
194194 sizeof (*(pointer)), description)
195195
196196 /* Same as _Py_ANNOTATE_BENIGN_RACE(address, description), but applies to
197197 the memory range [address, address+size). */
198- #define _Py_ANNOTATE_BENIGN_RACE_SIZED (address, size, description) \
198+ #define _Py_ANNOTATE_BENIGN_RACE_SIZED (address, size, description ) \
199199 AnnotateBenignRaceSized (__FILE__, __LINE__, address, size, description)
200200
201201 /* Request the analysis tool to ignore all reads in the current thread
202202 until _Py_ANNOTATE_IGNORE_READS_END is called.
203203 Useful to ignore intentional racey reads, while still checking
204204 other reads and all writes.
205205 See also _Py_ANNOTATE_UNPROTECTED_READ. */
206- #define _Py_ANNOTATE_IGNORE_READS_BEGIN () \
206+ #define _Py_ANNOTATE_IGNORE_READS_BEGIN () \
207207 AnnotateIgnoreReadsBegin (__FILE__, __LINE__)
208208
209209 /* Stop ignoring reads. */
210- #define _Py_ANNOTATE_IGNORE_READS_END () \
210+ #define _Py_ANNOTATE_IGNORE_READS_END () \
211211 AnnotateIgnoreReadsEnd (__FILE__, __LINE__)
212212
213213 /* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes. */
214- #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN () \
214+ #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN () \
215215 AnnotateIgnoreWritesBegin (__FILE__, __LINE__)
216216
217217 /* Stop ignoring writes. */
218- #define _Py_ANNOTATE_IGNORE_WRITES_END () \
218+ #define _Py_ANNOTATE_IGNORE_WRITES_END () \
219219 AnnotateIgnoreWritesEnd (__FILE__, __LINE__)
220220
221221 /* Start ignoring all memory accesses (reads and writes). */
222- #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN () \
222+ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN () \
223223 do {\
224224 _Py_ANNOTATE_IGNORE_READS_BEGIN ();\
225225 _Py_ANNOTATE_IGNORE_WRITES_BEGIN ();\
226226 }while (0 )\
227227
228228 /* Stop ignoring all memory accesses. */
229- #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END () \
229+ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END () \
230230 do {\
231231 _Py_ANNOTATE_IGNORE_WRITES_END ();\
232232 _Py_ANNOTATE_IGNORE_READS_END ();\
233233 }while (0 )\
234234
235235 /* Similar to _Py_ANNOTATE_IGNORE_READS_BEGIN, but ignore synchronization events:
236236 RWLOCK* and CONDVAR*. */
237- #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN () \
237+ #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN () \
238238 AnnotateIgnoreSyncBegin (__FILE__, __LINE__)
239239
240240 /* Stop ignoring sync events. */
241- #define _Py_ANNOTATE_IGNORE_SYNC_END () \
241+ #define _Py_ANNOTATE_IGNORE_SYNC_END () \
242242 AnnotateIgnoreSyncEnd (__FILE__, __LINE__)
243243
244244
245245 /* Enable (enable!=0) or disable (enable==0) race detection for all threads.
246246 This annotation could be useful if you want to skip expensive race analysis
247247 during some period of program execution, e.g. during initialization. */
248- #define _Py_ANNOTATE_ENABLE_RACE_DETECTION (enable) \
248+ #define _Py_ANNOTATE_ENABLE_RACE_DETECTION (enable ) \
249249 AnnotateEnableRaceDetection (__FILE__, __LINE__, enable)
250250
251251 /* -------------------------------------------------------------
252252 Annotations useful for debugging. */
253253
254254 /* Request to trace every access to "address". */
255- #define _Py_ANNOTATE_TRACE_MEMORY (address) \
255+ #define _Py_ANNOTATE_TRACE_MEMORY (address ) \
256256 AnnotateTraceMemory (__FILE__, __LINE__, address)
257257
258258 /* Report the current thread name to a race detector. */
259- #define _Py_ANNOTATE_THREAD_NAME (name) \
259+ #define _Py_ANNOTATE_THREAD_NAME (name ) \
260260 AnnotateThreadName (__FILE__, __LINE__, name)
261261
262262 /* -------------------------------------------------------------
265265 The "lock" argument is a pointer to the lock object. */
266266
267267 /* Report that a lock has been created at address "lock". */
268- #define _Py_ANNOTATE_RWLOCK_CREATE (lock) \
268+ #define _Py_ANNOTATE_RWLOCK_CREATE (lock ) \
269269 AnnotateRWLockCreate (__FILE__, __LINE__, lock)
270270
271271 /* Report that the lock at address "lock" is about to be destroyed. */
272- #define _Py_ANNOTATE_RWLOCK_DESTROY (lock) \
272+ #define _Py_ANNOTATE_RWLOCK_DESTROY (lock ) \
273273 AnnotateRWLockDestroy (__FILE__, __LINE__, lock)
274274
275275 /* Report that the lock at address "lock" has been acquired.
276276 is_w=1 for writer lock, is_w=0 for reader lock. */
277- #define _Py_ANNOTATE_RWLOCK_ACQUIRED (lock, is_w) \
277+ #define _Py_ANNOTATE_RWLOCK_ACQUIRED (lock, is_w ) \
278278 AnnotateRWLockAcquired (__FILE__, __LINE__, lock, is_w)
279279
280280 /* Report that the lock at address "lock" is about to be released. */
281- #define _Py_ANNOTATE_RWLOCK_RELEASED (lock, is_w) \
281+ #define _Py_ANNOTATE_RWLOCK_RELEASED (lock, is_w ) \
282282 AnnotateRWLockReleased (__FILE__, __LINE__, lock, is_w)
283283
284284 /* -------------------------------------------------------------
289289 /* Report that the "barrier" has been initialized with initial "count".
290290 If 'reinitialization_allowed' is true, initialization is allowed to happen
291291 multiple times w/o calling barrier_destroy() */
292- #define _Py_ANNOTATE_BARRIER_INIT (barrier, count, reinitialization_allowed) \
292+ #define _Py_ANNOTATE_BARRIER_INIT (barrier, count, reinitialization_allowed ) \
293293 AnnotateBarrierInit (__FILE__, __LINE__, barrier, count, \
294294 reinitialization_allowed)
295295
296296 /* Report that we are about to enter barrier_wait("barrier"). */
297- #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE (barrier) \
297+ #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE (barrier ) \
298298 AnnotateBarrierWaitBefore (__FILE__, __LINE__, barrier)
299299
300300 /* Report that we just exited barrier_wait("barrier"). */
301- #define _Py_ANNOTATE_BARRIER_WAIT_AFTER (barrier) \
301+ #define _Py_ANNOTATE_BARRIER_WAIT_AFTER (barrier ) \
302302 AnnotateBarrierWaitAfter (__FILE__, __LINE__, barrier)
303303
304304 /* Report that the "barrier" has been destroyed. */
305- #define _Py_ANNOTATE_BARRIER_DESTROY (barrier) \
305+ #define _Py_ANNOTATE_BARRIER_DESTROY (barrier ) \
306306 AnnotateBarrierDestroy (__FILE__, __LINE__, barrier)
307307
308308 /* -------------------------------------------------------------
309309 Annotations useful for testing race detectors. */
310310
311311 /* Report that we expect a race on the variable at "address".
312312 Use only in unit tests for a race detector. */
313- #define _Py_ANNOTATE_EXPECT_RACE (address, description) \
313+ #define _Py_ANNOTATE_EXPECT_RACE (address, description ) \
314314 AnnotateExpectRace (__FILE__, __LINE__, address, description)
315315
316316 /* A no-op. Insert where you like to test the interceptors. */
317- #define _Py_ANNOTATE_NO_OP (arg) \
317+ #define _Py_ANNOTATE_NO_OP (arg ) \
318318 AnnotateNoOp (__FILE__, __LINE__, arg)
319319
320320 /* Force the race detector to flush its state. The actual effect depends on
321321 * the implementation of the detector. */
322- #define _Py_ANNOTATE_FLUSH_STATE () \
322+ #define _Py_ANNOTATE_FLUSH_STATE () \
323323 AnnotateFlushState (__FILE__, __LINE__)
324324
325325
326326#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
327327
328- #define _Py_ANNOTATE_RWLOCK_CREATE (lock ) /* empty */
329- #define _Py_ANNOTATE_RWLOCK_DESTROY (lock ) /* empty */
330- #define _Py_ANNOTATE_RWLOCK_ACQUIRED (lock, is_w ) /* empty */
331- #define _Py_ANNOTATE_RWLOCK_RELEASED (lock, is_w ) /* empty */
332- #define _Py_ANNOTATE_BARRIER_INIT (barrier, count, reinitialization_allowed ) /* */
333- #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE (barrier ) /* empty */
334- #define _Py_ANNOTATE_BARRIER_WAIT_AFTER (barrier ) /* empty */
335- #define _Py_ANNOTATE_BARRIER_DESTROY (barrier ) /* empty */
336- #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT (cv, lock ) /* empty */
337- #define _Py_ANNOTATE_CONDVAR_WAIT (cv ) /* empty */
338- #define _Py_ANNOTATE_CONDVAR_SIGNAL (cv ) /* empty */
339- #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL (cv ) /* empty */
340- #define _Py_ANNOTATE_HAPPENS_BEFORE (obj ) /* empty */
341- #define _Py_ANNOTATE_HAPPENS_AFTER (obj ) /* empty */
342- #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE (address, size ) /* empty */
343- #define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE (address, size ) /* empty */
344- #define _Py_ANNOTATE_SWAP_MEMORY_RANGE (address, size ) /* empty */
345- #define _Py_ANNOTATE_PCQ_CREATE (pcq ) /* empty */
346- #define _Py_ANNOTATE_PCQ_DESTROY (pcq ) /* empty */
347- #define _Py_ANNOTATE_PCQ_PUT (pcq ) /* empty */
348- #define _Py_ANNOTATE_PCQ_GET (pcq ) /* empty */
349- #define _Py_ANNOTATE_NEW_MEMORY (address, size ) /* empty */
350- #define _Py_ANNOTATE_EXPECT_RACE (address, description ) /* empty */
351- #define _Py_ANNOTATE_BENIGN_RACE (address, description ) /* empty */
352- #define _Py_ANNOTATE_BENIGN_RACE_SIZED (address, size, description ) /* empty */
353- #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX (mu ) /* empty */
354- #define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR (mu ) /* empty */
355- #define _Py_ANNOTATE_TRACE_MEMORY (arg ) /* empty */
356- #define _Py_ANNOTATE_THREAD_NAME (name ) /* empty */
357- #define _Py_ANNOTATE_IGNORE_READS_BEGIN () /* empty */
358- #define _Py_ANNOTATE_IGNORE_READS_END () /* empty */
359- #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN () /* empty */
360- #define _Py_ANNOTATE_IGNORE_WRITES_END () /* empty */
361- #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN () /* empty */
362- #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END () /* empty */
363- #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN () /* empty */
364- #define _Py_ANNOTATE_IGNORE_SYNC_END () /* empty */
365- #define _Py_ANNOTATE_ENABLE_RACE_DETECTION (enable ) /* empty */
366- #define _Py_ANNOTATE_NO_OP (arg ) /* empty */
367- #define _Py_ANNOTATE_FLUSH_STATE () /* empty */
328+ #define _Py_ANNOTATE_RWLOCK_CREATE (lock ) /* empty */
329+ #define _Py_ANNOTATE_RWLOCK_DESTROY (lock ) /* empty */
330+ #define _Py_ANNOTATE_RWLOCK_ACQUIRED (lock, is_w ) /* empty */
331+ #define _Py_ANNOTATE_RWLOCK_RELEASED (lock, is_w ) /* empty */
332+ #define _Py_ANNOTATE_BARRIER_INIT (barrier, count, reinitialization_allowed ) /* */
333+ #define _Py_ANNOTATE_BARRIER_WAIT_BEFORE (barrier ) /* empty */
334+ #define _Py_ANNOTATE_BARRIER_WAIT_AFTER (barrier ) /* empty */
335+ #define _Py_ANNOTATE_BARRIER_DESTROY (barrier ) /* empty */
336+ #define _Py_ANNOTATE_CONDVAR_LOCK_WAIT (cv, lock ) /* empty */
337+ #define _Py_ANNOTATE_CONDVAR_WAIT (cv ) /* empty */
338+ #define _Py_ANNOTATE_CONDVAR_SIGNAL (cv ) /* empty */
339+ #define _Py_ANNOTATE_CONDVAR_SIGNAL_ALL (cv ) /* empty */
340+ #define _Py_ANNOTATE_HAPPENS_BEFORE (obj ) /* empty */
341+ #define _Py_ANNOTATE_HAPPENS_AFTER (obj ) /* empty */
342+ #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE (address, size ) /* empty */
343+ #define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE (address, size ) /* empty */
344+ #define _Py_ANNOTATE_SWAP_MEMORY_RANGE (address, size ) /* empty */
345+ #define _Py_ANNOTATE_PCQ_CREATE (pcq ) /* empty */
346+ #define _Py_ANNOTATE_PCQ_DESTROY (pcq ) /* empty */
347+ #define _Py_ANNOTATE_PCQ_PUT (pcq ) /* empty */
348+ #define _Py_ANNOTATE_PCQ_GET (pcq ) /* empty */
349+ #define _Py_ANNOTATE_NEW_MEMORY (address, size ) /* empty */
350+ #define _Py_ANNOTATE_EXPECT_RACE (address, description ) /* empty */
351+ #define _Py_ANNOTATE_BENIGN_RACE (address, description ) /* empty */
352+ #define _Py_ANNOTATE_BENIGN_RACE_SIZED (address, size, description ) /* empty */
353+ #define _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX (mu ) /* empty */
354+ #define _Py_ANNOTATE_MUTEX_IS_USED_AS_CONDVAR (mu ) /* empty */
355+ #define _Py_ANNOTATE_TRACE_MEMORY (arg ) /* empty */
356+ #define _Py_ANNOTATE_THREAD_NAME (name ) /* empty */
357+ #define _Py_ANNOTATE_IGNORE_READS_BEGIN () /* empty */
358+ #define _Py_ANNOTATE_IGNORE_READS_END () /* empty */
359+ #define _Py_ANNOTATE_IGNORE_WRITES_BEGIN () /* empty */
360+ #define _Py_ANNOTATE_IGNORE_WRITES_END () /* empty */
361+ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN () /* empty */
362+ #define _Py_ANNOTATE_IGNORE_READS_AND_WRITES_END () /* empty */
363+ #define _Py_ANNOTATE_IGNORE_SYNC_BEGIN () /* empty */
364+ #define _Py_ANNOTATE_IGNORE_SYNC_END () /* empty */
365+ #define _Py_ANNOTATE_ENABLE_RACE_DETECTION (enable ) /* empty */
366+ #define _Py_ANNOTATE_NO_OP (arg ) /* empty */
367+ #define _Py_ANNOTATE_FLUSH_STATE () /* empty */
368368
369369#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
370370
@@ -477,7 +477,7 @@ int RunningOnValgrind(void);
477477 return res;
478478 }
479479 /* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
480- #define _Py_ANNOTATE_BENIGN_RACE_STATIC (static_var, description ) \
480+ #define _Py_ANNOTATE_BENIGN_RACE_STATIC (static_var, description ) \
481481 namespace { \
482482 class static_var ## _annotator { \
483483 public: \
@@ -491,8 +491,8 @@ int RunningOnValgrind(void);
491491 }
492492#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
493493
494- #define _Py_ANNOTATE_UNPROTECTED_READ (x ) (x)
495- #define _Py_ANNOTATE_BENIGN_RACE_STATIC (static_var, description ) /* empty */
494+ #define _Py_ANNOTATE_UNPROTECTED_READ (x ) (x)
495+ #define _Py_ANNOTATE_BENIGN_RACE_STATIC (static_var, description ) /* empty */
496496
497497#endif /* DYNAMIC_ANNOTATIONS_ENABLED */
498498
0 commit comments