Commit Graph

636 Commits

Author SHA1 Message Date
Marshall Clow
c5eb69601b Add test cases for creating atomic types for trivially copyable types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214406 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 15:20:48 +00:00
Marshall Clow
15269a8796 Fix numeric_limits<XXX>::is_modulo for signed arithmetic types. We were reporting true, for all arithmetic types, which is incorrect. Fix the tests which were wrong, too. This fixes PR#20158.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214371 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 01:18:05 +00:00
Dan Albert
1757386944 Base regex code on char_class_type.
__get_classname() and __bracket_expression were assuming that
char_class_type was ctype_base::mask rather than using
regex_traits<_CharT>::char_class_type.

This change allows char_class_type to be defined to something other than
ctype_base::mask so that the implementation will still work for
platforms with an 8-bit ctype mask (such as Android and OpenBSD).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214201 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29 19:23:39 +00:00
Eric Fiselier
3ee7233c80 [libcxx] expose experimental::erased_type for all standard versions.
Summary: The polymorphic allocator implementation would greatly benefit by defining virtual functions in the dynlib instead of inline. In order to do that some types are going to have to be available outside of c++1y. This is the first step.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4554

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213889 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 19:17:38 +00:00
Eric Fiselier
9020c08989 D4451: Fix copy/move issues casude by __tuple_leafs's converting constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213888 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 18:48:34 +00:00
Eric Fiselier
08b8506930 test commit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213887 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 18:41:56 +00:00
David Majnemer
cb8757aca7 Fix std::make_heap's worst case time complexity
std::make_heap is currently implemented by iteratively applying a
siftup-type algorithm.  Since sift-up is O(ln n), this gives
std::make_heap a worst case time complexity of O(n ln n).

The C++ standard mandates that std::make_heap make no more than O(3n)
comparisons, this makes our std::make_heap out of spec.

Fix this by introducing an implementation of __sift_down and switch
std::make_heap to create the heap using it.
This gives std::make_heap linear time complexity in the worst case.

This fixes PR20161.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213615 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 06:07:09 +00:00
Marshall Clow
d5549ccac1 Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213269 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 15:32:20 +00:00
Eric Fiselier
b1a40264dc [libcxx] Add <experimental/utility> header for LFTS.
Summary:
This patch adds the `<experimental/utility>` header as specified in the latest draft of the library fundamentals TS.

`<experimental/utility>` only contains `class erased_type`. 

This patch also updates the documentation to list the `erased_type` class as "initial implementation complete".

Test Plan:
Three test cases where added:

1. Test that `_LIBCPP_VERSION` is defined.
2. Test that `<utility>` has been included.
3. Test that `erased_type` is in the correct namespace and is constexpr default constructible.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4510

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213226 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 05:31:31 +00:00
Eric Fiselier
9b2b60cab8 Test commit: Reverting whitespace changes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213223 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 05:10:03 +00:00
Eric Fiselier
ad250c17df Test commit: whitespace change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213222 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 05:06:09 +00:00
Marshall Clow
2b44e3dd49 Correctly implement LWG 2049; std::is_destructible.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 15:51:50 +00:00
Marshall Clow
7778249d2d Fix warning in test - missing exception specifier for overload of operator new
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212723 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 15:19:50 +00:00
Marshall Clow
bbeca21f26 Add a reset method to the counting predicates in the test suite
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212651 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 21:04:22 +00:00
Marshall Clow
484728789e string_view enhancements. Move to the correct namespace. Better constexpr support (thanks to Richard for the suggestions). Update the tests to match this. Add <experimental/__config for experimental macros/etc to live.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212569 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08 22:38:11 +00:00
Marshall Clow
51349536aa Fix some failing tests for the standard containers. The tests were failing in 32-bit mode because they assumed that std::size_type and make_unsigned<ptrdiff_t>::type were always the same type. No change to libc++, just the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212538 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08 15:19:40 +00:00
Marshall Clow
3a61b30f3a Minor cleanup for string_view; mostly from suggestions by Richard Smith. Also, make the tests pass under c++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212185 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-02 15:45:57 +00:00
Marshall Clow
2f9e714071 Fix libc++ bug #20039: 'Constructing std::function from empty compatible std::function results in half-empty state' Thanks to Agustin Berge for the report, and for his and Eric Fiselier's work on a fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212070 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 21:27:51 +00:00
Marshall Clow
c8c7abae66 Add checking for the complexity guarantees in the standard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 05:04:20 +00:00
Marshall Clow
164b297099 Implement string_view from the library fundamentals TS (n4023). Also works in C++11 and 03, with reduced functionality (mostly in the area of constexpr)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210659 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-11 16:44:55 +00:00
Marshall Clow
675dd5cc4f Mark assign to be constepr only in c++14; can't have constexpr fns that return void in C++11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210562 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 18:52:57 +00:00
Marshall Clow
c1345e3262 A bunch of the char.traits tests were using unicode literals. #ifdef those bits out on c++03, since it doesn't support u"" and U "" style strings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210560 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 18:46:59 +00:00
Marshall Clow
281918b6aa Testing infastructure: A template for char_traits where all the functions are constexpr, and a comparison predicate which counts how many times it's been called.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210381 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-06 22:33:40 +00:00
David Majnemer
0707b67ac3 Handle partial nanosleeps in this_thread::sleep_for
Signals may result in nanosleep returning with only some of the
requested sleeping performed.

