[libcxx-commits] [PATCH] D114109: [libc++] Enable <atomic> when threads are disabled

Brian Cain via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 26 11:58:31 PST 2022


androm3da added a comment.

Questions about platforms w/limited 'atomic' support.



================
Comment at: libcxx/include/atomic:2697
 typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free;
 typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
 
----------------
After this commit landed downstream we encountered a failure building for an arm baremetal target that defines the __CLANG_ATOMIC_*_LOCK_FREE vals to '1' ("sometimes lock free").

This results in the `atomic_{,un}signed_lock_free` typedefs here referencing an undefined `_libcpp_{,un}signed_lock_free`.

I suspect that before this commit `_LIBCPP_HAS_NO_ATOMIC_HEADER` was false.

I think maybe we could consider an `#error:` in the else case above that might make it clearer?  

I could use some advice as to how to handle this -- does it make sense to have the atomic header in the case where these types are only designated 'sometimes lock free'?  If not I think the fix would be to change the conditional for _LIBCPP_HAS_NO_ATOMIC_HEADER to consider these?  Otherwise, if it does make sense to have an atomic header, can I just suppress these typedefs?  That does seem to address the build failure so far.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114109/new/

https://reviews.llvm.org/D114109



More information about the libcxx-commits mailing list