]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: fix possible undefined atomic lock-free type aliases in module std
authorZENG Hao <c@cyano.cn>
Sun, 20 Apr 2025 09:02:16 +0000 (17:02 +0800)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 23 Apr 2025 08:49:44 +0000 (09:49 +0100)
When building for 'i386-*' targets, all basic types are 'sometimes lock-free'
and thus std::atomic_signed_lock_free and std::atomic_unsigned_lock_free are
not declared. In the header <atomic>, they are placed in preprocessor
condition __cpp_lib_atomic_lock_free_type_aliases. In module std, they should
be the same.

libstdc++-v3/ChangeLog:

* src/c++23/std.cc.in (atomic_signed_lock_free): Guard with
preprocessor check for __cpp_lib_atomic_lock_free_type_aliases.
(atomic_unsigned_lock_free): Likewise.

libstdc++-v3/src/c++23/std.cc.in

index 5e18ad739083739479eef357cadb5bf3dc1c178e..ea50496b057c9f5e43bbc57abdafc73c147a4c96 100644 (file)
@@ -599,7 +599,9 @@ export namespace std
   using std::atomic_schar;
   using std::atomic_short;
   using std::atomic_signal_fence;
+#ifdef __cpp_lib_atomic_lock_free_type_aliases
   using std::atomic_signed_lock_free;
+#endif
   using std::atomic_size_t;
   using std::atomic_store;
   using std::atomic_store_explicit;
@@ -622,7 +624,9 @@ export namespace std
   using std::atomic_uintptr_t;
   using std::atomic_ullong;
   using std::atomic_ulong;
+#ifdef __cpp_lib_atomic_lock_free_type_aliases
   using std::atomic_unsigned_lock_free;
+#endif
   using std::atomic_ushort;
   using std::atomic_wait;
   using std::atomic_wait_explicit;