Implement the missing pieces needed to support libstdc++4.7's <atomic>:
__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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154640 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/Builtins.def 4 additions, 4 deletionsinclude/clang/Basic/Builtins.def
- lib/AST/ExprConstant.cpp 26 additions, 26 deletionslib/AST/ExprConstant.cpp
- lib/CodeGen/CGBuiltin.cpp 173 additions, 0 deletionslib/CodeGen/CGBuiltin.cpp
- lib/CodeGen/CGExpr.cpp 6 additions, 4 deletionslib/CodeGen/CGExpr.cpp
- lib/Frontend/InitPreprocessor.cpp 40 additions, 0 deletionslib/Frontend/InitPreprocessor.cpp
- test/CodeGen/atomic-ops.c 51 additions, 5 deletionstest/CodeGen/atomic-ops.c
- test/Sema/atomic-ops.c 76 additions, 8 deletionstest/Sema/atomic-ops.c
Loading
Please register or sign in to comment