24
24
extern " C" {
25
25
#endif // __cplusplus
26
26
27
- // Initializes rtsan if it has not been initialized yet.
28
- // Used by the RTSan runtime to ensure that rtsan is initialized before any
29
- // other rtsan functions are called.
30
- void SANITIZER_CDECL __rtsan_ensure_initialized ();
31
-
32
- // Enter real-time context.
33
- // When in a real-time context, RTSan interceptors will error if realtime
34
- // violations are detected. Calls to this method are injected at the code
35
- // generation stage when RTSan is enabled.
36
- void SANITIZER_CDECL __rtsan_realtime_enter ();
37
-
38
- // Exit the real-time context.
39
- // When not in a real-time context, RTSan interceptors will simply forward
40
- // intercepted method calls to the real methods.
41
- void SANITIZER_CDECL __rtsan_realtime_exit ();
42
-
43
27
// Disable all RTSan error reporting.
44
28
void SANITIZER_CDECL __rtsan_disable (void );
45
29
46
30
// Re-enable all RTSan error reporting.
47
31
// The counterpart to `__rtsan_disable`.
48
32
void SANITIZER_CDECL __rtsan_enable (void );
49
33
50
- // Expect that the next call to a function with the given name will not be
51
- // called from a realtime context.
52
- void SANITIZER_CDECL
53
- __rtsan_expect_not_realtime (const char *intercepted_function_name);
54
-
55
34
#ifdef __cplusplus
56
35
} // extern "C"
57
36
58
37
namespace __rtsan {
59
- #if (defined(__has_feature) && __has_feature(realtime_sanitizer)) || \
60
- SANITIZE_REALTIME
61
-
62
- void Initialize () { __rtsan_ensure_initialized (); }
63
-
64
- class ScopedEnabler {
65
- public:
66
- ScopedEnabler () { __rtsan_realtime_enter (); }
67
- ~ScopedEnabler () { __rtsan_realtime_exit (); }
68
-
69
- #if __cplusplus >= 201103L
70
- ScopedEnabler (const ScopedEnabler &) = delete;
71
- ScopedEnabler &operator =(const ScopedEnabler &) = delete ;
72
- ScopedEnabler (ScopedEnabler &&) = delete;
73
- ScopedEnabler &operator =(ScopedEnabler &&) = delete ;
74
- #else
75
- private:
76
- ScopedEnabler (const ScopedEnabler &);
77
- ScopedEnabler &operator =(const ScopedEnabler &);
78
- #endif // __cplusplus >= 201103L
79
- };
38
+ #if defined(__has_feature) && __has_feature(realtime_sanitizer)
80
39
81
40
class ScopedDisabler {
82
41
public:
@@ -97,20 +56,12 @@ class ScopedDisabler {
97
56
98
57
#else // doesn't have realtime_sanitizer
99
58
100
- void Initialize () {}
101
-
102
- class ScopedEnabler {
103
- public:
104
- ScopedEnabler () {}
105
- };
106
-
107
59
class ScopedDisabler {
108
60
public:
109
61
ScopedDisabler () {}
110
62
};
111
63
112
- #endif // (defined(__has_feature) && __has_feature(realtime_sanitizer)) ||
113
- // SANITIZE_REALTIME
64
+ #endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
114
65
} // namespace __rtsan
115
66
#endif // __cplusplus
116
67
0 commit comments