2012-10-29 Wei Mi <wmi@google.com>
[official-gcc.git] / libasan / sanitizer_common / sanitizer_atomic.h
blobf2bf23588a448da04ab9cba2d164a8a59385d4fb
1 //===-- sanitizer_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/AddressSanitizer runtime.
9 //
10 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_ATOMIC_H
13 #define SANITIZER_ATOMIC_H
15 #include "sanitizer_internal_defs.h"
17 namespace __sanitizer {
19 enum memory_order {
20 memory_order_relaxed = 1 << 0,
21 memory_order_consume = 1 << 1,
22 memory_order_acquire = 1 << 2,
23 memory_order_release = 1 << 3,
24 memory_order_acq_rel = 1 << 4,
25 memory_order_seq_cst = 1 << 5
28 struct atomic_uint8_t {
29 typedef u8 Type;
30 volatile Type val_dont_use;
33 struct atomic_uint16_t {
34 typedef u16 Type;
35 volatile Type val_dont_use;
38 struct atomic_uint32_t {
39 typedef u32 Type;
40 volatile Type val_dont_use;
43 struct atomic_uint64_t {
44 typedef u64 Type;
45 volatile Type val_dont_use;
48 struct atomic_uintptr_t {
49 typedef uptr Type;
50 volatile Type val_dont_use;
53 } // namespace __sanitizer
55 #if defined(__GNUC__)
56 # include "sanitizer_atomic_clang.h"
57 #elif defined(_MSC_VER)
58 # include "sanitizer_atomic_msvc.h"
59 #else
60 # error "Unsupported compiler"
61 #endif
63 #endif // SANITIZER_ATOMIC_H