llvm-capstone/libcxx
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
..
cmake Fix CMake error whet llvm-config reports a non-existent source directory. 2015-08-12 06:36:19 +00:00
include [libcxx] Allow use of <atomic> in C++03. Try 3. 2015-08-19 17:21:46 +00:00
lib Reapply working parts of CMake cleanup. 2015-07-30 22:30:34 +00:00
src [libcxx] Allow use of <atomic> in C++03. Try 3. 2015-08-19 17:21:46 +00:00
test [libcxx] Allow use of <atomic> in C++03. Try 3. 2015-08-19 17:21:46 +00:00
utils cleanup comments in sym_check 2015-03-27 06:04:37 +00:00
www Update some links so that they don't point at the (private) WG21 Wiki 2015-08-05 14:36:42 +00:00
.arcconfig
.gitignore
CMakeLists.txt Update references to lists.llvm.org 2015-08-05 03:59:14 +00:00
CREDITS.TXT Add self to CREDITS.txt 2015-02-26 00:48:22 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 20:13:11 +00:00
Makefile
TODO.TXT Cleanup result_of tests and fix issues with the C++03 result_of. 2015-06-13 08:25:24 +00:00