Commit Graph

24 Commits

Author SHA1 Message Date
Howard Hinnant da9ca0b405 Stephan Tolksdorf: fixes the issue in the <atomic> header and adds corresponding tests. I've used macros to fall back to a user-provided default constructor if _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS (though I suspect that there won't be many users defining that macro).
The tests use placement new to check that atomic values get properly zero-initialized. I had to modify the atomic_is_lock_free test, because default initialization of an object of const type 'const A' (aka 'const atomic<int>') requires a user-provided default constructor.

llvm-svn: 180945
2013-05-02 20:18:43 +00:00
Howard Hinnant 114676622f atomic_bool was missing (just a typedef to atomic<bool>).
llvm-svn: 171498
2013-01-04 18:58:50 +00:00
Richard Smith 99f15d6eb7 libc++: Add some missing #includes to atomics tests. libc++ doesn't need these
at the moment, but they allow these tests to be used to test clang against
libstdc++. Add myself to the credits file, as suggested by Howard.

llvm-svn: 155085
2012-04-19 00:50:47 +00:00
David Chisnall 4fa71de024 Fix the remaining atomic tests, all of which were wrong for the case where a
compare-and-exchange failed (it should update the expected value to the current
value, and the tests were checking that it didn't...).

Results of the atomics part of the test suite on FreeBSD with clang trunk and
the atomic.c from compiler-rt (currently kludged into the test, not installed
properly):

****************************************************
Results for /root/libc++/test/atomics:
using clang version 3.1 (trunk 153415)
Target: x86_64-unknown-freebsd10.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -pthread /tmp/atomic.o  
----------------------------------------------------
sections without tests   : 0
sections with failures   : 0
sections without failures: 14
                       +   ----
total number of sections : 14
----------------------------------------------------
number of tests failed   : 0
number of tests passed   : 52
                       +   ----
total number of tests    : 52
****************************************************

Yay!

llvm-svn: 154095
2012-04-05 13:48:16 +00:00
David Chisnall ca917f5342 Fix test cases that were trying to make atomic things that are not trivially copyable.
Now all of the test cases compile.  Some of them even run!

llvm-svn: 154094
2012-04-05 13:23:08 +00:00
Howard Hinnant b5452b3db5 After a long break to wait for the atomic spec to settle, this completes the library part of <atomic>. It currently won't even parse as it depends on the existence of the intrinsics specified at http://libcxx.llvm.org/atomic_design_a.html. Everything has been tested using fake intrinsics which have now been removed. As the intrinsics come online, the ATOMIC_* macros will need to be adjusted to reflect which operations are lock-free. These macros will probably need to be #ifdef'd for each supported platform.
llvm-svn: 121267
2010-12-08 17:20:28 +00:00
Howard Hinnant 0e1cd17d0a atomics ...
llvm-svn: 121202
2010-12-07 23:20:28 +00:00
Howard Hinnant c772a62096 Work on <atomic> continues. The file size is actually sane now...
llvm-svn: 121181
2010-12-07 20:46:14 +00:00
Howard Hinnant 9847abacb1 Getting <atomic> warmed back up. We have a hopefully more stable spec now. And I believe the intrinsic spec at http://libcxx.llvm.org/atomic_design_a.html is still good.
llvm-svn: 121064
2010-12-06 23:10:08 +00:00
Howard Hinnant 4030e72457 Update testsuite strucuture to latest draft
llvm-svn: 120045
2010-11-23 20:26:48 +00:00
Howard Hinnant 46cc61ea7c Update testsuite strucuture to latest draft
llvm-svn: 120043
2010-11-23 20:25:10 +00:00
Howard Hinnant e8ce332127 Update testsuite strucuture to latest draft
llvm-svn: 120040
2010-11-23 20:21:36 +00:00
Howard Hinnant 412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant a7c2f3eac3 [atomics.types.address]
llvm-svn: 117033
2010-10-21 17:44:19 +00:00
Howard Hinnant f9c02e15c4 atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
llvm-svn: 116860
2010-10-19 21:22:10 +00:00
Howard Hinnant d89b01e521 atomic_char
llvm-svn: 116813
2010-10-19 16:51:18 +00:00
Howard Hinnant 2b672e24a5 Still working on the basic design of <atomic>. I'm working towards a system by which the compiler only needs to define the strongest intrinsics it can. Weaker atomics in the library automatically try stronger and stronger variants, picking the weakest compiler intrinsic available. If no compiler intrinsics are available for a given operation, the library locks a mutex and does the job. Better documentation to follow...
llvm-svn: 115538
2010-10-04 18:52:54 +00:00
Howard Hinnant 748a5279b1 [atomics.flag] completed. Initialization is not working on clang and can't be made to work without defaulted default constructors.
llvm-svn: 115207
2010-09-30 21:05:29 +00:00
Howard Hinnant 88efc1c7a5 Contemplating this <atomic> reorganization...
llvm-svn: 115087
2010-09-29 21:20:03 +00:00
Howard Hinnant 7d489d7a73 Didn't mean to commit that one
llvm-svn: 115058
2010-09-29 18:33:45 +00:00
Howard Hinnant 7387390d6e Wrestling with the slowly dawning realization that <atomic> isn't implementable on any compiler at my disposal...
llvm-svn: 115054
2010-09-29 18:13:54 +00:00
Howard Hinnant eb9e9a3710 fixing whitespace
llvm-svn: 114967
2010-09-28 17:19:10 +00:00
Howard Hinnant cfe0b0a1ab [atomics.order]
llvm-svn: 114966
2010-09-28 17:13:38 +00:00
Howard Hinnant cd39d413b4 Getting started on <atomic>
llvm-svn: 114887
2010-09-27 21:17:38 +00:00