libstdc++: Define (and use) _GLIBCXX_HAVE_ATOMIC_WAIT
authorJonathan Wakely <jwakely@redhat.com>
Thu, 26 Nov 2020 22:23:11 +0000 (22:23 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 26 Nov 2020 23:53:09 +0000 (23:53 +0000)
commit61c71a62453e4f2def5d94bdb2b293fcec463c14
tree822686c18c7b1d3ca3321b383d5c50426a14160a
parent71988274865bf049c7705ce33350661b75f0af74
libstdc++: Define (and use) _GLIBCXX_HAVE_ATOMIC_WAIT

In order to simplify the preprocessor checks for whether __atomic_wait
is available, this commit does:

-#if defined _GLIBCXX_HAS_GTHREADS || _GLIBCXX_HAVE_LINUX_FUTEX
+#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT

The original was wrong anyway, as it should have used 'defined' to check
_GLIBCXX_HAVE_LINUX_FUTEX (for consistency with how that's used
elsewhere).

The new macro is defined in <bits/atomic_wait.h> when the file is
defines __atomic_wait and related facilities. All other code that
depends on those features can just check the one macro.

libstdc++-v3/ChangeLog:

* include/bits/atomic_wait.h (_GLIBCXX_HAVE_ATOMIC_WAIT):
Define.
* include/bits/atomic_base.h: Check _GLIBCXX_HAVE_ATOMIC_WAIT.
* include/bits/atomic_timed_wait.h: Likewise.
* include/bits/semaphore_base.h: Likewise.
* include/std/atomic: Likewise.
* include/std/latch: Likewise.
* include/std/semaphore: Likewise.
libstdc++-v3/include/bits/atomic_base.h
libstdc++-v3/include/bits/atomic_timed_wait.h
libstdc++-v3/include/bits/atomic_wait.h
libstdc++-v3/include/bits/semaphore_base.h
libstdc++-v3/include/std/atomic
libstdc++-v3/include/std/latch
libstdc++-v3/include/std/semaphore