Utilize nanosleep's "time-remaining" out parameter to continue sleeping
when this occurs.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210210 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-04 19:43:20 +00:00
Nico Weber
981b01d9d0 Make meta.trans.other/aligned_storage.pass.cpp pass on arm.
The maximum alignment on arm is 8, not 16 like on x86. Use alignof(max_align_t)
to make the test work in both cases.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210195 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-04 16:25:58 +00:00
David Majnemer
4d9f97b40b [libc++] Don't return uninitialized data from random_device::operator()
Make sure we appropriately retry calls to read if the return result is
less than what we asked for.

Additionally, check and handle IO errors: EINTR results in the read
operation getting restarted; other errors turn into exceptions.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210061 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03 02:40:39 +00:00
David Majnemer
8db32cc2ac [libc++] random_device fails if open returns zero
random_device::random_device(const string&) wrongly assumes that open
can only validly return a file descriptor greater than zero.

This results in random_device believing that it didn't successfully open
the device causing it to throw in it's constructor, this ends up leaking
a file descriptor.

The fix is simple, don't error on file descriptors which are zero.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210060 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-03 02:21:37 +00:00
Nico Weber
4074d6ea30 Remove unused code in a libc++ test.
Other tests in this directory use this type, so it's probably copypasta from
there.

(test_buf only forwards to the superclass in all tests where it's used though,
so I wonder if it can be replaced with just using filebuf / wfilebuf
everywhere?)


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210019 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-02 12:00:08 +00:00
Justin Bogner
e39915bdc5 Fix XFAIL condition from r208840
The XFAILs in r208840 were too general. They were meant to only apply
to testing when use_system_lib was set.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209972 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-31 07:59:03 +00:00
Nico Weber
d32add4a48 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209819 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 14:58:38 +00:00
David Majnemer
fcafd80ace Linux: Correctly identify valid error codes
[syserr.errcat.objects]p4 specifies that
system_category().default_error_condition(ev) map to
error_condition(posv, generic_category()) if ev could map to a POSIX
errno.

Linux reserves up to and including 4095 for errno values, use this as a
bound.

This fixes syserr.errcat.objects/system_category.pass.cpp on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209795 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 05:02:22 +00:00
Marshall Clow
4f3368e269 Fix a problem exposed by r208825, which caused bind (and other bits of libc++) to stop working. And tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209785 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 01:10:28 +00:00
Marshall Clow
52a708fbca Fix bug 19840, where some tests were not testing what we wanted. Thanks to Eric for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209520 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-23 15:30:23 +00:00
Marshall Clow
6b7e6921e2 Fix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 16:29:50 +00:00
Marshall Clow
117563c516 Fix bug 19740; round-tripping a pointer through a stream doesn't work
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209305 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 16:02:20 +00:00
Alp Toker
08f8ac6951 Fix typo 'fourty' in tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208870 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 11:33:29 +00:00
Alp Toker
ec34c48976 Fix typos
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208869 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 11:27:39 +00:00
Justin Bogner
5fda8338b2 Work around ABI differences due to LWG 2056 in tests
When testing against the system library, there is a relatively minor
ABI breakage that the std::future_errc values have been changed to
avoid using zero. Update the tests that rely on the values being
consistent.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208840 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 01:57:42 +00:00
Justin Bogner
bdfc0ad2ea Remove XFAIL from a number of tests that aren't expected to fail
These tests haven't been failing on darwin11 or 12 since r189610 when
pr17027 was fixed, but they've been keeping the libc++ bot red by
XPASSing since then.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208831 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 00:55:44 +00:00
Marshall Clow
1f50f2d64b Add Address Sanitizer support to std::vector
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208319 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-08 14:14:06 +00:00
Marshall Clow
6b5be703db Fix PR 19663. Some calls to find(vector<bool>) were returning iterators that were subtly invalid (didn't compare equal). Thanks to Erik Verbruggen for the report (and diagnosis)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208096 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-06 15:33:23 +00:00
Marshall Clow
5f64a2b3c3 Fix bug #18350. Add tests for tuples of all the smart pointers (except auto_ptr)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@207307 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-26 05:19:48 +00:00
Marshall Clow
34b571bd88 Added some tests for equal elements in min_element and max_element. Bug #19547 was invalid, but we weren't testing that case
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@207232 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25 15:50:54 +00:00
Marshall Clow
398c9d882b Default the copy and move constructors for __tuple_leaf. This fixes bugs 18853 and 19118. Add a test case for that.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206829 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 23:48:09 +00:00
Marshall Clow
88dd258984 Add more tests for std::ws as pointed out by bug #19497
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206770 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21 18:12:09 +00:00
Marshall Clow
a178c13419 Bug #19473. If you pass an allocator to std::function, we should use that allocator, not construct one from scratch. Add a test to make sure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206623 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 17:23:36 +00:00
Marshall Clow
f1d10875d7 Fixed a test that was attempting to use rvalue-references w/o checking to see if they were supported in the language. This resulted in a warning when testing using C++03.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@206482 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 18:11:38 +00:00
Marshall Clow
f1264e7c9e Fix PR19819
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@205709 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-07 13:32:26 +00:00
Stephan Tolksdorf
8a71d23633 [libc++] Teach is_integral, is_[un]signed and make_[un]signed about __[u]int128_t
This commit also adds tests for std::numeric_limits<__[u]int128_t>.

Reviewed in http://llvm-reviews.chandlerc.com/D2917

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204849 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 19:45:52 +00:00
Marshall Clow
f4c0c708a3 Add tests that should fail when lock() throws. THis is part of LWG issue #2135. No library changes here.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204777 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-26 02:11:47 +00:00