Commit Graph

126 Commits

Author SHA1 Message Date
Louis Dionne
a57e4bf8e8 [libc++] Mark iostreams test as XFAIL on older macOSes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372620 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-23 15:40:47 +00:00
Marshall Clow
dbc7f4efd2 Only initialize the streams cout/wcout/cerr/wcerr etc once, rather than any time Init::Init is called. Fixes PR#43300
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371864 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 15:28:06 +00:00
Nico Weber
4ef3309d94 libcxx: Rename last two .hpp files in libcxx to .h
Differential Revision: https://reviews.llvm.org/D66544

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369597 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 22:38:38 +00:00
Nico Weber
28db4445e2 libcxx: Rename .hpp files in libcxx/test/support to .h
LLVM uses .h as its extension for header files.

Files renamed using:

    for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done

References to the files updated using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
        a=$(basename $f);
        echo $a;
        rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/";
    done

HPP include guards updated manually using:

    for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do
      echo ${f%.hpp}.h ;
    done | xargs mvim

Differential Revision: https://reviews.llvm.org/D66104

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21 00:14:12 +00:00
Petr Hosek
c0e405ec62 [libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose fails
This issue was detected by ASan in one of our tests. This test manually
invokes basic_filebuf::cloe(). fclose(__h.release() returned a non-zero
exit status, so __file_ wasn't set to 0. Later when basic_filebuf
destructor ran, we would enter the if (__file_) block again leading to
heap-use-after-free error.

The POSIX specification for fclose says that independently of the return
value, fclose closes the underlying file descriptor and any further
access (including another call to fclose()) to the stream results in
undefined behavior. This is exactly what happened in our test case.

To avoid this issue, we have to always set __file_ to 0 independently of
the fclose return value.

Differential Revision: https://reviews.llvm.org/D64979

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@366730 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-22 19:54:34 +00:00
Marshall Clow
b10aebc767 Implement LWG2221: 'Formatted output for nullptr_t' Reviewed as: https://reviews.llvm.org/D63053
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@364802 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-01 16:20:25 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
Louis Dionne
5a9ebbf0d9 [libc++] Add XFAILs for istream tests that were added in r357775
We fixed incorrect behavior of input streams in r357775 and tests were
added accordingly. However, older versions of macOS don't have the
change in the dylib yet, so the tests fail on those platforms.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357794 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 18:50:47 +00:00
Louis Dionne
0f60e0a4a0 [libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
This is a re-application of r357533 and r357531. They had been reverted
because we thought the commits broke the LLDB data formatters, but it
turns out this was because only r357531 had been included in the CI
run.

Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

This effectively implements the wording in p1264r0. It hasn't been voted
into the Standard yet, however there is wide agreement that the fix is
correct and it's just a matter of time before the fix is standardized.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D49863

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357775 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-05 16:33:37 +00:00
Louis Dionne
ee85f7c135 Revert "[libc++] Fix error flags and exceptions propagated from input stream operations"
This reverts commits r357533 and r357531, which broke the LLDB
data formatters. I'll hold off until we know how to fix the data
formatters accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357536 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 22:21:27 +00:00
Louis Dionne
59d894965e [libc++] Fix error flags and exceptions propagated from input stream operations
Summary:
Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

I will submit a paper in San Diego to clarify the Standard such that the
interpretation used in this commit (and other implementations) is the only
possible one.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D49863

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@357531 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-02 21:43:07 +00:00
Eric Fiselier
cdb3094601 Allow disabling of filesystem library.
Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being.

Reviewers: ldionne, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D59619

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356633 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 00:04:31 +00:00
Louis Dionne
51ecd6cd07 [libc++] Mark <filesystem> tests as failing when the dylib doesn't support filesystem
This fixes CI for back-deployment testers on platforms that don't have
<filesystem> support in the dylib.

This is effectively half of https://reviews.llvm.org/D59224. The other
half requires fixes in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356558 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 14:34:00 +00:00
Louis Dionne
3b886a1ce8 [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Unlike the previous attempt (r356500), this doesn't remove all the
filesystem tests.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D59152

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356518 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 20:56:13 +00:00
Louis Dionne
e76d13a487 Revert "[libc++] Build <filesystem> support as part of the dylib"
When I applied r356500 (https://reviews.llvm.org/D59152), I somehow
deleted all of filesystem's tests. I will revert r356500 and re-apply
it properly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356505 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:27:29 +00:00
Louis Dionne
582679a3fe [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D59152

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356500 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:09:33 +00:00
Louis Dionne
d386d7e49a [libc++] Fix forgotten fclose() in unit test
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 01:32:44 +00:00
Louis Dionne
f1546581e5 [libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355160 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 00:51:54 +00:00
Louis Dionne
a4bb2d075d [libc++] Add a test for PR14074
PR14074 was fixed in r165884, but no tests were added.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354943 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:09 +00:00
Louis Dionne
c6d9b0768b [libc++] Use UNSUPPORTED instead of TEST_STD_VER #ifdef
When the whole test only works starting at some version of the Standard,
use UNSUPPORTED lit markup instead of #ifdef TEST_STD_VER. This provides
more visibility into the test suite.

Reviewed as https://reviews.llvm.org/D57704.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353206 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:50:17 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Marshall Clow
5d83dada72 add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352926 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01 21:59:27 +00:00
Louis Dionne
8734fa79ec [libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351847 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-22 17:45:00 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
JF Bastien
4fb9e8f89a Filesystem tests: fix fs.op.relative
Summary: The test wasn't using the testing infrastructure properly.

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Differential Revision: https://reviews.llvm.org/D56519

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350872 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-10 18:50:34 +00:00
JF Bastien
668faeab19 [NFC] Normalize some test 'main' signatures
There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350770 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 22:56:45 +00:00
Eric Fiselier
936dd3d1ff Fix flaky symlink access time test.
last_write_time(sym, new_time) changes the modification time of the file
referenced by the symlink. But reading through the symlink may change the
symlinks's access time.

This meant the previous test that checked that the symlinks access
time was unchanged was incorrect and made the test flaky.

This patch removes this test (there really is no non-flaky way
to test that the new access time coorisponds to the time at which
the symlink was last dereferenced). This should unflake the test.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350478 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-05 21:18:10 +00:00
Eric Fiselier
5f14fb5f34 Fix test case breakages caused by lexically_relative change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349888 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 04:38:22 +00:00
Eric Fiselier
da05bdc85c Implement LWG 3096: path::lexically_relative is confused by trailing slashes
path("/dir/").lexically_relative("/dir"); now returns "." instead of ""

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349885 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 04:25:40 +00:00
Eric Fiselier
3cf34d1caf Implement LWG 3065: Make path operators friends.
This prevents things like:

using namespace std::filesystem;
auto x = L"a/b" == std::string("a/b");

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349884 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 04:09:01 +00:00
Eric Fiselier
a2037284d4 Implement LWG 2936: Path comparison is defined in terms of the generic format
This patch implements path::compare according to the current spec. The
only observable change is the ordering of "/foo" and "foo", which orders
the two paths based on having or not having a root directory (instead
of lexically comparing "/" to "foo").

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349881 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:16:30 +00:00
Marshall Clow
9ff404deec Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 23:19:00 +00:00
Michal Gorny
13d947cc06 [test] [filesystems] NetBSD can do symlink permissions too
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348968 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 20:28:52 +00:00
Michal Gorny
413329eb35 [test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD
NetBSD also uses tv_sec==-1 as error status indicator, and does not
support setting such a value.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348967 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-12 20:20:15 +00:00
Louis Dionne
8bcb9cabcd [libcxx] Mark some tests as failing on macosx 10.14
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348437 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 00:25:15 +00:00
Louis Dionne
caae3ec675 [libcxx] Don't depend on availability markup to provide the streams in the dylib
Whether an explicit instantiation declaration should be provided is not
a matter of availability markup.

This problem is exemplified by the fact that some tests were incorrectly
marked as XFAIL when they should instead have been using the definition
of streams from the headers, and hence passing, and that, regardless of
whether visibility annotations are enabled.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348436 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 00:24:58 +00:00
Louis Dionne
a0b648f164 [libcxx] Add XFAIL for test on OS X 10.12 to 10.14
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347473 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-22 16:38:03 +00:00
Louis Dionne
79132e8628 [libcxx] Remove incorrect XFAIL on macos 10.12
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347461 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-22 13:40:56 +00:00
Zhihao Yuan
580cde08e1 [libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)
Summary:
Avoid buffer overflow by replacing the pointer interface with an array reference interface in C++2a.
Tentatively ready on Batavia2018.

 https://wg21.link/lwg2499
 https://wg21.link/p0487

Reviewers: mclow.lists, ldionne, EricWF

Reviewed By: ldionne

Subscribers: libcxx-commits, cfe-commits, christof

Differential Revision: https://reviews.llvm.org/D51268

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347377 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 03:30:10 +00:00
Eric Fiselier
c2c6c1de6b Get tests compiling with -Wunused-local-typedef
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346914 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-15 00:11:02 +00:00
Volodymyr Sapsai
e59d098825 Revert "Implement LWG 2221 - No formatted output operator for nullptr."
This reverts r342566 as it causes on bots linker errors like

> Undefined symbols for architecture i386:
>   "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from:


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342599 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 23:31:34 +00:00
Marshall Clow
f06032bb0a Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-19 18:29:57 +00:00
Billy Robert O'Neal III
d39a48c04b [libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue/rvalue.pass.cpp
(Still pending review at https://reviews.llvm.org/D47400 which has been open since may; will ask for forgiveness rather than permission :) )

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339214 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 00:49:02 +00:00
Billy Robert O'Neal III
76dae9f0ba [libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow.pass.cpp
I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere.

(Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) )

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339213 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-08 00:47:29 +00:00
Eric Fiselier
a0866c5fb5 Implement <filesystem>
This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.

Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).

The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).

Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.

In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338093 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-27 03:07:09 +00:00
Stephan T. Lavavej
fcd4f15ced [libcxx] [test] Fix MSVC x64 truncation warning.
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data

Requesting post-commit review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@331575 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-05 01:40:24 +00:00
Billy Robert O'Neal III
c3ae85dbcf [libcxx] [test] Remove non-portable assertions from filebuf tests
seekoff.pass.cpp:
libc++'s tests are asserting things about the buffer passed to pubsetbuf. [filebuf.virtuals]/12 says that what the filebuf does with the buffer you give it is completely implementation defined. The MSVC++ implementation takes that buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't necessarily follow the pattern this test wants.
This change simply makes asserts against the buffer's contents use LIBCPP_ASSERT instead of assert.

pbackfail.pass.cpp:
libc++'s tests are asserting about what characters will and will not be available in the putback area. [filebuf.virtuals]/9 says "The function can alter the number of putback positions available as a result of any call." This change LIBCPP_ASSERTS libc++'s behavior, but checks invariants of the putback area independently.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@330999 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 22:18:33 +00:00
Billy Robert O'Neal III
58bcf28c63 [libcxx] [test] Remove nonportable that errc::is_a_directory produces "Is a directory" from ios_base::failure tests
These io_error asserts that std::errc::is_a_directory has message "Is a directory". On MSVC++ it reports "is a directory" (with a lowercase I). That doesn't matter for the ios_failure component being tested, so just implement in terms of system_category().message().

Reviewed as https://reviews.llvm.org/D45715

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@330791 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25 01:58:55 +00:00
Billy Robert O'Neal III
28989705f7 [libcxx] [test] Use the correct type from strlen. Include correct header.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329665 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-10 03:04:07 +00:00
Marshall Clow
078dd9752d Add a catch for std::length_error for the case where the string can't handle 2GB. (like say 32-bit big-endian)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@325147 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-14 18:05:25 +00:00