1 //===-- sanitizer_atomic.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file is a part of ThreadSanitizer/AddressSanitizer runtime.
12 //===----------------------------------------------------------------------===//
14 #ifndef SANITIZER_ATOMIC_H
15 #define SANITIZER_ATOMIC_H
17 #include "sanitizer_internal_defs.h"
19 namespace __sanitizer {
22 memory_order_relaxed = 1 << 0,
23 memory_order_consume = 1 << 1,
24 memory_order_acquire = 1 << 2,
25 memory_order_release = 1 << 3,
26 memory_order_acq_rel = 1 << 4,
27 memory_order_seq_cst = 1 << 5
30 struct atomic_uint8_t {
32 volatile Type val_dont_use;
35 struct atomic_uint16_t {
37 volatile Type val_dont_use;
40 struct atomic_uint32_t {
42 volatile Type val_dont_use;
45 struct atomic_uint64_t {
47 // On 32-bit platforms u64 is not necessary aligned on 8 bytes.
48 volatile ALIGNED(8) Type val_dont_use;
51 struct atomic_uintptr_t {
53 volatile Type val_dont_use;
56 } // namespace __sanitizer
59 # include "sanitizer_atomic_clang.h"
60 #elif defined(_MSC_VER)
61 # include "sanitizer_atomic_msvc.h"
63 # error "Unsupported compiler"
66 #endif // SANITIZER_ATOMIC_H