Skip to content
  • Richard Smith's avatar
    Implement the missing pieces needed to support libstdc++4.7's <atomic>: · 01ba47d7
    Richard Smith authored
    __atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_*
    predefined macros.
    
    Implement library fallback for __atomic_is_lock_free and
    __c11_atomic_is_lock_free, and implement __atomic_always_lock_free.
    
    Contrary to their documentation, GCC's __atomic_fetch_add family don't
    multiply the operand by sizeof(T) when operating on a pointer type.
    libstdc++ relies on this quirk. Remove this handling for all but the
    __c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins.
    
    Contrary to their documentation, __atomic_test_and_set and __atomic_clear
    take a first argument of type 'volatile void *', not 'void *' or 'bool *',
    and __atomic_is_lock_free and __atomic_always_lock_free have an argument
    of type 'const volatile void *', not 'void *'.
    
    With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite,
    except for a couple of libstdc++ bugs and some cases where libc++'s test
    suite tests for properties which implementations have latitude to vary.
    
    llvm-svn: 154640
    01ba47d7
Loading