* include/bits/allocator.h (operator==, operator!=): Add exception
[official-gcc.git] / libsanitizer / tsan / tsan_interface_atomic.h
blobc500614acc4cae36f6ba8976a1727c9818e23dc1
1 //===-- tsan_interface_atomic.h ---------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 //===----------------------------------------------------------------------===//
11 #ifndef TSAN_INTERFACE_ATOMIC_H
12 #define TSAN_INTERFACE_ATOMIC_H
14 #ifndef INTERFACE_ATTRIBUTE
15 # define INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
16 #endif
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
22 typedef char __tsan_atomic8;
23 typedef short __tsan_atomic16; // NOLINT
24 typedef int __tsan_atomic32;
25 typedef long __tsan_atomic64; // NOLINT
27 #if defined(__SIZEOF_INT128__) \
28 || (__clang_major__ * 100 + __clang_minor__ >= 302)
29 __extension__ typedef __int128 __tsan_atomic128;
30 #define __TSAN_HAS_INT128 1
31 #else
32 typedef char __tsan_atomic128;
33 #define __TSAN_HAS_INT128 0
34 #endif
36 // Part of ABI, do not change.
37 // http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?view=markup
38 typedef enum {
39 __tsan_memory_order_relaxed,
40 __tsan_memory_order_consume,
41 __tsan_memory_order_acquire,
42 __tsan_memory_order_release,
43 __tsan_memory_order_acq_rel,
44 __tsan_memory_order_seq_cst
45 } __tsan_memory_order;
47 __tsan_atomic8 __tsan_atomic8_load(const volatile __tsan_atomic8 *a,
48 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
49 __tsan_atomic16 __tsan_atomic16_load(const volatile __tsan_atomic16 *a,
50 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
51 __tsan_atomic32 __tsan_atomic32_load(const volatile __tsan_atomic32 *a,
52 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
53 __tsan_atomic64 __tsan_atomic64_load(const volatile __tsan_atomic64 *a,
54 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
55 __tsan_atomic128 __tsan_atomic128_load(const volatile __tsan_atomic128 *a,
56 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
58 void __tsan_atomic8_store(volatile __tsan_atomic8 *a, __tsan_atomic8 v,
59 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
60 void __tsan_atomic16_store(volatile __tsan_atomic16 *a, __tsan_atomic16 v,
61 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
62 void __tsan_atomic32_store(volatile __tsan_atomic32 *a, __tsan_atomic32 v,
63 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
64 void __tsan_atomic64_store(volatile __tsan_atomic64 *a, __tsan_atomic64 v,
65 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
66 void __tsan_atomic128_store(volatile __tsan_atomic128 *a, __tsan_atomic128 v,
67 __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
69 __tsan_atomic8 __tsan_atomic8_exchange(volatile __tsan_atomic8 *a,
70 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
71 __tsan_atomic16 __tsan_atomic16_exchange(volatile __tsan_atomic16 *a,
72 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
73 __tsan_atomic32 __tsan_atomic32_exchange(volatile __tsan_atomic32 *a,
74 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
75 __tsan_atomic64 __tsan_atomic64_exchange(volatile __tsan_atomic64 *a,
76 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
77 __tsan_atomic128 __tsan_atomic128_exchange(volatile __tsan_atomic128 *a,
78 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
80 __tsan_atomic8 __tsan_atomic8_fetch_add(volatile __tsan_atomic8 *a,
81 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
82 __tsan_atomic16 __tsan_atomic16_fetch_add(volatile __tsan_atomic16 *a,
83 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
84 __tsan_atomic32 __tsan_atomic32_fetch_add(volatile __tsan_atomic32 *a,
85 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
86 __tsan_atomic64 __tsan_atomic64_fetch_add(volatile __tsan_atomic64 *a,
87 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
88 __tsan_atomic128 __tsan_atomic128_fetch_add(volatile __tsan_atomic128 *a,
89 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
91 __tsan_atomic8 __tsan_atomic8_fetch_sub(volatile __tsan_atomic8 *a,
92 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
93 __tsan_atomic16 __tsan_atomic16_fetch_sub(volatile __tsan_atomic16 *a,
94 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
95 __tsan_atomic32 __tsan_atomic32_fetch_sub(volatile __tsan_atomic32 *a,
96 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
97 __tsan_atomic64 __tsan_atomic64_fetch_sub(volatile __tsan_atomic64 *a,
98 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
99 __tsan_atomic128 __tsan_atomic128_fetch_sub(volatile __tsan_atomic128 *a,
100 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
102 __tsan_atomic8 __tsan_atomic8_fetch_and(volatile __tsan_atomic8 *a,
103 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
104 __tsan_atomic16 __tsan_atomic16_fetch_and(volatile __tsan_atomic16 *a,
105 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
106 __tsan_atomic32 __tsan_atomic32_fetch_and(volatile __tsan_atomic32 *a,
107 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
108 __tsan_atomic64 __tsan_atomic64_fetch_and(volatile __tsan_atomic64 *a,
109 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
110 __tsan_atomic128 __tsan_atomic128_fetch_and(volatile __tsan_atomic128 *a,
111 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
113 __tsan_atomic8 __tsan_atomic8_fetch_or(volatile __tsan_atomic8 *a,
114 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
115 __tsan_atomic16 __tsan_atomic16_fetch_or(volatile __tsan_atomic16 *a,
116 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
117 __tsan_atomic32 __tsan_atomic32_fetch_or(volatile __tsan_atomic32 *a,
118 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
119 __tsan_atomic64 __tsan_atomic64_fetch_or(volatile __tsan_atomic64 *a,
120 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
121 __tsan_atomic128 __tsan_atomic128_fetch_or(volatile __tsan_atomic128 *a,
122 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
124 __tsan_atomic8 __tsan_atomic8_fetch_xor(volatile __tsan_atomic8 *a,
125 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
126 __tsan_atomic16 __tsan_atomic16_fetch_xor(volatile __tsan_atomic16 *a,
127 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
128 __tsan_atomic32 __tsan_atomic32_fetch_xor(volatile __tsan_atomic32 *a,
129 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
130 __tsan_atomic64 __tsan_atomic64_fetch_xor(volatile __tsan_atomic64 *a,
131 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
132 __tsan_atomic128 __tsan_atomic128_fetch_xor(volatile __tsan_atomic128 *a,
133 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
135 __tsan_atomic8 __tsan_atomic8_fetch_nand(volatile __tsan_atomic8 *a,
136 __tsan_atomic8 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
137 __tsan_atomic16 __tsan_atomic16_fetch_nand(volatile __tsan_atomic16 *a,
138 __tsan_atomic16 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
139 __tsan_atomic32 __tsan_atomic32_fetch_nand(volatile __tsan_atomic32 *a,
140 __tsan_atomic32 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
141 __tsan_atomic64 __tsan_atomic64_fetch_nand(volatile __tsan_atomic64 *a,
142 __tsan_atomic64 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
143 __tsan_atomic128 __tsan_atomic128_fetch_nand(volatile __tsan_atomic128 *a,
144 __tsan_atomic128 v, __tsan_memory_order mo) INTERFACE_ATTRIBUTE;
146 int __tsan_atomic8_compare_exchange_weak(volatile __tsan_atomic8 *a,
147 __tsan_atomic8 *c, __tsan_atomic8 v, __tsan_memory_order mo,
148 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
149 int __tsan_atomic16_compare_exchange_weak(volatile __tsan_atomic16 *a,
150 __tsan_atomic16 *c, __tsan_atomic16 v, __tsan_memory_order mo,
151 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
152 int __tsan_atomic32_compare_exchange_weak(volatile __tsan_atomic32 *a,
153 __tsan_atomic32 *c, __tsan_atomic32 v, __tsan_memory_order mo,
154 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
155 int __tsan_atomic64_compare_exchange_weak(volatile __tsan_atomic64 *a,
156 __tsan_atomic64 *c, __tsan_atomic64 v, __tsan_memory_order mo,
157 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
158 int __tsan_atomic128_compare_exchange_weak(volatile __tsan_atomic128 *a,
159 __tsan_atomic128 *c, __tsan_atomic128 v, __tsan_memory_order mo,
160 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
162 int __tsan_atomic8_compare_exchange_strong(volatile __tsan_atomic8 *a,
163 __tsan_atomic8 *c, __tsan_atomic8 v, __tsan_memory_order mo,
164 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
165 int __tsan_atomic16_compare_exchange_strong(volatile __tsan_atomic16 *a,
166 __tsan_atomic16 *c, __tsan_atomic16 v, __tsan_memory_order mo,
167 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
168 int __tsan_atomic32_compare_exchange_strong(volatile __tsan_atomic32 *a,
169 __tsan_atomic32 *c, __tsan_atomic32 v, __tsan_memory_order mo,
170 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
171 int __tsan_atomic64_compare_exchange_strong(volatile __tsan_atomic64 *a,
172 __tsan_atomic64 *c, __tsan_atomic64 v, __tsan_memory_order mo,
173 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
174 int __tsan_atomic128_compare_exchange_strong(volatile __tsan_atomic128 *a,
175 __tsan_atomic128 *c, __tsan_atomic128 v, __tsan_memory_order mo,
176 __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
178 __tsan_atomic8 __tsan_atomic8_compare_exchange_val(
179 volatile __tsan_atomic8 *a, __tsan_atomic8 c, __tsan_atomic8 v,
180 __tsan_memory_order mo, __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
181 __tsan_atomic16 __tsan_atomic16_compare_exchange_val(
182 volatile __tsan_atomic16 *a, __tsan_atomic16 c, __tsan_atomic16 v,
183 __tsan_memory_order mo, __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
184 __tsan_atomic32 __tsan_atomic32_compare_exchange_val(
185 volatile __tsan_atomic32 *a, __tsan_atomic32 c, __tsan_atomic32 v,
186 __tsan_memory_order mo, __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
187 __tsan_atomic64 __tsan_atomic64_compare_exchange_val(
188 volatile __tsan_atomic64 *a, __tsan_atomic64 c, __tsan_atomic64 v,
189 __tsan_memory_order mo, __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
190 __tsan_atomic128 __tsan_atomic128_compare_exchange_val(
191 volatile __tsan_atomic128 *a, __tsan_atomic128 c, __tsan_atomic128 v,
192 __tsan_memory_order mo, __tsan_memory_order fail_mo) INTERFACE_ATTRIBUTE;
194 void __tsan_atomic_thread_fence(__tsan_memory_order mo) INTERFACE_ATTRIBUTE;
195 void __tsan_atomic_signal_fence(__tsan_memory_order mo) INTERFACE_ATTRIBUTE;
197 #ifdef __cplusplus
198 } // extern "C"
199 #endif
201 #undef INTERFACE_ATTRIBUTE
203 #endif // #ifndef TSAN_INTERFACE_ATOMIC_H