blob: 8bf66888b8e0c121b583ab5551685455dc6aa0aa [file] [log] [blame]
bart5530f5f2010-03-07 10:42:15 +00001#ifndef _UNIFIED_ANNOTATIONS_H_
2#define _UNIFIED_ANNOTATIONS_H_
3
4
5#include "../../drd/drd.h"
6
7
8/*
9 * Redefine the happens before/after/done annotation macros such that these
10 * can be intercepted by DRD, Helgrind and ThreadSanitizer. See also
11 * http://code.google.com/p/data-race-test/source/browse/trunk/dynamic_annotations/dynamic_annotations.h
12 */
13#undef ANNOTATE_HAPPENS_BEFORE
14#define ANNOTATE_HAPPENS_BEFORE(addr) \
15 do { \
16 DRDCL_(annotate_happens_before)(addr); \
17 AnnotateCondVarSignal(__FILE__, __LINE__, addr); \
18 } while(0)
19#undef ANNOTATE_HAPPENS_AFTER
20#define ANNOTATE_HAPPENS_AFTER(addr) \
21 do { \
22 DRDCL_(annotate_happens_after)(addr); \
23 AnnotateCondVarWait(__FILE__, __LINE__, addr, NULL); \
24 } while(0)
25#undef ANNOTATE_HAPPENS_DONE
26#define ANNOTATE_HAPPENS_DONE(addr) \
27 do { \
28 DRDCL_(annotate_happens_done)(addr); \
29 } while(0)
30
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35#if 0
36}
37#endif
38
39
40void __attribute__((weak,noinline))
41AnnotateCondVarSignal(const char *file, int line, const volatile void *cv)
42{
43 asm("");
44}
45
46void __attribute__((weak,noinline))
47AnnotateCondVarWait(const char *file, int line, const volatile void *cv,
48 const volatile void *lock)
49{
50 asm("");
51}
52
53
54#if 0
55{
56#endif
57#ifdef __cplusplus
58}
59#endif
60
61
62#endif /* _UNIFIED_ANNOTATIONS_H_ */
63
64/*
65 * Local variables:
66 * c-basic-offset: 2
67 * End:
68 */