drd: Add a consistency check
[valgrind.git] / drd / tests / unified_annotations.h
blob4973e8f98d95ad4e86a68aebc933681b65bdb30f
1 #ifndef _UNIFIED_ANNOTATIONS_H_
2 #define _UNIFIED_ANNOTATIONS_H_
5 #include "../../drd/drd.h"
8 /*
9 * Define annotation macros such that these can be intercepted by DRD, Helgrind
10 * and ThreadSanitizer. See also
11 * http://code.google.com/p/data-race-test/source/browse/trunk/dynamic_annotations/dynamic_annotations.h
13 #define U_ANNOTATE_NEW_MEMORY(addr, size) ANNOTATE_NEW_MEMORY(addr, size)
14 #define U_ANNOTATE_HAPPENS_BEFORE(addr) U_AnnotateHappensBefore(addr)
15 #define U_ANNOTATE_HAPPENS_AFTER(addr) U_AnnotateHappensAfter(addr)
16 #define U_ANNOTATE_HAPPENS_DONE(addr) \
17 do { \
18 ANNOTATE_HAPPENS_DONE(addr); \
19 } while(0)
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 #if 0
27 #endif
30 void __attribute__((weak,noinline))
31 AnnotateCondVarSignal(const char *file, int line, const volatile void *cv)
33 asm("");
36 void __attribute__((weak,noinline))
37 AnnotateCondVarWait(const char *file, int line, const volatile void *cv,
38 const volatile void *lock)
40 asm("");
43 static __inline__ void U_AnnotateHappensBefore(void* addr)
45 ANNOTATE_HAPPENS_BEFORE(addr);
46 AnnotateCondVarSignal(__FILE__, __LINE__, addr);
49 static __inline__ void U_AnnotateHappensAfter(void *addr)
51 ANNOTATE_HAPPENS_AFTER(addr);
52 AnnotateCondVarWait(__FILE__, __LINE__, addr, NULL);
56 #if 0
58 #endif
59 #ifdef __cplusplus
61 #endif
64 #endif /* _UNIFIED_ANNOTATIONS_H_ */