llvm-project/libcxx/include
Louis Dionne 92832e4889 [libc++] Enable <atomic> when threads are disabled
std::atomic is, for the most part, just a thin veneer on top of compiler
builtins. Hence, it should be available even when threads are not available
on the system, and in fact there has been requests for such support.

This patch:
- Moves __libcpp_thread_poll_with_backoff to its own header so it can
  be used in <atomic> when threads are disabled.
- Adds a dummy backoff policy for atomic polling that doesn't know about
  threads.
- Adjusts the <atomic> feature-test macros so they are provided even when
  threads are disabled.
- Runs the <atomic> tests when threads are disabled.

rdar://77873569

Differential Revision: https://reviews.llvm.org/D114109
2021-11-17 23:02:58 -05:00
..
__algorithm [libc++] Unspecified behavior randomization in libc++ 2021-11-16 15:55:33 -05:00
__bit [libc++] Implement C++20's P0476R2: std::bit_cast 2021-09-09 11:05:54 -04:00
__charconv [libc++][NFC] split <charconv>. 2021-08-31 18:45:19 +02:00
__compare [libc++] Remove _LIBCPP_HAS_NO_SPACESHIP_OPERATOR 2021-11-17 10:59:57 -05:00
__concepts [libc++] Remove an unused internal concept. 2021-09-02 19:27:49 +02:00
__coroutine [libc++] Remove _LIBCPP_HAS_NO_SPACESHIP_OPERATOR 2021-11-17 10:59:57 -05:00
__format [libc++][NFC] Move format_to_n_result. 2021-11-16 15:51:49 +01:00
__functional [libc++] Always define a key function for std::bad_function_call in the dylib 2021-11-16 11:23:27 -08:00
__iterator [libcxx] Fix enable_if condition of std::reverse_iterator::operator= 2021-11-15 13:08:36 +00:00
__memory [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
__random [libcxx] Move all algorithms into their own headers 2021-06-19 07:49:06 -04:00
__ranges [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__support [SystemZ][z/OS] Fix warnings from unsigned int to long in 32-bit mode 2021-11-16 13:51:35 +00:00
__thread [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
__utility [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__variant [libc++][NFC] Remove useless _LIBCPP_PUSH_MACROS 2021-08-27 12:41:55 -04:00
experimental [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ext [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
CMakeLists.txt [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
__availability [libc++][format] Add __format_arg_store. 2021-09-01 19:45:02 +02:00
__bit_reference [libc++] __bit_iterator mustn't rely on deprecated SMF generation. 2021-04-26 16:22:42 -04:00
__bits [libc++] Fix some typos and remove unused macros. NFCI. 2021-04-22 12:02:22 -04:00
__bsd_locale_defaults.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__bsd_locale_fallbacks.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__config [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
__config_site.in [libc++] Add an option to disable wide character support in libc++ 2021-10-12 06:08:23 -04:00
__debug [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__errc [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__function_like.h [libc++][NFC] Remove useless _LIBCPP_PUSH_MACROS 2021-08-27 12:41:55 -04:00
__functional_base [libcxx][functional][modular] splices <functional> into modular headers 2021-07-01 14:01:49 -04:00
__hash_table [libc++] Use addressof to fix debug tests. 2021-10-12 18:15:35 +02:00
__libcpp_version [libcxx] Bump __libcpp_version to 14 after branch 2021-07-28 11:07:06 +00:00
__locale [libc++] Add an option to disable wide character support in libc++ 2021-10-12 06:08:23 -04:00
__mbstate_t.h [libc++] Add an option to disable wide character support in libc++ 2021-10-12 06:08:23 -04:00
__mutex_base [libc++][NFCI] Remove uses of _LIBCPP_INLINE_VAR 2021-09-22 16:03:00 -04:00
__node_handle [libc++][NFC] Add missing synopsis for node handles 2021-09-07 15:26:33 -04:00
__nullptr [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__split_buffer [libc++] Comma-operator-proof a lot of algorithm/container code. 2021-09-08 13:34:01 -04:00
__std_stream [libc++] Alphabetize and include-what-you-use. NFCI. 2021-05-29 19:54:48 -04:00
__string [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
__threading_support [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
__tree [libc++] Use addressof in assignment operator. 2021-10-07 18:10:47 +02:00
__tuple [libc++] Remove workarounds for [[nodebug]] not working properly on typedefs in older Clangs 2021-09-01 10:51:09 -04:00
__undef_macros [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
algorithm [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
any [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
array [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
atomic [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
barrier [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
bit [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
bitset [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cassert [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ccomplex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cctype [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cerrno [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cfenv [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cfloat [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
charconv [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
chrono [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cinttypes [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ciso646 [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
climits [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
clocale [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cmath [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
codecvt [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
compare [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
complex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
complex.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
concepts [libc++][NFC] Move concepts to a subheader. 2021-09-02 19:22:15 +02:00
condition_variable [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
coroutine [libcxx] [Coroutine] Conform Coroutine Implementation 2021-11-16 14:13:13 +08:00
csetjmp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
csignal [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstdarg [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstdbool [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstddef [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstdint [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstdio [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstdlib [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cstring [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ctgmath [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ctime [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ctype.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cwchar [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
cwctype [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
deque [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
errno.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
exception [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
execution [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
fenv.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
filesystem [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
float.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
format [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
forward_list [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
fstream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
functional [libc++] [P1614] Implement std::compare_three_way. 2021-10-10 21:57:10 -04:00
future [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
initializer_list [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
inttypes.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
iomanip [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ios [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
iosfwd [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
iostream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
istream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
iterator [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
latch [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
limits [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
limits.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
list [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
locale [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
locale.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
map [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
math.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
memory [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
module.modulemap [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
mutex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
new [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
numbers [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
numeric [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
optional [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ostream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
queue [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
random [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ranges [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
ratio [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
regex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
scoped_allocator [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
semaphore [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
set [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
setjmp.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
shared_mutex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
span [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
sstream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stack [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stdbool.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stddef.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stdexcept [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stdint.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stdio.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
stdlib.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
streambuf [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
string [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
string.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
string_view [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
strstream [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
system_error [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
tgmath.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
thread [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
tuple [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
type_traits [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
typeindex [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
typeinfo [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unordered_map [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
unordered_set [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
utility [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
valarray [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
variant [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
vector [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
version [libc++] Enable <atomic> when threads are disabled 2021-11-17 23:02:58 -05:00
wchar.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
wctype.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00