[committed] libstdc++: Disable atomic wait for freestanding [PR105021]

Jonathan Wakely jwakely@redhat.com
Wed Mar 23 10:12:26 GMT 2022

Tested powerpc64le-linux, pushed to trunk.

Backport to gcc-11 needed too.

-- >8 --

We use either condition variables or futexes to implement atomic waits,
so we can't do it in freestanding. This is non-conforming, so should be
revisited later, probably by making freestanding atomic waiting
operations spin without ever blocking.

Reviewed-by: Thomas Rodgers <trodgers@redhat.com>


	PR libstdc++/105021
	* include/bits/atomic_base.h [!_GLIBCXX_HOSTED]: Do not include
	<bits/atomic_wait.h> for freestanding.
 libstdc++-v3/include/bits/atomic_base.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h
index d86766cf39b..2cad8486c69 100644
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -37,7 +37,7 @@
 #include <bits/atomic_lockfree_defines.h>
 #include <bits/move.h>
-#if __cplusplus > 201703L
+#if __cplusplus > 201703L && _GLIBCXX_HOSTED
 #include <bits/atomic_wait.h>

More information about the Libstdc++ mailing list