Go to file
Eric Fiselier 749adeba3d [libcxx] Allow use of <atomic> in C++03. Try 3.
Summary:
After putting this question up on cfe-dev I have decided that it would be best to allow the use of `<atomic>` in C++03. Although static initialization is a concern the syntax required to get it is C++11 only. Meaning that C++11 constant static initialization cannot silently break in C++03, it will always cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` remain defined in C++03 even though they cannot be used because C++03 usages will cause better error messages.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP`      - Defined on clang versions which provide the C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include `<atomic>`.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually exclusive, only one should be defined. If neither is defined then `<atomic>` is not implemented and including `<atomic>` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11555

llvm-svn: 245463
2015-08-19 17:21:46 +00:00
clang Add REQUIRES: x86-registered-target to test since it's required. 2015-08-19 17:18:32 +00:00
clang-tools-extra [clang-tidy] Fix LoopConvertCheck bug. 2015-08-19 16:54:51 +00:00
compiler-rt [cmake darwin] Use a STATUS message type. Explain where the arches came from. 2015-08-19 16:23:19 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Remove files accidentally not removed in r244310 2015-08-13 23:43:12 +00:00
libcxx [libcxx] Allow use of <atomic> in C++03. Try 3. 2015-08-19 17:21:46 +00:00
libcxxabi [libcxxabi] Add "install-libcxxabi" target. 2015-08-19 17:17:21 +00:00
libunwind Enable zero-cost exceptions on non-Apple arm64 platforms 2015-08-13 14:21:03 +00:00
lld COFF: Use ErrorOr::operator* instead of ErrorOr::get. 2015-08-18 09:18:15 +00:00
lldb XTIMEOUT TestExitDuringStep for Darwin. 2015-08-19 17:13:02 +00:00
llgo Update to new lists.llvm.org 2015-08-05 04:03:05 +00:00
llvm Revert "[AArch64] Simplify/refactor code to ease code review. NFC." 2015-08-19 16:29:53 +00:00
openmp D11990: Lock-free start of serialized parallel regions 2015-08-18 10:08:27 +00:00
polly Generate alias metadata even in OpenMP mode 2015-08-19 16:04:35 +00:00