This is the mail archive of the
mailing list for the GCC project.
C++17 is_always_lock_free implementation
- From: JF Bastien <jfb at google dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 11 Mar 2016 09:21:31 -0800
- Subject: C++17 is_always_lock_free implementation
- Authentication-results: sourceware.org; auth=none
Hello GCC / libstdc++ folks,
I implemented C++17's is_always_lock_free  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 .
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++ .
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.