integers which remain unused and are subsequently leaked, so the test
fail when run under valgrind. Unless I'm overlooking a subtle reason
why they are needed I think they can be removed, allowing these tests
to pass under valgrind. The attached patch removes the variables. If
there is a reason for them to exist, I can change this to just delete
them at the end of the test.
llvm-svn: 161195
test/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
to accept '(nil)' as a valid representation for NULL so that the test
passes on Linux. The same thing is already done in some other tests,
like in /test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp.
llvm-svn: 161188
section in libc++. This requires a recompiled dylib. Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.
The implementation is not lock free. After considerable thought, I know of no
way to make the implementation lock free. Ideas welcome along that front. But
changing the ABI of shared_ptr is not on the table at this point.
The mutex used to lock these function is encapsulated by std::__sp_mut. The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members. Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex. That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.
I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks. Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait). In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).
The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr. The constant 16 is a ball-park reasonable space/time
tradeoff.
std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function. I had thought we had already done this, but I was mistaken.
All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).
llvm-svn: 160940
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
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