Hello GCC / libstdc++ folks, I implemented C++17's is_always_lock_free [0] in clang / libc++ and am wondering if GCC and libstdc++ are interested in following a similar API as the one I propose in the clang patch [1].
What I propose is: * Extend the __GCC_ATOMIC_##TYPE##_LOCK_FREE macros to FLOAT, DOUBLE, LDOUBLE. This doesn't add corresponding C macros. * Add a __LLVM_LOCK_FREE_IS_SIZE_BASED macro with value 1 if all the lock-free-ness is based purely on the type's size. For LLVM this is currently the case for all ISAs. * Add macros __LLVM_ATOMIC_##BYTES##_BYTES_LOCK_FREE for sizes 1, 2, 4, 8, 16. We could go further, but I don't think any ISA has 32-byte and up lock-free (and the C++ library can just #if defined() on wider types). I then use these in libc++ [2]. It may be worth standardizing equivalent macros in C, but we'll need these built-in macros anyways. I also think C macros aren't as useful as the C++ template-based constexpr magic. Thanks, JF [0]: http://jfbastien.github.io/papers/P0152R1.html [1]: http://reviews.llvm.org/D17950 [2]: http://reviews.llvm.org/D17951