Commit Graph

3131 Commits

Author SHA1 Message Date
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
aeeba70ab1 [libc++] Add is_nothrow_convertible from P0758R1
Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355010 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 17:57:38 +00:00
Marshall Clow
ae4afd034b Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354988 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 15:41:37 +00:00
Marshall Clow
dd2ae1242f Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354950 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 02:58:56 +00:00
Marshall Clow
680a56e1aa Fix an ambiguity in the tests that gcc-tot complained about.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354944 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:52 +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
21c042e77e [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354940 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:57:57 +00:00
Marshall Clow
b3c66aa0ab First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354936 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:32:16 +00:00
Louis Dionne
b71643a4c0 [libc++] Add <filesystem> to the min-mac macro header test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354932 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 23:14:58 +00:00
Marshall Clow
452149ea33 Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354891 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 16:07:03 +00:00
Marshall Clow
a333218455 LWG3101 - span's Container constructors need another constraint. Reviewed as https://reviews.llvm.org/D57058.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354805 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 18:32:57 +00:00
Marshall Clow
c67930bd74 Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354802 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:58:03 +00:00
Marshall Clow
e5cb744bf1 First part of P1024: Usability Enhancements for std::span. Remove operator() for indexing, and add 'front' and 'back' calls.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354801 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:54:08 +00:00
Louis Dionne
98173dc3c4 [libcxx] Make sure all experimental tests are disabled when enable_experimental=False
Summary:
Previously, we'd run some experimental tests even when enable_experimental=False
was used with lit.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354725 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-23 11:24:03 +00:00
Louis Dionne
06dd101a65 [NFC] Fix incorrect comment in std::function test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354537 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 00:53:26 +00:00
Louis Dionne
712d476de3 [libcxx] Do not assume the number of elements in a moved-from associative container
Reviewed as https://reviews.llvm.org/D57903.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353955 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13 16:43:44 +00:00
Louis Dionne
af15bb4cdf [libc++] Avoid UB in the no-exceptions mode in a few places
Summary:
A few places in the library seem to behave unexpectedly when the library
is compiled or used with exceptions disabled. For example, not throwing
an exception when a pointer is NULL can lead us to dereference the pointer
later on, which is UB. This patch fixes such occurences.

It's hard to tell whether there are other places where the no-exceptions
mode misbehaves like this, because the replacement for throwing an
exception does not always seem to be abort()ing, but at least this
patch will improve the situation somewhat.

See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353850 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-12 16:06:02 +00:00
Eric Fiselier
ecc2c089fd Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353767 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 23:47:19 +00:00
Chandler Carruth
b20da37b6b Update some newly added files that mistakenly used the old file header
to the new one.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353668 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 08:39:14 +00:00
Kamil Rytarowski
e4dbc70699 Mark another test as flaky
Reported on the NetBSD buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353622 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09 18:39:07 +00:00
Louis Dionne
5569a5e69c [libc++] Fix XFAILs when exceptions are disabled
It turns out that I un-XFAILed too many tests in r353210: some tests
actually fail whether exceptions are enabled or not because they use
types that are marked as unavailable even when exceptions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353215 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:55:23 +00:00
Louis Dionne
4806bce5a8 [libc++] Fix XFAILs on macOS when exceptions are disabled
Some tests are marked as failing on platforms where the dylib does not
provide the required exception classes. However, when testing with
exceptions disabled, those tests shouldn't be marked as failing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353210 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:11:58 +00:00
Petr Hosek
fbc4ec4cc5 [CMake] Support compiler-rt builtins library in tests
We're building tests with -nostdlib which means that we need to
explicitly include the builtins library. When using libgcc (default)
we can simply include -lgcc_s on the link line, but when using
compiler-rt builtins we need a complete path to the builtins library.

This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY,
so we just need to pass that path to lit and if config.compiler_rt is
true, link it to the test.

Prior to this patch, running tests when compiler-rt is being used as
the builtins library was broken as all tests would fail to link, but
with this change running tests when compiler-rt bultins library is
being used should be supported.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353208 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:50:47 +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
Louis Dionne
60c45f5f7c [libcxx] Start defining lit features for tests depending on availability
This patch removes some vendor-specific availability XFAILs from the
test suite. In the future, when a new feature is introduced in the
dylib, an availability macro should be created and a matching lit
feature should be created. That way, the test suite can XFAIL whenever
the implementation lacks the necessary feature instead of being
cluttered by vendor-specific annotations.

Right now, those vendor-specific annotations are still somewhat cluttering
the test suite by being in `config.py`, but at least they are localized.
In the future, we could design a way to define those less intrusively or
even automatically based on the availability macros that already exist
in <__config>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353201 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:22:38 +00:00
Petr Hosek
6b1420d0f2 [CMake] Update lit test configuration
There are several changes:
- Don't stringify Pythonized bools (that's why we're Pythonizing them)
- Support specifying target and sysroot via CMake variables
- Use consistent spelling for --target, --sysroot, --gcc-toolchain

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353137 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 04:44:03 +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
Petr Hosek
79e853fd24 [CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353084 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:02:26 +00:00
Eric Fiselier
23b5c8797f Move the feature test macros script to the utils directory.
It doesn't make a lot of sense to keep it with the tests,
deep into the test suite directonies.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352970 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-02 23:13:49 +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
Marshall Clow
125313b00b Fix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewed as https://reviews.llvm.org/D57391 Thanks to Andrey Maksimov for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352781 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 18:54:26 +00:00
Thomas Anderson
b7568024ed [libc++] Fix Windows build error in <functional>
On my Windows system, __allocator is defined to nothing.  This change fixes build errors of the below form:

    In file included from algorithm:644:
    functional(1492,31):  error: expected member name or ';' after declaration specifiers
        const _Alloc& __allocator() const { return __f_.second(); }

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352561 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 23:19:45 +00:00
Eric Fiselier
a32a775e66 Fix PR40495 - is_invokable_v<void> does not compile
The meta-programming that attempted to form the invoke call expression
was not in a SFINAE context. This made it a hard error to provide
non-referencable types like 'void' or 'void (...) const'.

This patch fixes the error by checking the validity of the call
expression within a SFINAE context.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352522 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 18:01:14 +00:00
Marshall Clow
92f58d1b36 Mark some of the behavior in the move w/allocator constructors of deque/unordered containers as 'libc++-specific'. Thanks to Andrey Maksimov for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352512 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 16:12:45 +00:00
Petr Hosek
4267db0b26 [libc++] Use runtime rather then compile-time glibc version check
glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352425 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 20:39:50 +00:00
Kamil Rytarowski
9788355e30 Mark awk.pass.cpp as XFAIL for NetBSD
Reported on the NetBSD 8 build bot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352097 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 20:26:02 +00:00
Marshall Clow
e7e7b2e6bd D14686: 'Protect against overloaded comma in random_shuffle and improve tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352087 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 19:20:19 +00:00
Louis Dionne
42cbe7a2aa [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
The unordered_set and unordered_multiset iterators are specified in the standard as follows:

using iterator             = implementation-defined; // see [container.requirements]
using const_iterator       = implementation-defined; // see [container.requirements]
using local_iterator       = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]

The pairs iterator/const_iterator and local_iterator/const_local_iterator
are not required to be the same. The reasonable requirement would be that
iterator can convert to const_iterator and local_iterator can convert to
const_local_iterator. This patch weakens the check and makes the test
more portable.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352083 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 19:09:22 +00:00
Kamil Rytarowski
2a895e8087 Mark another test as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352064 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 17:17:55 +00:00
Marshall Clow
df2b82ce31 Uncomment the entire test, but mark as XFAIL on linux-gnu because it uses locales that aren't generally available there, similar to the other regex tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352006 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 01:52:56 +00:00
Kamil Rytarowski
dd8f4539c4 Mark another test as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351995 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 23:24:43 +00:00
Marshall Clow
01a665a876 Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351993 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 23:06:18 +00:00
Casey Carter
96442b7341 [test] Define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST in msvc_stdlib_force_include.hpp
...so the tests under test/std/utilities/any continue to
compile with MSVC's standard library.

While we're here, let's test >C++17 features when _HAS_CXX20.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351991 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 22:49:44 +00:00
Kamil Rytarowski
7cab086218 Mark another test as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351988 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 22:35:57 +00:00
Kamil Rytarowski
5091808728 Correct mark for flaky tests
Add missing trailing dot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351983 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 21:45:02 +00:00
Kamil Rytarowski
3f9884bec1 Mark more tests flaky
Reported on the NetBSD 8 buildbot


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351944 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 11:36:19 +00:00
Kamil Rytarowski
bd03c298c3 Mark thread.condition.condvarany/wait_for.pass.cpp as flaky
Reported on the NetBSD 8 buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351937 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-23 10:11:41 +00:00
Marshall Clow
b9b2b3f11e While reviewing D57058, Louis had some questions about the existing span constructor tests. They were not testing the stuff that they said they were. Updated the tests to test what they should have been doing
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351887 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-22 22:01:13 +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