5 #ifndef RTE_LOCK_ANNOTATIONS_H
6 #define RTE_LOCK_ANNOTATIONS_H
12 #ifdef RTE_ANNOTATE_LOCKS
14 #define __rte_lockable \
15 __attribute__((lockable))
17 #define __rte_guarded_by(...) \
18 __attribute__((guarded_by(__VA_ARGS__)))
19 #define __rte_guarded_var \
20 __attribute__((guarded_var))
22 #define __rte_exclusive_locks_required(...) \
23 __attribute__((exclusive_locks_required(__VA_ARGS__)))
24 #define __rte_exclusive_lock_function(...) \
25 __attribute__((exclusive_lock_function(__VA_ARGS__)))
26 #define __rte_exclusive_trylock_function(ret, ...) \
27 __attribute__((exclusive_trylock_function(ret, __VA_ARGS__)))
28 #define __rte_assert_exclusive_lock(...) \
29 __attribute__((assert_exclusive_lock(__VA_ARGS__)))
31 #define __rte_shared_locks_required(...) \
32 __attribute__((shared_locks_required(__VA_ARGS__)))
33 #define __rte_shared_lock_function(...) \
34 __attribute__((shared_lock_function(__VA_ARGS__)))
35 #define __rte_shared_trylock_function(ret, ...) \
36 __attribute__((shared_trylock_function(ret, __VA_ARGS__)))
37 #define __rte_assert_shared_lock(...) \
38 __attribute__((assert_shared_lock(__VA_ARGS__)))
40 #define __rte_unlock_function(...) \
41 __attribute__((unlock_function(__VA_ARGS__)))
43 #define __rte_locks_excluded(...) \
44 __attribute__((locks_excluded(__VA_ARGS__)))
47 #if defined(__clang__) && __clang_major__ >= 11
48 #define __rte_capability(...) \
49 __attribute__((capability(__VA_ARGS__)))
51 #define __rte_capability(...) \
52 __attribute__((capability("mutex")))
55 #define __rte_requires_capability(...) \
56 __attribute__((requires_capability(__VA_ARGS__)))
57 #define __rte_acquire_capability(...) \
58 __attribute__((acquire_capability(__VA_ARGS__)))
59 #define __rte_try_acquire_capability(ret, ...) \
60 __attribute__((try_acquire_capability(ret, __VA_ARGS__)))
61 #define __rte_release_capability(...) \
62 __attribute__((release_capability(__VA_ARGS__)))
63 #define __rte_assert_capability(...) \
64 __attribute__((assert_capability(__VA_ARGS__)))
66 #define __rte_requires_shared_capability(...) \
67 __attribute__((requires_shared_capability(__VA_ARGS__)))
68 #define __rte_acquire_shared_capability(...) \
69 __attribute__((acquire_shared_capability(__VA_ARGS__)))
70 #define __rte_try_acquire_shared_capability(ret, ...) \
71 __attribute__((try_acquire_shared_capability(ret, __VA_ARGS__)))
72 #define __rte_release_shared_capability(...) \
73 __attribute__((release_shared_capability(__VA_ARGS__)))
74 #define __rte_assert_shared_capability(...) \
75 __attribute__((assert_shared_capability(__VA_ARGS__)))
77 #define __rte_exclude_capability(...) \
78 __attribute__((exclude_capability(__VA_ARGS__)))
81 #define __rte_no_thread_safety_analysis \
82 __attribute__((no_thread_safety_analysis))
86 #define __rte_lockable
88 #define __rte_guarded_by(...)
89 #define __rte_guarded_var
91 #define __rte_exclusive_locks_required(...)
92 #define __rte_exclusive_lock_function(...)
93 #define __rte_exclusive_trylock_function(...)
94 #define __rte_assert_exclusive_lock(...)
96 #define __rte_shared_locks_required(...)
97 #define __rte_shared_lock_function(...)
98 #define __rte_shared_trylock_function(...)
99 #define __rte_assert_shared_lock(...)
101 #define __rte_unlock_function(...)
103 #define __rte_locks_excluded(...)
106 #define __rte_capability(...)
108 #define __rte_requires_capability(...)
109 #define __rte_acquire_capability(...)
110 #define __rte_try_acquire_capability(...)
111 #define __rte_release_capability(...)
112 #define __rte_assert_capability(...)
114 #define __rte_requires_shared_capability(...)
115 #define __rte_acquire_shared_capability(...)
116 #define __rte_try_acquire_shared_capability(...)
117 #define __rte_release_shared_capability(...)
118 #define __rte_assert_shared_capability(...)
120 #define __rte_exclude_capability(...)
123 #define __rte_no_thread_safety_analysis