summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/atomics/atomics.flag/init03.pass.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Replace non-Standard "atomic_flag f(false);" with Standard ↵Eric Fiselier2016-05-031-25/+0
| | | | | | | | | | | | | | | | | | "atomic_flag f;" Summary: Replace non-Standard "atomic_flag f(false);" with Standard "atomic_flag f;" in clear tests. Although the value of 'f' is unspecified it shouldn't matter because these tests always call `f.test_and_set()` without checking the result, so the initial state shouldn't matter. The test init03.pass.cpp is explicitly testing this non-Standard extension; It has been moved into the `test/libcxx` directory. Reviewers: mclow.lists, STL_MSFT Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19758 llvm-svn: 268355
* [libcxx] Allow use of <atomic> in C++03. Try 3.Eric Fiselier2015-08-191-0/+25
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
OpenPOWER on IntegriCloud