summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/iterators/stream.iterators
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-252-6/+0
| | | | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. This is a re-application of r372787. llvm-svn: 372916
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-252-0/+6
| | | | | | | | | | | | This also reverts: - r372778: [libc++] Implement LWG 3158 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older - r372787: Purge mentions of GCC 4 from the test suite Reason: the change breaks compilation of LLVM with libc++, for details see http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html llvm-svn: 372832
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-242-6/+0
| | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. llvm-svn: 372787
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3133-0/+66
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Support tests in freestandingJF Bastien2019-02-0443-43/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1943-172/+129
| | | | | | | | | | | | | | | | | | 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
* [libcxx] [test] Fix whitespace, NFC.Stephan T. Lavavej2018-05-051-8/+8
| | | | | | Strip trailing whitespace and untabify. llvm-svn: 331576
* Move old test into test/libcxx, and implement new version of test for ↵Marshall Clow2018-04-261-2/+15
| | | | | | ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report. llvm-svn: 330955
* [libcxx] [test] Use TEST_COMPILER_C1XX.Stephan T. Lavavej2018-04-121-2/+4
| | | | | | Also TEST_COMPILER_CLANG in one place. (More could be changed.) llvm-svn: 329977
* [libcxx] Define istream_iterator equality comparison operators out-of-lineRoger Ferrer Ibanez2017-12-111-0/+3
| | | | | | | | | | | | | | | | | Currently libc++ defines operator== and operator!= as friend functions in the definition of the istream_iterator class template. Such definition has a subtle difference from an out-of-line definition required by the C++ Standard: these functions can only be found by argument-dependent lookup, but not by qualified lookup. This patch changes the definition, so that it conforms to the C++ Standard and adds a check involving qualified lookup to the test suite. Patch contributed by Mikhail Maltsev. Differential Revision: https://reviews.llvm.org/D40415 llvm-svn: 320363
* Change test suite to support c++17 dialect flag instead of c++1z.Eric Fiselier2017-11-071-1/+1
| | | | | | | | This patch changes the test suite to attempt and prefer -std=c++17 over -std=c++1z. It also fixes the REQUIRES and UNSUPPORTED lit markers to refer to c++17 over c++1z. llvm-svn: 317610
* Placate unused variable warnings uncovered by improvements to clang's ↵Benjamin Kramer2017-10-142-0/+4
| | | | | | -Wunused-variable llvm-svn: 315809
* Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did ↵Marshall Clow2017-05-231-28/+0
| | | | | | anything useful. llvm-svn: 303675
* [libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance ↵Stephan T. Lavavej2017-05-053-0/+54
| | | | | | | | | | | shouldn't be mandated". In C++17, these iterators are allowed but not required to inherit from the deprecated std::iterator base class. Fixes D32727. llvm-svn: 302318
* Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"Mehdi Amini2017-03-021-1/+1
| | | | | | | | The test is passing with c++11 and c++14 but not c++1z on this particular version of the compiler. Try to use lit boolean condition to satisfy this constaint. llvm-svn: 296725
* Revert "Fix Apple-specific XFAIL directive in libc++ test"Mehdi Amini2017-03-021-1/+1
| | | | | | | | | | | This reverts commit r296712. It broke our bot. It turns out that the test is passing with c++11 and c++14 but not c++1z on this particular version of the compiler. Since one job is defaulting to c++1z and the other is testing all config I'm not sure how to fix this... llvm-svn: 296724
* Fix Apple-specific XFAIL directive in libc++ testMehdi Amini2017-03-011-1/+1
| | | | | | | | This tests is failing in XCode 7.0. But Xcode 7.3 that shipped an updated clang has this test passing. This is fixing green dragon which runs this configuration. llvm-svn: 296712
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-171-1/+1
| | | | llvm-svn: 295434
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-183-5/+5
| | | | | | No functional change, no code review. llvm-svn: 292434
* Fix unused parameters and variablesEric Fiselier2016-12-231-0/+1
| | | | llvm-svn: 290459
* XFAIL test for more apple-clang versionsEric Fiselier2016-12-151-1/+1
| | | | llvm-svn: 289767
* XFAIL test on apple-clang-7.0Eric Fiselier2016-12-141-1/+1
| | | | llvm-svn: 289716
* Recommit r286884: P0503R0, adopted in Issaquah, rewords some requirements on ↵Eric Fiselier2016-12-143-3/+47
| | | | | | | | | | | | | | | nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests. This patch was reverted due to llvm.org/PR31016. There is a bug in Clang 3.7 which causes default.pass.cpp to fails. That test is now marked as XFAIL for that clang version. This patch was originally authored by Marshall Clow. llvm-svn: 289708
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | loss of data", part 7/7. test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4). test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1). test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp This test is intentionally writing doubles to ostream_iterator<int>. It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC. test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float. test/std/numerics/complex.number/cmplx.over/arg.pass.cpp test/std/numerics/complex.number/cmplx.over/norm.pass.cpp These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long. Saying static_cast<double>(x) avoids this. test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index, we can just iterate with `T s`. test/std/re/re.traits/value.pass.cpp regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t (which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t. test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation. (And 100 is representable even when char has a signed range.) test/std/strings/string.view/string.view.hash/string_view.pass.cpp Add static_cast<char_type> because `'0' + i` has type int. test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2 says that pow(int, int) returns double, so this was truncating double to int. Adding static_cast<T> silences this. test/std/utilities/function.objects/unord.hash/integral.pass.cpp This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this. test/std/utilities/utility/exchange/exchange.pass.cpp First, this was exchanging 67.2 into an int, but that's inherently truncating. Changing this to static_cast<short>(67) avoids the truncation while preserving the "what if T and U are different" test coverage. Second, this was exchanging {} with the explicit type float into an int, and that's also inherently truncating. Specifying short is just as good. test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp Add static_cast<short>. Note that this affects template argument deduction for make_pair(), better fulfilling the test's intent. For example, this was saying `typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking make_pair() to return pair<int, int>, which was then being converted to pair<int, short>. (pair's converting constructors are tested elsewhere.) Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>. (There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.) Fixes D27544. llvm-svn: 289111
* Revert "P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t ↵Vedant Kumar2016-11-153-43/+3
| | | | | | | | | | | | | and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests." This reverts commit r286884, because it breaks the Xcode 7 builders: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1583 Here is a PR that tracks the issue: https://llvm.org/bugs/show_bug.cgi?id=31016 llvm-svn: 287004
* P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and ↵Marshall Clow2016-11-143-3/+43
| | | | | | istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests. llvm-svn: 286884
* Add tests for LWG2544. We already implement this; just adding tests to make ↵Marshall Clow2016-10-103-0/+66
| | | | | | sure that we keep doing it. llvm-svn: 283749
* Make instreambuf.iterator/types.pass.cpp more portable.Eric Fiselier2016-06-301-6/+12
| | | | llvm-svn: 274207
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-143-4/+10
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-014-4/+4
| | | | llvm-svn: 271435
* Test hijacking ADL for operator& in the stream iterator constructors.Eric Fiselier2016-05-172-3/+30
| | | | llvm-svn: 269838
* Add test for r269789Eric Fiselier2016-05-171-0/+2
| | | | llvm-svn: 269812
* Rename a few tests that had typos in their names. No functional change. ↵Marshall Clow2016-04-231-0/+0
| | | | | | Thanks to STL for the catch llvm-svn: 267287
* Mark some test XFAIL for GCC 4.9 due to missing is_trivial* traitsEric Fiselier2016-01-202-0/+6
| | | | llvm-svn: 258287
* Suppress clang warnings in some testsEric Fiselier2015-08-301-0/+4
| | | | llvm-svn: 246399
* A few bits of N2994 didn't get fully implemented a long time ago. Thanks to ↵Marshall Clow2015-04-165-8/+79
| | | | | | STL@microsoft.com for the bug report llvm-svn: 235134
* Move test into test/std subdirectory.Eric Fiselier2014-12-2043-0/+1579
llvm-svn: 224658
OpenPOWER on IntegriCloud