summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/atomics
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Add void cast to result of compare_exchange_weak to suppress ↵Billy Robert O'Neal III2019-07-011-4/+4
| | | | | | [[nodiscard]]. llvm-svn: 364732
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3142-0/+61
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Reinstate libc++ patches now that the lldb formatter has been updated.Davide Italiano2019-03-053-25/+49
| | | | | | | | "[libc++] Fix <atomic> failures on GCC" "[libc++] Change memory_order to an enum class" "[libc++] decoupling Freestanding atomic<T> from libatomic.a" llvm-svn: 355427
* [libcxx] Revert set of atomic patches that broke lldb.Davide Italiano2019-03-053-49/+25
| | | | | | | | | | | Revert "[libc++] Fix <atomic> failures on GCC" Revert "[libc++] Change memory_order to an enum class" Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a" The lldb formatter nededs to be updated. Shafik and Louis will coordinate to do so. llvm-svn: 355417
* [libc++] Fix <atomic> failures on GCCLouis Dionne2019-03-051-17/+17
| | | | | | | | | | | | | | | | Summary: In https://reviews.llvm.org/D58201, we turned memory_order into an enum class in C++20 mode. However, we were not casting memory_order to its underlying type correctly for the GCC implementation, which broke the build bots. I also fixed a test that was failing in C++17 mode on GCC 5. Reviewers: EricWF, jfb, mclow.lists Subscribers: zoecarver Differential Revision: https://reviews.llvm.org/D58966 llvm-svn: 355409
* [libc++] Change memory_order to an enum classLouis Dionne2019-03-052-8/+32
| | | | | | | | | This implements P0439R0. Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58201 llvm-svn: 355403
* Support tests in freestandingJF Bastien2019-02-0456-56/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1957-228/+171
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [NFC] Always lock free test: add indirectionJF Bastien2019-01-091-1/+3
| | | | | | | | I have a big patch coming up, and this indirection is required to avoid hitting the following after my big change: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] llvm-svn: 350772
* [libcxx] [test] Improve MSVC portability.Stephan T. Lavavej2018-01-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. llvm-svn: 322144
* [libcxx] [test] Untabify, NFC.Stephan T. Lavavej2017-07-292-24/+24
| | | | llvm-svn: 309464
* Work around PR31864 - ATOMIC_LLONG_LOCK_FREE is incorrect in 32 bit buildsEric Fiselier2017-07-101-2/+35
| | | | llvm-svn: 307517
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-231-1/+1
| | | | llvm-svn: 287829
* Remove usages of _ALIGNAS_TYPEEric Fiselier2016-10-124-4/+12
| | | | llvm-svn: 283999
* libc++: name anonymous structsJF Bastien2016-07-121-9/+9
| | | | | | As discussed in http://reviews.llvm.org/D22073 llvm-svn: 275210
* Implement LWG#2441: 'Exact-width atomic typedefs should be provided'Marshall Clow2016-06-303-0/+51
| | | | llvm-svn: 274236
* Work around MSVC bug in atomics.types.generic/address.pass.cpp test. Patch ↵Eric Fiselier2016-06-261-1/+1
| | | | | | from STL@microsoft.com llvm-svn: 273822
* Move more _LIBCPP_VERSION tests to test/libcxx.Eric Fiselier2016-06-221-22/+0
| | | | llvm-svn: 273365
* Fix various undefined behavior found by UBSan.Eric Fiselier2016-06-193-16/+32
| | | | | | | | | | | | | | | | | | | | | | | * Fix non-null violation in strstream.cpp Overflow was calling memcpy with a null parameter and a size of 0. * Fix std/atomics/atomics.flag/ tests: a.test_and_set() was reading from an uninitialized atomic, but wasn't using the value. The tests now clear the flag before performing the first test_and_set. This allows UBSAN to test that clear doesn't read an invalid value. * Fix std/experimental/algorithms/alg.random.sample/sample.pass.cpp The tests were dereferencing a past-the-end pointer to an array so that they could do pointer arithmetic with it. Instead of dereference the iterator I changed the tests to use the special 'base()' test iterator method. * Add -fno-sanitize=float-divide-by-zero to suppress division by zero UBSAN diagnostics. The tests that cause float division by zero are explicitly aware that they are doing that. Since this is well defined for IEEE floats suppress the warnings for now. llvm-svn: 273107
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-0128-41/+41
| | | | llvm-svn: 271435
* [libcxx] [test] Replace non-Standard "atomic_flag f(false);" with Standard ↵Eric Fiselier2016-05-034-41/+16
| | | | | | | | | | | | | | | | | | "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
* Implement is_always_lock_freeJF Bastien2016-03-251-0/+101
| | | | | | | | | | | | | | | | | | Summary: This was voted into C++17 at the Jacksonville meeting. The final P0152R1 paper will be in the upcoming post-Jacksonville mailing, and is also available here: http://jfbastien.github.io/papers/P0152R1.html Reviewers: mclow.lists, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17951 llvm-svn: 264413
* Missing ATOMIC_*_LOCK_FREE testsJF Bastien2016-03-181-0/+8
| | | | | | Forked from D17951, these tests should have been there but weren't. llvm-svn: 263798
* Add missing license headersEric Fiselier2016-01-191-0/+9
| | | | llvm-svn: 258196
* Fix various GCC mis-configurations for newer versions.Eric Fiselier2015-12-151-3/+3
| | | | | | | | | | | | This patch goes through and enables C++11 and C++14 features for newer GCC's. The main changes are: 1. Turn on variable templates. (Uses __cpp_variable_templates) 2. Assert atomic<Tp> is trivially copyable (Uses _GNUC_VER >= 501). 3. Turn on trailing return support for GCC. (Uses _GNUC_VER >= 404) 4. XFAIL void_t test for GCC 5.1 and 5.2. Fixed in GCC 6. llvm-svn: 255585
* Misc drive-by cleanups. NFCJonathan Roelofs2015-08-242-41/+0
| | | | | | http://reviews.llvm.org/D12294 llvm-svn: 245876
* [libcxx] Allow use of <atomic> in C++03. Try 3.Eric Fiselier2015-08-1930-675/+268
| | | | | | | | | | | | | | | | | | | | | | | 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
* Mark this test as XFAIL with older compilers, since they hit PR18097Justin Bogner2015-07-221-0/+4
| | | | llvm-svn: 242967
* Fix unused variable warnings in atomic testsEric Fiselier2015-07-185-5/+7
| | | | llvm-svn: 242625
* Fix PR24114 - std::atomic for non-Clang is not a literal typeEric Fiselier2015-07-141-0/+56
| | | | | | Add _LIBCPP_CONSTEXPR to the implementation of __gcc_atomic_t. llvm-svn: 242172
* Fix uninitialized values and bad enum conversions found by UBSAN.Eric Fiselier2015-05-193-16/+16
| | | | llvm-svn: 237738
* Move a test to the new tests directory.Dan Albert2015-01-061-0/+43
| | | | | | | I had written the patch that added this test before the tests were moved into tests/std, so the test ended up in the wrong directory. llvm-svn: 225300
* Move test into test/std subdirectory.Eric Fiselier2014-12-2056-0/+3488
llvm-svn: 224658
OpenPOWER on IntegriCloud