summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the return type of emplace_[front|back] back to void when building ↵Marshall Clow2017-01-247-7/+144
| | | | | | with C++14 or before. Resolves PR31680. llvm-svn: 292990
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-211-0/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Exactly what the title says. This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it. See http://wg21.link/P0513R0 for more info. If there are no comments in the next couple of days I'll commit this Reviewers: mclow.lists, K-ballo, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28938 llvm-svn: 292684
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-184-5/+5
| | | | | | No functional change, no code review. llvm-svn: 292434
* [libcxx] [test] Fix MSVC warnings C4127 and C6326 about constants.Stephan T. Lavavej2017-01-181-2/+2
| | | | | | | | | | | | | | | | | | MSVC has compiler warnings C4127 "conditional expression is constant" (enabled by /W4) and C6326 "Potential comparison of a constant with another constant" (enabled by /analyze). They're potentially useful, although they're slightly annoying to library devs who know what they're doing. In the latest version of the compiler, C4127 is suppressed when the compiler sees simple tests like "if (name_of_thing)", so extracting comparison expressions into named constants is a workaround. At the same time, using std::integral_constant avoids C6326, which doesn't look at template arguments. test/std/containers/sequences/vector.bool/emplace.pass.cpp Replace 1 == 1 with true, which is the same as far as the library is concerned. Fixes D28837. llvm-svn: 292432
* Implement the missing constexpr stuff in <array>. Fixes PR#31645.Marshall Clow2017-01-163-3/+53
| | | | llvm-svn: 292091
* [libcxx] [test] Strip trailing whitespace. NFC, no code review.Stephan T. Lavavej2017-01-071-2/+2
| | | | llvm-svn: 291322
* Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to ↵Marshall Clow2017-01-042-0/+47
| | | | | | reverse_iterator, move_iterator, array and Range Access' for C++17 llvm-svn: 290976
* Fix debug mode for vector/list and cleanup testsEric Fiselier2016-12-2814-502/+16
| | | | llvm-svn: 290657
* Fix yet another missed -Wunused warning. Hopefully this is the last oneEric Fiselier2016-12-241-7/+8
| | | | llvm-svn: 290476
* fix warnings only produced by apple-clangEric Fiselier2016-12-244-9/+17
| | | | llvm-svn: 290474
* Fix PR31378 - std::list::remove should not require a default constructible ↵Eric Fiselier2016-12-141-33/+47
| | | | | | | | | | | | allocator. In list::remove we collect the nodes we're removing in a seperate list instance. However we construct this list using the default constructor which default constructs the allocator. However allocators are not required to be default constructible. This patch fixes the construction of the second list. llvm-svn: 289735
* [libcxx] [test] Fix MSVC x64 truncation warnings with 32-bit allocator ↵Stephan T. Lavavej2016-12-141-1/+1
| | | | | | | | | | | | | | | | size_type/difference_type. test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_container_alloc.pass.cpp test/std/containers/container.adaptors/stack/stack.cons.alloc/ctor_container_alloc.pass.cpp Iterate with C::size_type because that's what operator[] takes. test/std/containers/sequences/vector/contiguous.pass.cpp test/std/strings/basic.string/string.require/contiguous.pass.cpp Add static_cast<typename C::difference_type> because that's what the iterator's operator+ takes. Fixes D27777. llvm-svn: 289734
* [libcxx] [test] Fix an improper assumption about Null Forward Iterators.Stephan T. Lavavej2016-12-121-4/+0
| | | | | | | | Value-initialized iterators still can't be compared to those with parents. Fixes D26626. llvm-svn: 289462
* Enable the -Wsign-compare warning to better support MSVCEric Fiselier2016-12-114-16/+25
| | | | llvm-svn: 289363
* Fix undefined behavior in container swap tests.Eric Fiselier2016-12-115-47/+44
| | | | | | | | | | | | These swap tests were swapping non-POCS non-equal allocators which is undefined behavior. This patch changes the tests to use allocators which compare equal. In order to test that the allocators were not swapped I added an "id" field to test_allocator which does not participate in equality but does propagate across copies/swaps. This patch is based off of D26623 which was submitted by STL. llvm-svn: 289358
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-082-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 6/7. test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp (Affects 64-bit architectures.) Include <cstddef> so we can take/return std::ptrdiff_t (instead of int) in random_shuffle()'s RNG. (C++14 D.12 [depr.alg.random.shuffle]/2 says that difference_type is used, and we're shuffling a plain array.) test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp (Affects 64-bit architectures.) Include <iterator> because we're already using iterator_traits. Then, store the result of subtracting two RanIts as difference_type instead of long (which truncates on LLP64 architectures like MSVC x64). test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_flist.pass.cpp test/std/containers/sequences/forwardlist/forwardlist.ops/splice_after_one.pass.cpp (Affects 64-bit architectures.) Include <cstddef> so we can store the result of subtracting two pointers as std::ptrdiff_t (instead of int). test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore_0xff.pass.cpp (Affects 32-bit architectures.) Sometimes, size_t is too small. That's the case here, where tellg() returns pos_type (N4606 27.7.2.3 [istream.unformatted]/39). Implementations can have 64-bit pos_type (to handle large files) even when they have 32-bit size_t. Fixes D27543. llvm-svn: 289110
* [libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' ↵Stephan T. Lavavej2016-12-064-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | to 'int' [or 'unsigned int'], possible loss of data", part 3/4. test/std/containers/sequences/vector.bool/copy.pass.cpp test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp test/std/containers/sequences/vector/vector.cons/copy.pass.cpp test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp Change "unsigned s = x.size();" to "typename C::size_type s = x.size();" because that's what it returns. test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp Include <cstddef>, then change "unsigned n = T::length(s);" to "std::size_t n = T::length(s);" because that's what char_traits returns. test/std/strings/basic.string/string.cons/substr.pass.cpp Change unsigned to typename S::size_type because that's what str.size() returns. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp This was needlessly truncating std::size_t to unsigned. It's being used to compare and initialize std::size_t. llvm-svn: 288753
* [libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | part 12/12. Various changes: test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int). static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small). test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp This is comparing an int remote-element to size_t. The values in question are small and non-negative, so either type is fine. I think that converting int to size_t is marginally better here than the reverse. test/std/containers/sequences/deque/deque.cons/size.pass.cpp DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>. test/std/strings/basic.string/string.access/index.pass.cpp We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t). "v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool. llvm-svn: 288749
* [libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-067-17/+17
| | | | | | | | | | | | part 11/12. Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances. test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp This one's a little special, but not really. "*i == n" is comparing MoveOnly to n. MoveOnly is implicitly constructible from int, so int is the correct type to use here. llvm-svn: 288748
* [libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-061-8/+8
| | | | | | | | | | | | part 10/12. Add static_cast<int>. In these cases, the values are guaranteed to be small-ish, and they're being compared to int elements. test/std/containers/sequences/deque/deque.capacity/access.pass.cpp Use int instead of unsigned to iterate from 0 to 10. llvm-svn: 288747
* [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-067-15/+19
| | | | | | | | | | part 9/12. Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. llvm-svn: 288746
* [libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-0624-35/+47
| | | | | | | | | | | | | | | | | | | | | part 8/12. Add static_cast<std::size_t> when comparing distance() to size(). These replacements were performed programmatically with regex_replace(): const vector<pair<regex, string>> reg_fmt = { { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"), "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" }, { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(distance($1)) == $2.size())" }, { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" }, }; Also, include <cstddef> when it wasn't already being included. llvm-svn: 288745
* Protect sequences test under libcpp-no-exceptionsRoger Ferrer Ibanez2016-12-012-7/+11
| | | | | | | | Replace throw with TEST_THROW and protect tests that do throw. Also add missing assert(false). Differential Revision: https://reviews.llvm.org/D27252 llvm-svn: 288383
* Protect std::array tests under noexceptionsRoger Ferrer Ibanez2016-11-291-3/+14
| | | | | | | | Skip tests that expect exceptions be thrown. Also add missing asserts. Differential Revision: https://reviews.llvm.org/D27095 llvm-svn: 288165
* [libcxx] [test] D27027: Strip trailing whitespace.Stephan T. Lavavej2016-11-232-2/+2
| | | | llvm-svn: 287829
* [libcxx] [test] D27016: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-236-19/+25
| | | | | | | | | | part 4/12. Change "int j;" indices to "std::size_t j;". Also, include <cstddef> when it wasn't already being included. llvm-svn: 287824
* [libcxx] [test] D27014: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-2314-51/+63
| | | | | | | | | | part 2/12. Add static_cast<std::size_t> when comparing int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287822
* [libcxx] [test] D27013: Fix MSVC warning C4018 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-11-233-4/+7
| | | | | | | | | | part 1/12. Change loop indices from int to std::size_t. Also, include <cstddef> when it wasn't already being included. llvm-svn: 287820
* [libcxx] Fix max_size() across all containersEric Fiselier2016-11-234-12/+167
| | | | | | | | | | | | Summary: The `max_size()` method of containers should respect both the allocator's reported `max_size` and the range of the `difference_type`. This patch makes all containers choose the smallest of those two values. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26885 llvm-svn: 287729
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-049-12/+22
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 llvm-svn: 286007
* Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: ↵Roger Ferrer Ibanez2016-10-315-5/+5
| | | | | | | | | | | | | libcpp-no-exceptions" tests that only check exceptions and nothing else This is a follow up of D24562. These tests do not check anything but exceptions, so it makes sense to mark them as UNSUPPORTED under a library built without exceptions. Differential Revision: https://reviews.llvm.org/D26075 llvm-svn: 285550
* [PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many ↵Stephan T. Lavavej2016-10-2712-16/+31
| | | | | | elements are allocated llvm-svn: 285346
* [libc++] Fix stack_allocatorEric Fiselier2016-10-0826-61/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: To quote STL the problems with stack allocator are" >"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements]. > First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.) > Second, it lacks templated equality/inequality. > Third, it completely ignores alignment. > Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though." This patch attempts to address all of those issues. First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument. Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding between types that have different sizes. Third, I added copy and rebinding constructors and assignment operators. And finally I fixed the allocation logic to always return properly aligned storage. Reviewers: mclow.lists, howard.hinnant, STL_MSFT Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25154 llvm-svn: 283631
* Update -verify test to use new static assert messageEric Fiselier2016-09-251-5/+0
| | | | llvm-svn: 282352
* [libc++] Remove various C++03 feature test macrosEric Fiselier2016-09-253-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`. This patch removes the __config macros: * _LIBCPP_HAS_NO_TRAILING_RETURN * _LIBCPP_HAS_NO_TEMPLATE_ALIASES * _LIBCPP_HAS_NO_ADVANCED_SFINAE * _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS * _LIBCPP_HAS_NO_STATIC_ASSERT As a drive I also changed our C++03 static_assert to use _Static_assert if available. I plan to commit this without review if nobody voices an objection. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24895 llvm-svn: 282347
* Support allocators with explicit conversion constructors. Fixes bug #29000Marshall Clow2016-08-175-0/+36
| | | | llvm-svn: 278904
* Fix compile error due to mismatched iterator types. Patch from STL@microsoft.comEric Fiselier2016-08-031-1/+1
| | | | llvm-svn: 277574
* Make dtor_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.comEric Fiselier2016-07-255-5/+10
| | | | llvm-svn: 276595
* Make move_assign_noexcept.pass.cpp tests more portable. Patch from ↵Eric Fiselier2016-07-254-10/+14
| | | | | | STL@microsoft.com llvm-svn: 276591
* Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com.Eric Fiselier2016-07-255-55/+35
| | | | | | See D21820 for more information (https://reviews.llvm.org/D21820). llvm-svn: 276590
* Fix a non-standard allocator in vector tests. Patch from STL@microsoft.comEric Fiselier2016-07-241-0/+3
| | | | llvm-svn: 276588
* Make move_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.comEric Fiselier2016-07-244-13/+17
| | | | llvm-svn: 276581
* Implement P0084r2. Changing emplace return types.Eric Fiselier2016-07-217-68/+82
| | | | llvm-svn: 276230
* Always use the allocator to construct/destruct elements of a deque/vector. ↵Marshall Clow2016-07-112-0/+21
| | | | | | Fixes PR#28412. Thanks to Jonathan Wakely for the report. llvm-svn: 275105
* Implement LWG#2596: 'vector::data() should use addressof'Marshall Clow2016-06-302-3/+41
| | | | llvm-svn: 274241
* Make std::array typedef tests more portable.Eric Fiselier2016-06-301-4/+25
| | | | llvm-svn: 274210
* Fix unary_function inheritance assumption. Patch from STL@microsoft.comEric Fiselier2016-06-301-2/+2
| | | | llvm-svn: 274205
* Make default_noexcept.pass.cpp container tests more portable. Patch from ↵Eric Fiselier2016-06-264-8/+12
| | | | | | STL@microsoft.com llvm-svn: 273823
* Finish converting list _LIBCPP_DEBUG tests.Eric Fiselier2016-06-225-81/+7
| | | | llvm-svn: 273394
* Cleanup _LIBCPP_DEBUG tests in std::list. More to come.Eric Fiselier2016-06-2211-515/+7
| | | | llvm-svn: 273393
OpenPOWER on IntegriCloud