Home | History | Annotate | Line # | Download | only in c_compatibility
      1 // C compatibility header <stdatomic.h> -*- C++ -*-
      2 
      3 // Copyright The GNU Toolchain Authors.
      4 //
      5 // This file is part of the GNU ISO C++ Library.  This library is free
      6 // software; you can redistribute it and/or modify it under the
      7 // terms of the GNU General Public License as published by the
      8 // Free Software Foundation; either version 3, or (at your option)
      9 // any later version.
     10 
     11 // This library is distributed in the hope that it will be useful,
     12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 // GNU General Public License for more details.
     15 
     16 // Under Section 7 of GPL version 3, you are granted additional
     17 // permissions described in the GCC Runtime Library Exception, version
     18 // 3.1, as published by the Free Software Foundation.
     19 
     20 // You should have received a copy of the GNU General Public License and
     21 // a copy of the GCC Runtime Library Exception along with this program;
     22 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     23 // <http://www.gnu.org/licenses/>.
     24 
     25 /** @file include/stdatomic.h
     26  *  This is a Standard C++ Library header.
     27  */
     28 
     29 #ifndef _GLIBCXX_STDATOMIC_H
     30 #define _GLIBCXX_STDATOMIC_H
     31 
     32 #define __glibcxx_want_stdatomic_h
     33 #include <bits/version.h>
     34 
     35 #ifdef __cpp_lib_stdatomic_h // C++ >= 23
     36 #include <atomic>
     37 
     38 #define _Atomic(_Tp) ::std::atomic<_Tp>
     39 
     40 using std::memory_order;
     41 using std::memory_order_relaxed;
     42 using std::memory_order_consume;
     43 using std::memory_order_acquire;
     44 using std::memory_order_release;
     45 using std::memory_order_acq_rel;
     46 using std::memory_order_seq_cst;
     47 using std::atomic_flag;
     48 using std::atomic_bool;
     49 using std::atomic_char;
     50 using std::atomic_schar;
     51 using std::atomic_uchar;
     52 using std::atomic_short;
     53 using std::atomic_ushort;
     54 using std::atomic_int;
     55 using std::atomic_uint;
     56 using std::atomic_long;
     57 using std::atomic_ulong;
     58 using std::atomic_llong;
     59 using std::atomic_ullong;
     60 #ifdef _GLIBCXX_USE_CHAR8_T
     61 using std::atomic_char8_t;
     62 #endif
     63 using std::atomic_char16_t;
     64 using std::atomic_char32_t;
     65 using std::atomic_wchar_t;
     66 #ifdef _GLIBCXX_USE_C99_STDINT
     67 using std::atomic_int8_t;
     68 using std::atomic_uint8_t;
     69 using std::atomic_int16_t;
     70 using std::atomic_uint16_t;
     71 using std::atomic_int32_t;
     72 using std::atomic_uint32_t;
     73 using std::atomic_int64_t;
     74 using std::atomic_uint64_t;
     75 using std::atomic_int_least8_t;
     76 using std::atomic_uint_least8_t;
     77 using std::atomic_int_least16_t;
     78 using std::atomic_uint_least16_t;
     79 using std::atomic_int_least32_t;
     80 using std::atomic_uint_least32_t;
     81 using std::atomic_int_least64_t;
     82 using std::atomic_uint_least64_t;
     83 using std::atomic_int_fast8_t;
     84 using std::atomic_uint_fast8_t;
     85 using std::atomic_int_fast16_t;
     86 using std::atomic_uint_fast16_t;
     87 using std::atomic_int_fast32_t;
     88 using std::atomic_uint_fast32_t;
     89 using std::atomic_int_fast64_t;
     90 using std::atomic_uint_fast64_t;
     91 #endif
     92 using std::atomic_intptr_t;
     93 using std::atomic_uintptr_t;
     94 using std::atomic_size_t;
     95 using std::atomic_ptrdiff_t;
     96 #ifdef _GLIBCXX_USE_C99_STDINT
     97 using std::atomic_intmax_t;
     98 using std::atomic_uintmax_t;
     99 #endif
    100 using std::atomic_is_lock_free;
    101 using std::atomic_load;
    102 using std::atomic_load_explicit;
    103 using std::atomic_store;
    104 using std::atomic_store_explicit;
    105 using std::atomic_exchange;
    106 using std::atomic_exchange_explicit;
    107 using std::atomic_compare_exchange_strong;
    108 using std::atomic_compare_exchange_strong_explicit;
    109 using std::atomic_compare_exchange_weak;
    110 using std::atomic_compare_exchange_weak_explicit;
    111 using std::atomic_fetch_add;
    112 using std::atomic_fetch_add_explicit;
    113 using std::atomic_fetch_sub;
    114 using std::atomic_fetch_sub_explicit;
    115 using std::atomic_fetch_or;
    116 using std::atomic_fetch_or_explicit;
    117 using std::atomic_fetch_xor;
    118 using std::atomic_fetch_xor_explicit;
    119 using std::atomic_fetch_and;
    120 using std::atomic_fetch_and_explicit;
    121 using std::atomic_flag_test_and_set;
    122 using std::atomic_flag_test_and_set_explicit;
    123 using std::atomic_flag_clear;
    124 using std::atomic_flag_clear_explicit;
    125 using std::atomic_thread_fence;
    126 using std::atomic_signal_fence;
    127 
    128 #elif defined __clang__
    129 # include_next <stdatomic.h>
    130 #endif // __cpp_lib_stdatomic_h
    131 #endif // _GLIBCXX_STDATOMIC_H
    132