summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/containers/sequences/array
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Include missing headers. (NFC)Stephan T. Lavavej2019-12-131-0/+4
| | | | | | | | libcxx/test/std/containers/sequences/array/at.pass.cpp Need to include <stdexcept> for std::out_of_range. libcxx/test/std/localization/locale.categories/category.time/* Need to include <ios> for std::ios.
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-221-1/+1
| | | | (Testing git commit access.)
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-318-0/+12
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. ↵Marshall Clow2019-03-191-8/+16
| | | | | | These are just rebranded 'operator[]', and should be noexcept like it is. llvm-svn: 356435
* Update a deque test with more assertions. NFCMarshall Clow2019-03-151-6/+6
| | | | llvm-svn: 356266
* Add noexcept to operator[] for array and deque. This is an extension. We ↵Marshall Clow2019-03-141-0/+11
| | | | | | already do this for string and string_view. This should give better codegen inside of noexcept functions. llvm-svn: 356209
* Support tests in freestandingJF Bastien2019-02-0435-35/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1935-140/+105
| | | | | | | | | | | | | | | | | | 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
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2019-01-161-2/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: ldionne, EricWF Subscribers: jyknight, christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 351289
* Fix static assert diagnostic checks in i386Eric Fiselier2018-12-152-2/+2
| | | | llvm-svn: 349252
* Tolerate Clangs new static_assert messagesEric Fiselier2018-12-142-2/+2
| | | | llvm-svn: 349189
* [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, ↵Louis Dionne2018-12-061-1/+8
| | | | | | | | | | | | | | | 0>.end() The standard section [array.zero] requires the return value of begin() and end() methods of a zero-sized array to be unique. Eric Fiselier clarifies: "That unique value cannot be null, and must be properly aligned". This patch adds checks for the first part of this clarification: unique value returned by these methods cannot be null. Reviewed as https://reviews.llvm.org/D55366. Thanks to Andrey Maksimov for the patch. llvm-svn: 348509
* [libcxx] Make return value of array<T, 0>.data() checked only for libc++Louis Dionne2018-12-062-6/+6
| | | | | | | | | | | The section array.zero says: "The return value of data() is unspecified". This patch marks all checks of the array<T, 0>.data() return value as libc++ specific. Reviewed as https://reviews.llvm.org/D55364. Thanks to Andrey Maksimov for the patch. llvm-svn: 348485
* Revert "Move internal usages of `alignof`/`__alignof` to use ↵Eric Fiselier2018-11-281-0/+2
| | | | | | | | | | | `_LIBCPP_ALIGNOF`. " This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12. The tests were failing on 32 bit builds, and I don't have time to clean them up right now. I'll recommit tomorrow with fixed tests. llvm-svn: 347816
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2018-11-281-2/+0
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: EricWF Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 347787
* [libcxx] Add missing <cstddef> includes in testsLouis Dionne2018-11-192-0/+3
| | | | | | | | | | | Some tests use type std::max_align_t, but don't include <cstddef> header directly. As a result, these tests won't compile against some conformant libraries. Reviewed as https://reviews.llvm.org/D54645. Thanks to Andrey Maksimov for the patch. llvm-svn: 347232
* Update the array tests to not use a local type; removes warnings in C++03. NFCMarshall Clow2018-10-123-9/+13
| | | | llvm-svn: 344417
* Update the changes to the array tests (that I committed yesterday) to use ↵Marshall Clow2018-08-031-55/+8
| | | | | | the test_comparison routines that I committed last week. NFC. llvm-svn: 338797
* Implement P1023: constexpr comparison operators for std::arrayMarshall Clow2018-08-021-0/+46
| | | | llvm-svn: 338668
* Mark deduction guide tests as failing on apple-clang-9JF Bastien2018-05-291-1/+1
| | | | | | | As discussed here: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058116.html The tests fail on clang-5, as well as apple-clang-9. Mark them as such. llvm-svn: 333479
* Fix up the final bits of breakage due to clang v5 generating bad implicit ↵Marshall Clow2018-05-281-3/+3
| | | | | | template deduction guides - specifically for copy-ctors llvm-svn: 333381
* Fix array deduction guide test breakageJF Bastien2018-05-251-0/+3
| | | | | | No matching constructor llvm-svn: 333315
* Disable 'missing-braces' warningMarshall Clow2018-05-182-0/+9
| | | | llvm-svn: 332779
* Implement deduction guides for <array>; Reviewed as ↵Marshall Clow2018-05-182-0/+90
| | | | | | https://reviews.llvm.org/D46964 llvm-svn: 332768
* Fix size and alignment of array<T, 0>.Eric Fiselier2018-02-071-2/+18
| | | | | | | | An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. llvm-svn: 324545
* Fix -verify static assert messages for older Clang versionsEric Fiselier2018-02-072-2/+2
| | | | llvm-svn: 324529
* [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default ↵Eric Fiselier2018-02-0714-4/+500
| | | | | | | | | | | | | | | | | | | constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 llvm-svn: 324526
* Revert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with ↵Nirav Dave2018-02-067-206/+0
| | | | | | | | | | | non-default constructible types." Revert "Fix initialization of array<const T, 0> with GCC." Revert "Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed." This reverts commit r324182, r324185, and r324194 which were causing issues with zero-length std::arrays. llvm-svn: 324309
* correct comment about C++03 assignment operatorsEric Fiselier2018-02-041-4/+4
| | | | llvm-svn: 324186
* Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed.Eric Fiselier2018-02-044-0/+160
| | | | | | | | | | | | The standard isn't exactly clear how std::array should handle zero-sized arrays with const element types. In particular W.R.T. copy assignment, swap, and fill. This patch takes the position that those operations should be ill-formed, and makes changes to libc++ to make it so. This follows up on commit r324182. llvm-svn: 324185
* [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default ↵Eric Fiselier2018-02-044-0/+46
| | | | | | | | | | | | | | | | | | | constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 llvm-svn: 324182
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-211-2/+2
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* First part of P0600 - '[[nodiscard] in the standard library'. Mark the ↵Marshall Clow2017-11-151-0/+28
| | | | | | 'empty()' methods of all the containers as nodiscard. If you're calling empty() w/o looking at the result, you probably meanto to call 'clear()'. c++2a only llvm-svn: 318269
* More missing tests - array<>::size() and array<>::max_size()Marshall Clow2017-11-152-0/+72
| | | | llvm-svn: 318256
* [libcxx] [test] Untabify, NFC.Stephan T. Lavavej2017-07-293-4/+4
| | | | llvm-svn: 309464
* [array.tuple]/1 says that instantiating tuple_element<N, array<T, M>> is ↵Marshall Clow2017-06-121-0/+35
| | | | | | ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that we failed llvm-svn: 305191
* Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in <array>Eric Fiselier2017-04-161-1/+3
| | | | llvm-svn: 300412
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-183-4/+4
| | | | | | No functional change, no code review. llvm-svn: 292434
* 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
* 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] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-041-1/+3
| | | | | | | | | | | 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
* Update -verify test to use new static assert messageEric Fiselier2016-09-251-5/+0
| | | | llvm-svn: 282352
* Make std::array typedef tests more portable.Eric Fiselier2016-06-301-4/+25
| | | | llvm-svn: 274210
* Move remaining _LIBCPP_VERSION tests into test/libcxxEric Fiselier2016-06-221-20/+0
| | | | llvm-svn: 273367
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-015-9/+9
| | | | llvm-svn: 271435
* Fix C++03 build breakageEric Fiselier2016-04-221-2/+9
| | | | llvm-svn: 267090
* Add is_swappable/is_nothrow_swappable traitsEric Fiselier2016-04-212-0/+50
| | | | llvm-svn: 267079
* Add some more tests for the containers type requirementsMarshall Clow2016-03-091-0/+14
| | | | llvm-svn: 263029
OpenPOWER on IntegriCloud