24 | 24 |
#include "nsync_note.h"
|
25 | 25 |
|
26 | 26 |
/* Annotations for race detectors. */
|
27 | |
#if defined(__has_feature)
|
28 | |
#if __has_feature(thread_sanitizer)
|
29 | |
#include "third_party/absl/base/dynamic_annotations.h"
|
30 | |
#define IGNORE_RACES_START() ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN()
|
31 | |
#define IGNORE_RACES_END() ANNOTATE_IGNORE_READS_AND_WRITES_END()
|
32 | |
#endif
|
33 | |
#endif
|
34 | |
#if !defined(IGNORE_RACES_START)
|
|
27 |
#if defined(__has_feature) && !defined(__SANITIZE_THREAD__)
|
|
28 |
#if __has_feature(thread_sanitizer) /* used by clang */
|
|
29 |
#define __SANITIZE_THREAD__ 1 /* GCC uses this; fake it in clang */
|
|
30 |
#endif
|
|
31 |
#endif
|
|
32 |
#if defined(__SANITIZE_THREAD__)
|
|
33 |
NSYNC_C_START_
|
|
34 |
void AnnotateIgnoreWritesBegin(const char* file, int line);
|
|
35 |
void AnnotateIgnoreWritesEnd(const char* file, int line);
|
|
36 |
void AnnotateIgnoreReadsBegin(const char* file, int line);
|
|
37 |
void AnnotateIgnoreReadsEnd(const char* file, int line);
|
|
38 |
NSYNC_C_END_
|
|
39 |
#define IGNORE_RACES_START() \
|
|
40 |
do { \
|
|
41 |
AnnotateIgnoreReadsBegin(__FILE__, __LINE__); \
|
|
42 |
AnnotateIgnoreWritesBegin(__FILE__, __LINE__); \
|
|
43 |
} while (0)
|
|
44 |
#define IGNORE_RACES_END() \
|
|
45 |
do { \
|
|
46 |
AnnotateIgnoreWritesEnd(__FILE__, __LINE__); \
|
|
47 |
AnnotateIgnoreReadsEnd(__FILE__, __LINE__); \
|
|
48 |
} while (0)
|
|
49 |
#else
|
35 | 50 |
#define IGNORE_RACES_START()
|
36 | 51 |
#define IGNORE_RACES_END()
|
37 | 52 |
#endif
|