stdatomic.h 4.0 KB

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