Commit Graph

2991 Commits

Author SHA1 Message Date
Marshall Clow f6b6be2f7a 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
llvm-svn: 352006
2019-01-24 01:52:56 +00:00
Kamil Rytarowski d3068a2c2f Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351995
2019-01-23 23:24:43 +00:00
Marshall Clow 28166dd9b3 Apply D28248: 'Work around GCC PR37804'. Thanks to mdaniels for the patch
llvm-svn: 351993
2019-01-23 23:06:18 +00:00
Casey Carter 1ecf6e55cd [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.

llvm-svn: 351991
2019-01-23 22:49:44 +00:00
Kamil Rytarowski 829d916d7d Mark another test as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351988
2019-01-23 22:35:57 +00:00
Kamil Rytarowski 314bd26db1 Correct mark for flaky tests
Add missing trailing dot.

llvm-svn: 351983
2019-01-23 21:45:02 +00:00
Kamil Rytarowski 776cf71d4f Mark more tests flaky
Reported on the NetBSD 8 buildbot

llvm-svn: 351944
2019-01-23 11:36:19 +00:00
Kamil Rytarowski fe1991b55e Mark thread.condition.condvarany/wait_for.pass.cpp as flaky
Reported on the NetBSD 8 buildbot.

llvm-svn: 351937
2019-01-23 10:11:41 +00:00
Marshall Clow 8f302e6222 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
llvm-svn: 351887
2019-01-22 22:01:13 +00:00
Louis Dionne 53e8ece06a [libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 351847
2019-01-22 17:45:00 +00:00
Eric Fiselier 85bdbbf9a1 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351670
2019-01-20 01:21:35 +00:00
Eric Fiselier 3662572275 Revert "Fix aligned allocation availability XFAILs after D56445."
This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

llvm-svn: 351669
2019-01-20 01:12:53 +00:00
Chandler Carruth b3ee4190e7 Update generator script to use the new license file header.
llvm-svn: 351650
2019-01-19 11:38:40 +00:00
Chandler Carruth 57b08b0944 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.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

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: 351636
2019-01-19 08:50:56 +00:00
Eric Fiselier a32dd04238 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

llvm-svn: 351625
2019-01-19 03:27:05 +00:00
Eric Fiselier 973eab8a5d correct script name in generated tests
llvm-svn: 351299
2019-01-16 05:43:02 +00:00
Eric Fiselier efdac65f70 Attempt to make test_macros.h even more minimal
llvm-svn: 351292
2019-01-16 02:16:57 +00:00
Eric Fiselier 05019eb79f Fix feature test macros for atomics/mutexes without threading
llvm-svn: 351291
2019-01-16 02:10:28 +00:00
Eric Fiselier d01a4aa068 Fix PR40230 - std::pair may have padding on FreeBSD.
Summary:
FreeBSD ships a very old and deprecated ABI for std::pair where the copy and move constructors are not allowed to be trivial. D25389 change how this was implemented by introducing a non-trivial base class. This patch, introduced in October 2016, introduced an ABI bug that caused nested `std::pair` instantiations to have padding. For example:

```
using PairT = std::pair< std::pair<char, char>, char >;
static_assert(offsetof(PairT, first) == 0, "First member should exist at offset zero"); // Fails on FreeBSD!
```

The bug occurs because the base class for the first element (the nested pair) cannot be put at offset zero because the top-level pair already has the same base class laid out there.

This patch fixes that ABI bug by templating the dummy base class on the same parameters as the pair.

Technically this fix is an ABI break for users who depend on the "broken" ABI introduced in 2016. I'm putting this up for review so that the FreeBSD maintainers can sign off on fixing the ABI by breaking the ABI.
Another option, since we have to "break" the ABI to fix it, would be to move FreeBSD off the deprecated non-trivial pair ABI instead.

Also see:

* https://llvm.org/PR40230
* https://reviews.llvm.org/D21329



Reviewers: rsmith, dim, emaste

Reviewed By: rsmith

Subscribers: mclow.lists, krytarowski, christof, ldionne, libcxx-commits

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

llvm-svn: 351290
2019-01-16 01:54:34 +00:00
Eric Fiselier d108bf85b0 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
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
2019-01-16 01:51:12 +00:00
Eric Fiselier 32784a740a Implement feature test macros using a script.
Summary:
This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a.

The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++.
When a new feature test macro is added or needed, the table should be updated and the script re-run.



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

Reviewed By: mclow.lists

Subscribers: arphaman, jfb, ldionne, libcxx-commits

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

llvm-svn: 351286
2019-01-16 01:37:43 +00:00
Dan Albert 5452d3f099 Add large file support to create_file for 32-bit.
Summary:
The tests need to create files larger than 2GB, but size_t is 32-bit
on a 32-bit system. Make use of explicit off64_t APIs so we can still
use a default off_t for the tests while enabling 64-bit file offsets
for create_file.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351225
2019-01-15 19:14:15 +00:00
Petr Hosek 20c425cdab [libc++] Support different libc++ namespaces in the iterator test
libc++ allows changing the namespace, don't assume __1 in the test
to avoid the test failure if different namespace is being used.

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

llvm-svn: 351220
2019-01-15 18:55:55 +00:00
Casey Carter dcaaa1baed [test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763.

llvm-svn: 351148
2019-01-15 01:53:12 +00:00
Marshall Clow f3126c8bc5 Generalize the comparison test structure to support cross-type comparisons. NFC to the library
llvm-svn: 351140
2019-01-15 00:05:05 +00:00
Marshall Clow e495760140 Change from a to a . Fixes PR#39871.
llvm-svn: 350972
2019-01-11 21:57:12 +00:00
Marshall Clow 80378fd38b Don't use the form '2017y' in tests, since some gcc versions don't allow it
llvm-svn: 350930
2019-01-11 15:45:56 +00:00
Marshall Clow 5c08881343 Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
llvm-svn: 350929
2019-01-11 15:12:04 +00:00
Louis Dionne 1d5f6a81f5 [libcxx] Reorganize tests since the application of P0602R4
Summary:
P0602R4 makes the special member functions of optional and variant
conditionally trivial based on the types in the optional/variant.
We already implemented that, but the tests were organized as if this
were a non-standard extension. This patch reorganizes the tests in a
way that makes more sense since this is not an extension anymore.

Reviewers: EricWF, mpark, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 350884
2019-01-10 20:06:11 +00:00
JF Bastien a936f84863 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

llvm-svn: 350872
2019-01-10 18:50:34 +00:00
JF Bastien 1026ce6de4 [NFC] Always lock free test: add indirection
I have a big patch coming up, and this indirection is required to avoid hitting the following after my big change:

  error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat]

llvm-svn: 350772
2019-01-09 23:20:24 +00:00
JF Bastien 2f4df4c986 [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.

llvm-svn: 350770
2019-01-09 22:56:45 +00:00
Eric Fiselier e49fc07c69 Mark two UDL tests as being unsupported with Clang 7
llvm-svn: 350739
2019-01-09 16:34:17 +00:00
Louis Dionne ea443cf828 [libcxx] Remove outdated XFAILs for aligned deallocation
AppleClang 10 has been fixed and so these tests don't fail anymore.

llvm-svn: 350736
2019-01-09 16:13:04 +00:00
Eric Fiselier 7b03b66e5c Mark two more tests as FLAKY
llvm-svn: 350692
2019-01-09 05:48:54 +00:00
Louis Dionne 4d3366e257 [Sema] Teach Clang that aligned allocation is not supported with macosx10.13
Summary:
r306722 added diagnostics when aligned allocation is used with deployment
targets that do not support it, but the first macosx supporting aligned
allocation was incorrectly set to 10.13. In reality, the dylib shipped
with macosx10.13 does not support aligned allocation, but the dylib
shipped with macosx10.14 does.

Reviewers: ahatanak

Subscribers: christof, jkorous, dexonsmith, cfe-commits

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

llvm-svn: 350649
2019-01-08 20:26:56 +00:00
Marshall Clow 8f9346922c Set the buffer of an fstream to empty when the underlying file is closed. This 'fixes' PR#38052 - std::fstream still good after closing and updating content.
llvm-svn: 350603
2019-01-08 02:48:45 +00:00
Volodymyr Sapsai fb0e1908d4 [libcxx] Optimize vectors construction of trivial types from an iterator range with const-ness mismatch.
We already have a specialization that will use memcpy for construction
of trivial types from an iterator range like

    std::vector<int>(int *, int *);

But if we have const-ness mismatch like

    std::vector<int>(const int *, const int *);

we would use a slow path that copies each element individually. This change
enables the optimal specialization for const-ness mismatch. Fixes PR37574.

Contributions to the patch are made by Arthur O'Dwyer, Louis Dionne.

rdar://problem/40485845

Reviewers: mclow.lists, EricWF, ldionne, scanon

Reviewed By: ldionne

Subscribers: christof, ldionne, howard.hinnant, cfe-commits

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

llvm-svn: 350583
2019-01-08 00:03:16 +00:00
Eric Fiselier 389da901d0 Mark more tests as flaky
llvm-svn: 350550
2019-01-07 18:21:18 +00:00
Marshall Clow 4d4213f694 Add the feature test macros that were defined in p1353r0 to the headers of the appropriate tests. No actual tests yet, so NFC.
llvm-svn: 350535
2019-01-07 16:17:52 +00:00
Eric Fiselier b168a7c660 Fix PR39749 - Headers containing just #error harm __has_include.
This patch changes <experimental/foo> to use #warning instead of
is harmful to common feature detection idioms.

We should also consider only emitting the warning when __DEPRECATED is
defined, like we do in the <ext/foo> headers. Users may want to specify
"-Werror=-W#warnings" while still ignoring the libc++ warnings.

llvm-svn: 350485
2019-01-06 00:37:31 +00:00
Eric Fiselier 5792cf42b7 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.

llvm-svn: 350478
2019-01-05 21:18:10 +00:00
Marshall Clow 71c1680d2c De-tab a couple tests. NFC
llvm-svn: 350330
2019-01-03 17:18:40 +00:00
Eric Fiselier aae39bf928 Fix test case breakages caused by lexically_relative change
llvm-svn: 349888
2018-12-21 04:38:22 +00:00
Eric Fiselier 8b1ad5cf8d Fix copy paste error in file_clock tests
llvm-svn: 349886
2018-12-21 04:27:45 +00:00
Eric Fiselier ba62831f7c Implement LWG 3096: path::lexically_relative is confused by trailing slashes
path("/dir/").lexically_relative("/dir"); now returns "." instead of ""

llvm-svn: 349885
2018-12-21 04:25:40 +00:00
Eric Fiselier 49b183a9ec Implement LWG 3065: Make path operators friends.
This prevents things like:

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

llvm-svn: 349884
2018-12-21 04:09:01 +00:00
Eric Fiselier 866885e12a Implement LWG 3145: file_clock breaks ABI for C++17 implementations.
This patch adds std::chrono::file_clock, but without breaking the
existing ABI for std::filesystem.

llvm-svn: 349883
2018-12-21 03:54:57 +00:00
Eric Fiselier 1425485773 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").

llvm-svn: 349881
2018-12-21 03:16:30 +00:00
Louis Dionne ebc2344a8b [libcxx] Fix order checking in unordered_multimap tests.
Some tests assume that iteration through an unordered multimap elements
will return them in the same order as at the container creation. This
assumption is not true since the container is unordered, so that no
specific order of elements is ever guaranteed for such container. This
patch introduces checks verifying that any iteration will return elements
exactly from a set of valid values and without repetition, but in no
particular order.

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

llvm-svn: 349780
2018-12-20 17:55:31 +00:00
Volodymyr Sapsai e7652f5c0d [libcxx] Use custom allocator's `construct` in C++03 when available.
Makes libc++ behavior consistent between C++03 and C++11.

Can use `decltype` in C++03 because `include/__config` defines a macro when
`decltype` is not available.

Reviewers: mclow.lists, EricWF, erik.pilkington, ldionne

Reviewed By: ldionne

Subscribers: dexonsmith, cfe-commits, howard.hinnant, ldionne, christof, jkorous, Quuxplusone

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

llvm-svn: 349676
2018-12-19 20:08:43 +00:00
Eric Fiselier 350ee4bb13 Work around GCC 9.0 regression
llvm-svn: 349663
2018-12-19 18:58:22 +00:00
Marshall Clow 8d221b40a7 Add missing include to test. NFC
llvm-svn: 349639
2018-12-19 16:39:04 +00:00
Marshall Clow 5a127cdcbf Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.
llvm-svn: 349566
2018-12-18 23:19:00 +00:00
Marshall Clow b766eb96ff Rework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar.pass.cpp to avoid constructing a couple things from zero - since apparently they can be enums in some weird C library. NFC there, either, since the values were never used.
llvm-svn: 349522
2018-12-18 19:07:30 +00:00
Louis Dionne c19d729786 [libcxx] Remove XFAILs for older macOS versions
That test doesn't fail anymore since r349378, since the assertions that
r349378 removed must have been bugs in the dylib at some point.

llvm-svn: 349484
2018-12-18 13:46:28 +00:00
Louis Dionne 06caa6d2e6 [libcxx] Handle AppleClang 9 and 10 in XFAILs for aligned allocation tests
I forgot that those don't behave like Clang trunk, again.

llvm-svn: 349427
2018-12-18 00:42:09 +00:00
Louis Dionne afb1d72e7b [libcxx] Properly mark aligned allocation macro test as XFAIL on OS X
This test was initially marked as XFAIL using `XFAIL: macosx10.YY`, and
was then moved to `UNSUPPORTED: macosx10.YY`. The intent is to mark the
test as XFAILing when a deployment target older than macosx10.14 is used,
and the right way to do this is `XFAIL: availability=macosx10.YY`.

llvm-svn: 349426
2018-12-18 00:30:15 +00:00
Eric Fiselier 2a58b11a8a Fix FP comparisons when SSE isn't available
llvm-svn: 349387
2018-12-17 20:17:43 +00:00
Michal Gorny c32d47c6a8 [test] Add target_info for NetBSD, and XFAIL some of locale tests
Add a target_info definition for NetBSD.  The definition is based
on the one used by FreeBSD, with libcxxrt replaced by libc++abi,
and using llvm-libunwind since we need to use its unwinder
implementation to build anyway.

Additionally, XFAIL the 30 tests that fail because of non-implemented
locale features.  According to the manual, NetBSD implements only
LC_CTYPE part of locale handling.  However, there is a locale database
in the system and locale specifications are validated against it,
so it makes sense to list the common locales as supported.

If I'm counting correctly, this change enables additional 43 passing
tests.

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

llvm-svn: 349379
2018-12-17 19:14:08 +00:00
Michal Gorny 916bf993a2 [test] [re.traits] Remove asserts failing due to invalid UTF-8
Remove the two test cases for \xDA and \xFA with UTF-8 locale, as both
characters alone are invalid in UTF-8 (short sequences).  Upon removing
them, the test passes on Linux again (and also on NetBSD, after adding
appropriate locale configuration).

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

llvm-svn: 349378
2018-12-17 19:13:41 +00:00
Eric Fiselier 077a0aff16 Unbreak green dragon bots w/o __builtin_launder
llvm-svn: 349373
2018-12-17 18:37:59 +00:00
Eric Fiselier 2d6833c9c9 Expect Clang diagnostics in std::launder test
llvm-svn: 349364
2018-12-17 16:56:24 +00:00
Louis Dionne 04695a7539 [libcxx] Speeding up partition_point/lower_bound/upper_bound
This is a re-application of r345525, which had been reverted by fear of
a regression.

Reviewed as https://reviews.llvm.org/D53994.
Thanks to Denis Yaroshevskiy for the patch.

llvm-svn: 349358
2018-12-17 16:04:39 +00:00
Michal Gorny 4ce222198c [test] [support] Use socket()+bind() to create unix sockets portably
Replace the mknod() call with socket() + bind() for creating unix
sockets.  The mknod() method is not portable and does not work
on NetBSD while binding the socket should work on all systems supporting
unix sockets.

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

llvm-svn: 349305
2018-12-16 15:12:06 +00:00
Michal Gorny 16b9decb93 [test] [ctime] Ignore -Wformat-zero-length warnings
Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).

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

llvm-svn: 349294
2018-12-16 09:18:31 +00:00
Eric Fiselier 241c73b191 Fix static assert diagnostic checks in i386
llvm-svn: 349252
2018-12-15 05:18:56 +00:00
Eric Fiselier 3e5d847fa0 Tolerate Clangs new static_assert messages
llvm-svn: 349189
2018-12-14 20:42:36 +00:00
Louis Dionne a5e2b081be [libcxx] Mark some tests as still failing on macosx10.14
llvm-svn: 349187
2018-12-14 20:22:44 +00:00
Marshall Clow f60c63c090 Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
llvm-svn: 349178
2018-12-14 18:49:35 +00:00
Louis Dionne 5f1706f3aa [libcxx] Fix pop_back() tests to make sure they don't always just pass
llvm-svn: 349071
2018-12-13 18:53:17 +00:00
Louis Dionne 589f1764fc [libcxx] Add assertion in deque::pop_back when popping from an empty deque
Also, add tests making sure that vector and deque both catch the problem
when assertions are enabled. Otherwise, deque would segfault and vector
would never terminate.

llvm-svn: 348994
2018-12-12 23:58:25 +00:00
Michal Gorny 68cbd6bdb2 [test] [depr.c.headers] XFAIL uchar.h on NetBSD
llvm-svn: 348973
2018-12-12 20:51:46 +00:00
Michal Gorny c22e62d9a7 [test] [filesystems] NetBSD can do symlink permissions too
llvm-svn: 348968
2018-12-12 20:28:52 +00:00
Michal Gorny e8e635ff5e [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.

llvm-svn: 348967
2018-12-12 20:20:15 +00:00
Michal Gorny 97569391ea [test] Permit NetBSD in filesystem_dynamic_test_helper.py
llvm-svn: 348872
2018-12-11 18:29:35 +00:00
Louis Dionne 17b65c0d58 [libcxx] Fix test failure on GCC 4.9
GCC 4.9 seems to think that a constexpr default constructor implies
the constructor to be noexcept.

llvm-svn: 348850
2018-12-11 15:27:10 +00:00
Louis Dionne 9f77b1a1de [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

This is a re-application of r348824, which broke the build in C++03 mode
because a test was marked as supported in C++03 when it shouldn't be.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348847
2018-12-11 14:22:28 +00:00
Louis Dionne bca37ac8b8 [libcxx] Fix test on compilers that do not support char8_t yet
llvm-svn: 348846
2018-12-11 14:15:54 +00:00
Marshall Clow f17c5f6ba6 Fix problems with char8_t stuff on compilers that don't support char8_t yet
llvm-svn: 348829
2018-12-11 06:06:49 +00:00
Marshall Clow 7dad0bd68b Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
llvm-svn: 348828
2018-12-11 04:35:44 +00:00
Louis Dionne d5a20703c4 Revert "[pair] Mark constructors as conditionally noexcept"
This broke the tests on Linux. Reverting until I find out why the tests
are broken (tomorrow).

llvm-svn: 348825
2018-12-11 02:32:46 +00:00
Louis Dionne 76cce3b2bd [pair] Mark constructors as conditionally noexcept
Summary:
std::tuple marks its constructors as noexcept when the corresponding
memberwise constructors are noexcept too -- this commit improves std::pair
so that it behaves the same.

Note:
I did not add support in the explicit and non-explicit `pair(_Tuple&& __p)`
constructors because those are non-standard extensions, and supporting them
properly is tedious (we have to copy the rvalue-referenceness of the deduced
_Tuple&& onto the result of tuple_element).

<rdar://problem/29537079>

Reviewers: mclow.lists, EricWF

Subscribers: christof, llvm-commits

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

llvm-svn: 348824
2018-12-11 02:17:23 +00:00
Marshall Clow 655fb4a767 Update a couple of vector<bool> tests that were testing libc++-specific bahavior. Thanks to Andrey Maksimov for the catch.
llvm-svn: 348660
2018-12-07 22:16:26 +00:00
Louis Dionne 737be83d20 [libcxx] Remove the availability_markup LIT feature
It is now equivalent to the 'availability' LIT feature, so there's no
reason to keep both.

llvm-svn: 348653
2018-12-07 21:48:39 +00:00
Louis Dionne 3560fbf304 [libc++] Improve diagnostics for non-const comparators and hashers in associative containers
Summary:
When providing a non-const-callable comparator in a map or set, the
warning diagnostic does not include the point of instantiation of
the container that triggered the warning, which makes it difficult
to track down the problem. This commit improves the diagnostic by
placing it directly in the body of the associative container.

The same change is applied to unordered associative containers, which
had a similar problem.

Finally, this commit cleans up the forward declarations of several
map and unordered_map helpers, which are not needed anymore.

<rdar://problem/41370747>

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, llvm-commits

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

llvm-svn: 348529
2018-12-06 21:46:17 +00:00
Louis Dionne bf3f90c34f [libcxx] Fix incorrect XFAILs for chrono tests on old macos deployment targets
The tests were marked to fail based on the 'availability' LIT feature.
However, those tests should really only be failing when we run them
against the dylibs that were deployed on macosx10.7 and macosx10.8,
which the deployment target has nothing to do with.

This caused the tests to unexpectedly pass when running the tests
with deployment target macosx10.{7,8} but running with a recent dylib.

llvm-svn: 348520
2018-12-06 19:24:20 +00:00
Louis Dionne 7125b08d08 [libcxx] Add checks for unique value of array<T, 0>.begin() and array<T, 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
2018-12-06 18:24:39 +00:00
Louis Dionne 2a23317e69 [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9
Some people are still running the test suite using AppleClang 9.

llvm-svn: 348507
2018-12-06 18:06:47 +00:00
Louis Dionne 26f01c46e9 [libcxx] Make return value of array<T, 0>.data() checked only for libc++
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
2018-12-06 13:52:20 +00:00
Louis Dionne 2d36473873 [libcxx] Mark some tests as failing on macosx 10.14
llvm-svn: 348437
2018-12-06 00:25:15 +00:00
Louis Dionne f7f5a1f778 [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.

llvm-svn: 348436
2018-12-06 00:24:58 +00:00
Louis Dionne bb9ca6d0bf [libcxx] Implement P0318: unwrap_ref_decay and unwrap_reference
Summary:
This was voted into C++20 in San Diego. Note that there was a revision
D0318R2 which did include unwrap_reference_t, but we mistakingly voted
P0318R1 into the C++20 Working Draft (which does not include
unwrap_reference_t). This patch implements D0318R2, which is what
we'll end up with in the Working Draft once this mistake has been
fixed.

Reviewers: EricWF, mclow.lists

Subscribers: christof, dexonsmith, libcxx-commits

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

llvm-svn: 348138
2018-12-03 14:03:27 +00:00
Marshall Clow 08794627a3 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try)
llvm-svn: 347930
2018-11-29 23:21:18 +00:00
Louis Dionne 9af1d12978 [libcxx] Make UNSUPPORTED for std::async test more fine grained
The test was previously marked as unsupported on all Apple platforms, when
we really just want to mark it as unsupported for previously shipped dylibs
on macosx.

llvm-svn: 347920
2018-11-29 21:25:29 +00:00
Marshall Clow 80fabab677 Revert commit r347904 because it broke older compilers
llvm-svn: 347908
2018-11-29 20:04:47 +00:00
Marshall Clow 8143278500 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane.
llvm-svn: 347904
2018-11-29 19:49:48 +00:00
Louis Dionne e823b6d7e6 [libcxx] Remove bad_array_length
Summary:
std::bad_array_length was added by n3467, but this never made it into C++.
This commit removes the definition of std::bad_array_length from the headers
AND from the shared library. See the comments in the ABI changelog for details
about the ABI implications of this change.

Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF

Subscribers: christof, jkorous, libcxx-commits

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

llvm-svn: 347903
2018-11-29 19:44:57 +00:00
Louis Dionne 8b1f5aae7e [libcxx] More fixes to XFAILs for aligned allocation tests for macosx 10.13
Those tests are a real pain to tweak.

llvm-svn: 347875
2018-11-29 15:52:36 +00:00
Eric Fiselier 9d25ada420 Revert "Move internal usages of `alignof`/`__alignof` to use `_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
2018-11-28 22:24:19 +00:00
Eric Fiselier 901ede719b Fix bad _LIBCPP_ALIGNOF test
llvm-svn: 347790
2018-11-28 18:32:16 +00:00
Marshall Clow 4d64d7dd64 Implement P0966 - string::reserve should not shrink
llvm-svn: 347789
2018-11-28 18:18:34 +00:00
Eric Fiselier 8a486dac25 Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
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
2018-11-28 18:16:02 +00:00
Louis Dionne 9a494eacba [libcxx] Remove dynarray
Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

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

llvm-svn: 347783
2018-11-28 18:02:00 +00:00
Louis Dionne 4eacdb41e9 [libcxx] Use clang-verify in the lit test suite even when availability is enabled
llvm-svn: 347780
2018-11-28 17:31:17 +00:00
Marshall Clow 44d247d280 Implement P1085R2 - Should Span be Regular?. This consists entirely of deletions
llvm-svn: 347672
2018-11-27 16:35:41 +00:00
Eric Fiselier 01a87ef88b Add basic_string::__resize_default_init (from P1072)
This patch adds an implementation of __resize_default_init as
described in P1072R2. Additionally, it uses it in filesystem to
demonstrate its intended utility.

Once P1072 lands, or if it changes it's interface, I will adjust
the internal libc++ implementation to match.

llvm-svn: 347589
2018-11-26 20:15:38 +00:00
Louis Dionne 94104b1b6b [libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.

llvm-svn: 347585
2018-11-26 19:30:08 +00:00
Louis Dionne 7ae4f5c6de [libcxx] Fix XFAIL for aligned deallocation test with trunk Clang
The test was marked as failing whenever the deployment target was 10.12
or older, but in reality the test passes when the deployment target is
10.12 on recent Clangs. This happens because only older clangs do not
honor the -faligned-allocation flag, which disables any availability
error related to aligned allocation support, regardless of the
deployment target.

llvm-svn: 347580
2018-11-26 17:47:16 +00:00
Louis Dionne 20883fc20f [libcxx] Use a type that is always an aggregate in variant's tests
Summary:
In PR39232, we noticed that some variant tests started failing in C++2a mode
with recent Clangs, because the rules for literal types changed in C++2a. As
a result, a temporary fix was checked in (enabling the test only in C++17).

This commit is what I believe should be the long term fix: I removed the
tests that checked constexpr default-constructibility with a weird type
from the tests for index() and valueless_by_exception(), and instead I
added tests for those using an obviously literal type in the test for the
default constructor.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, arphaman, libcxx-commits, rsmith

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

llvm-svn: 347568
2018-11-26 16:14:56 +00:00
Louis Dionne 2d91d2a388 [NFC] Fix typo in comment
llvm-svn: 347477
2018-11-22 19:10:28 +00:00
Louis Dionne 3ffe0b75fb [libcxx] Reintroduce UNSUPPORTED annotation for strstreambuf overflow test
This is a revert of r347421, except I'm using the with_system_cxx_lib
lit feature instead of availability to mark the test as unsupported
(because the problem is a bug in the dylib itself). In r347421, I said
I wasn't able to reproduce the issue and that's why I was removing it:
this was because I ran lit slightly wrong. The problem mentioned really
exists.

llvm-svn: 347475
2018-11-22 17:43:22 +00:00
Louis Dionne 5b2605edc4 [libcxx] Add XFAIL for test on OS X 10.12 to 10.14
llvm-svn: 347473
2018-11-22 16:38:03 +00:00
Louis Dionne 509f7d7c30 [libcxx] Remove incorrect XFAIL on macos 10.12
llvm-svn: 347461
2018-11-22 13:40:56 +00:00
Louis Dionne 91614db033 [libcxx] Fix incorrect iterator type in vector container test
The iterator types for different specializations of containers with the
same element type but different allocators are not required to be
convertible. This patch makes the test to take the iterator type from
the same container specialization as the created container.

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

llvm-svn: 347423
2018-11-21 20:53:07 +00:00
Louis Dionne 94d4c9e094 [libcxx] Mark strstreams tests as being supported on all OS X versions
I wasn't able to reproduce the issue referred to by the comment using
the libc++'s shipped with mac OS X 10.7 and 10.8, so I assume this may
have been fixed in a function that is now shipped in the headers. In
that case, the tests will pass no matter what dylib we're using.

In the worst case, some test bots will start failing and I'll understand
why I was wrong, and I can create an actual lit feature for it. Note
that I could just leave this test alone, but this change is on the path
towards eradicating vendor-specific availability markup from the test
suite.

llvm-svn: 347421
2018-11-21 20:47:00 +00:00
Eric Fiselier 74fb163184 Fix missing includes in test header
llvm-svn: 347416
2018-11-21 20:39:24 +00:00
Zhihao Yuan 147b25b4a1 [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

llvm-svn: 347377
2018-11-21 03:30:10 +00:00
Louis Dionne 52118fcb46 [NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).

llvm-svn: 347367
2018-11-21 00:03:17 +00:00
Marshall Clow 289f1ce53e A couple of tests were broken when clang implemented the compiler parts of P0482 (support for char8_t). Comment out those bits until we implement the corresponding bits in libc++
llvm-svn: 347360
2018-11-20 22:55:40 +00:00
Marshall Clow 859bf40761 Mark P0771 as complete; we already did this - I just added tests to be sure
llvm-svn: 347343
2018-11-20 20:37:07 +00:00
Louis Dionne cc870190d8 [NFC][libcxx] Fix incorrect comments
llvm-svn: 347267
2018-11-19 22:06:42 +00:00
Louis Dionne 70c4858892 [libcxx] Fix XFAIL for GCC 4.9
The XFAIL started passing since we're only testing for trivial-copyability of
reference_wrapper in C++14 and above. This commit constrains the XFAIL to
gcc-4.9 with C++14 (it would also fail on C++17 and above, but those standards
are not available with GCC 4.9).

llvm-svn: 347264
2018-11-19 20:53:38 +00:00
Louis Dionne e0ac069286 [libcxx] Update test of trivial copyability of reference_wrapper
N4151 is not an extension anymore, it was standardized in C++14.

llvm-svn: 347263
2018-11-19 20:21:45 +00:00
Louis Dionne 85efcbe449 [libcxx] Fix incorrect #include for std::hash
Reviewed as https://reviews.llvm.org/D54705.
Thanks to Andrey Maksimov for the patch.

llvm-svn: 347233
2018-11-19 17:40:16 +00:00
Louis Dionne c019b30ac2 [libcxx] Add missing <cstddef> includes in tests
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
2018-11-19 17:39:50 +00:00
Louis Dionne 8a063df194 [libcxx] Add availability markup for bad_optional_access, bad_variant_access and bad_any_cast
Reviewers: dexonsmith, EricWF

Subscribers: christof, arphaman, libcxx-commits

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

llvm-svn: 347219
2018-11-19 15:37:04 +00:00
Louis Dionne 2fcdcac4ec [libcxx] Add missing includes in tests
A bunch of unordered containers tests call library functions but don't directly
include the corresponding header files:

- fabs() (defined in <cmath> which is not included);
- is_permutation() (defined in <algorithm> which is not included);
- next() (defined in <iterator> which is not included).
- As a result, these tests won't compile against some conformant libraries.

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

llvm-svn: 347085
2018-11-16 19:52:47 +00:00
Eric Fiselier ae533d31af Work around C++03 decltype limitations
llvm-svn: 346917
2018-11-15 00:27:06 +00:00
Eric Fiselier 22bdb33108 Get tests compiling with -Wunused-local-typedef
llvm-svn: 346914
2018-11-15 00:11:02 +00:00
Stephan T. Lavavej 1b19549b13 [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.
C++11's [hash.requirements] never required these typedefs from users.

llvm-svn: 346912
2018-11-14 23:23:55 +00:00
Stephan T. Lavavej 174072c1d2 [libcxx] [test] Include <cassert> for assert().
This fixes compiler errors with MSVC's STL.

llvm-svn: 346911
2018-11-14 23:23:51 +00:00
Stephan T. Lavavej 21981194eb [libcxx] [test] Fix MSVC warning C4800.
This was implicitly converting [1, 3] to bool, which triggers
an MSVC warning. The test should just pass `true`, which is
simpler, has the same behavior, and avoids the warning. (This
is a library test, not a compiler test, and the conversion happens
before calling `push_back`, so passing [1, 3] isn't interesting
in any way. This resembles a previous change to stop passing
`1 == 1` in the `vector<bool>` tests.)

llvm-svn: 346910
2018-11-14 23:23:46 +00:00
Eric Fiselier 336a1a6811 Rename cxx-benchmark-unittests target and convert to LIT.
This patch renames the cxx-benchmark-unittests to check-cxx-benchmarks
and converts the target to use LIT in order to make the tests run faster
and provide better output.

In particular this runs each benchmark in a suite one by one, allowing
more parallelism while ensuring output isn't garbage with multiple threads.

Additionally, it adds the CMake flag '-DLIBCXX_BENCHMARK_TEST_ARGS=<list>'
to specify what options are passed when running the benchmarks.

llvm-svn: 346888
2018-11-14 20:38:46 +00:00
Stephan T. Lavavej dec8905e13 [libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 346826
2018-11-14 03:06:06 +00:00
Marshall Clow cf355fc373 Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
llvm-svn: 346766
2018-11-13 17:22:41 +00:00
Louis Dionne 7272026993 [libcxx] Implement http://wg21.link/p1006, constexpr in pointer_traits
Summary:
P1006 adds support for constexpr in the specialization of pointer_traits
for raw pointers. This is necessary in order to use pointer_traits in
the upcoming constexpr containers. We expect P1006 to be voted into the
working draft for C++20 at the San Diego meeting.

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

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

llvm-svn: 346764
2018-11-13 17:04:05 +00:00
Eric Fiselier 32869c6997 Add emplace tests for multiset/unordered_multiset.
This patch adds tests to ensure that multiset/unordered_multiset's emplace
method correctly constructs the elements without any intervening
constructions.

llvm-svn: 346743
2018-11-13 06:30:36 +00:00
Marshall Clow d4fa0381e3 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
llvm-svn: 346738
2018-11-13 05:33:31 +00:00
Louis Dionne cdaf2b8dce [NFC] Reformat std::optional tests
llvm-svn: 346630
2018-11-12 01:38:30 +00:00
Dan Albert d5d06a0763 Fix test assumption that Linux implies glibc.
Summary:
This fixes an regression when using bionic introduced in r345173.

I need to follow up and figure out what exactly is implied by
TEST_HAS_C11_FEATURES and see what the correct configuration is for
bionic (new versions should have everything the tests care about,
versions that predate C11 certainly don't), but this gets the tests
back to the old behavior.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, christof, ldionne, libcxx-commits, cfe-commits

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

llvm-svn: 345900
2018-11-01 22:35:51 +00:00
Louis Dionne e0a724ef9c Revert "Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible."
This reverts r345525. I'm reverting because that patch apparently caused
a regression on certain platforms (see https://reviews.llvm.org/D53994).
Since we don't fully understand the reasons for the regression, I'm
reverting until we can provide a fix we understand.

llvm-svn: 345893
2018-11-01 21:24:32 +00:00
Louis Dionne 8df1d5a546 [libcxx] Fix usage of _C2, which is a "nasty macro" in some environments
The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775.

llvm-svn: 345834
2018-11-01 14:41:37 +00:00
Erik Pilkington 5c4e07ae5c Second half of C++17's splicing maps and sets
This commit adds a merge member function to all the map and set containers,
which splices nodes from the source container. This completes support for
P0083r3.

Differential revision: https://reviews.llvm.org/D48896

llvm-svn: 345744
2018-10-31 17:31:35 +00:00
Eric Fiselier 5d3c5ba7d5 XFAIL test on OS X availability
llvm-svn: 345529
2018-10-29 19:52:22 +00:00
Eric Fiselier 8c40d81d4f Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible.
Patch by Denis Yaroshevskiy (denis.yaroshevskij@gmail.com)

The rational and measurements can be found in the bug description: https://bugs.llvm.org/show_bug.cgi?id=39129

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

llvm-svn: 345525
2018-10-29 19:25:02 +00:00
Eric Fiselier e503a1c3b8 Fix PR39458 _LIBCPP_DEBUG breaks heterogeneous compare.
The types/comparators passed to std::upper_bound and std::lower_bound
are not required to provided to provide an operator</comp(...) which
accepts the arguments in reverse order. Nor are the ranges required
to have a strict weak ordering.

However, in debug mode we attempted to check the result of a comparison
with the arguments reversed, which may not compiler.

This patch removes the use of the debug comparator for upper_bound
and lower_bound.

equal_range et al still use debug comparators when they call
__upper_bound and __lower_bound.

See llvm.org/PR39458

llvm-svn: 345434
2018-10-26 22:54:46 +00:00
Eric Fiselier e2ec68e177 Work around gcc.gnu.org/PR87766
llvm-svn: 345425
2018-10-26 20:20:12 +00:00
Eric Fiselier b914eaf45f XFAIL sized deallocation test with GCC
llvm-svn: 345400
2018-10-26 16:37:11 +00:00
Marshall Clow 27e9fdb2ff Run the min/max tests agaist the header <charconv>. Fix that header so it passes. NFC.
llvm-svn: 345352
2018-10-26 01:00:56 +00:00
Eric Fiselier f25b75b91b Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

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

llvm-svn: 345281
2018-10-25 17:21:30 +00:00
Eric Christopher 9bbee38db3 Temporarily Revert "Implement sized deallocation for std::allocator and friends."
This is breaking the bots here (and related): http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-asan/builds/1428

This reverts commit r345214.

llvm-svn: 345239
2018-10-25 06:20:12 +00:00
Eric Fiselier 7e6448bb02 Implement sized deallocation for std::allocator and friends.
Summary:
C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own).

This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown.

On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem.

Reviewers: ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: rsmith, ckennelly, libcxx-commits, christof

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

llvm-svn: 345214
2018-10-24 22:44:01 +00:00
Petr Hosek 76ccec07b4 Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are"
This reverts commits r333103 and r333108. _Float16 and __fp16 are C11
extensions and compilers other than Clang don't define these for C++.

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

llvm-svn: 345199
2018-10-24 21:29:15 +00:00
Eric Fiselier 5efe8ec4cd Fix use of libc++ specific macro in support/test_macros.h
llvm-svn: 345173
2018-10-24 18:37:42 +00:00
Mikhail Maltsev b7e43df3c2 Adjust unsupported C++ versions in some tests
Summary:
Some tests (mainly the new C++20 calendar library) fail when libc++ is
tested with '--param=std=c++98'. The failures happen because the tests
actually don't support C++98, but don't mention C++98 in the
'UNSUPPORTED:' line.

This change fixes the issue.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: arphaman, michaelplatings, libcxx-commits

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

llvm-svn: 345148
2018-10-24 15:09:08 +00:00
Marshall Clow bb33992984 Mark the move construct/move assign tests as unsupported on C++03
llvm-svn: 345001
2018-10-23 05:22:09 +00:00
Marshall Clow 9b43581806 Add tests for match_results copy/move assignment operators. NFC
llvm-svn: 344998
2018-10-23 02:51:26 +00:00
Marshall Clow 157c0c561c Remove a 'const' from the synopsis. NFC
llvm-svn: 344997
2018-10-23 02:31:11 +00:00
Marshall Clow 0fb78041ec Add tests for match_results copy/move construction. NFC
llvm-svn: 344988
2018-10-23 01:27:47 +00:00
Marshall Clow 01cc58bfb0 Update commnents to reflect the changes for LWG#3127. NFC
llvm-svn: 344951
2018-10-22 20:49:50 +00:00
Marshall Clow 05fe329687 Update commnents to reflect the changes for LWG#3122. NFC
llvm-svn: 344950
2018-10-22 20:44:37 +00:00
Billy Robert O'Neal III 95cf9fa213 [libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX
The test is trying to avoid saying aligned_alloc on Windows' UCRT, which does not (and can not) implement aligned_alloc. However, it's testing for c1xx, meaning clang on Windows will fail this test when using the UCRT.

llvm-svn: 344829
2018-10-20 03:35:45 +00:00
Billy Robert O'Neal III 1fc51f29d7 [libcxx] [test] Add missing <stdexcept> to map at tests.
Reviewed as https://reviews.llvm.org/D50551

llvm-svn: 344821
2018-10-19 23:49:15 +00:00
Billy Robert O'Neal III e04704b9a9 Repair thread-unsafe modifications of n_alive in F.pass.cpp
In this example, the ctor of G runs in the main thread in the expression G(), and also in the copy ctor of G() in the DECAY_COPY inside std::thread. The main thread destroys the G() instance at the semicolon, and the started thread destroys the G() after it returns. Thus there is a race between the threads on the n_alive variable.

The fix is to join with the background thread before attempting to destroy the G in the main thread.

llvm-svn: 344820
2018-10-19 23:45:45 +00:00
Louis Dionne 1b22150f76 [libcxx] Mark chrono literal unit tests as being unsupported on AppleClang 10
llvm-svn: 344661
2018-10-17 00:34:13 +00:00
Marshall Clow 5b08c1742a Recommit <chrono> changes with a couple xtra tests marked to fail on apple's clang. Reviewed as D51762
llvm-svn: 344627
2018-10-16 17:27:54 +00:00
Artem Dergachev 08682bc277 Re-apply r344546 "Mark a couple of test cases as 'C++17-only'..."
Reverted too much in r344580.

llvm-svn: 344582
2018-10-16 03:36:55 +00:00
Artem Dergachev a9bc0face5 Revert r344529 "Implement the first part of the calendar support for C++20"
Revert r344535 "Wrap up the new chrono literals in an #ifdef..."
Revert r344546 "Mark a couple of test cases as 'C++17-only'..."

Some of the buildbot failures were masked by another error,
and this one was probably missed.

llvm-svn: 344580
2018-10-16 02:40:42 +00:00
Marshall Clow 5c61b9d0cf Mark a couple of test cases as 'C++17-only' pending the resolution of PR#39232
llvm-svn: 344546
2018-10-15 19:46:03 +00:00
Marshall Clow 323e01d46f Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1
llvm-svn: 344535
2018-10-15 17:33:20 +00:00
Marshall Clow 06ba9f5246 Implement the first part of the calendar support for C++20. This is still incomplete; there will be more patches coming. Reviewed as D51762
llvm-svn: 344529
2018-10-15 16:06:37 +00:00
Marshall Clow d850388710 One more local type warning removed from the tests. NFC
llvm-svn: 344421
2018-10-12 21:59:32 +00:00
Marshall Clow db49965a6b Update the array tests to not use a local type; removes warnings in C++03. NFC
llvm-svn: 344417
2018-10-12 21:24:44 +00:00
Marshall Clow 23145c6e08 Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
llvm-svn: 344416
2018-10-12 21:22:15 +00:00
Marshall Clow b198e58f67 Add a test that shows what happens with throwing destructors. NFC.
llvm-svn: 344220
2018-10-11 04:07:20 +00:00
Aaron Puchert 81d381bd7b Use TEST_STD_VER instead of __cplusplus [NFC]
While __cplusplus was only used a few dozen times, TEST_STD_VAR is used
more than 2000 times. So we replace the former by the latter for
consistency in the tests. There should be no functional change.

llvm-svn: 344194
2018-10-10 22:35:24 +00:00
Aaron Puchert 0e192395f1 Use std::scoped_lock only for C++17 and newer
This fixes a test failure caused by D53049.

llvm-svn: 344192
2018-10-10 22:05:33 +00:00
Eric Fiselier fca28db904 Add test macros for always_inline and noinline
llvm-svn: 344167
2018-10-10 18:22:23 +00:00
Aaron Puchert 7f208f02db Annotate scoped_lock as with scoped_lockable attribute
Summary:
Scoped capabilities need to be annotated as such, otherwise the thread
safety analysis won't work as intended.

Fixes PR39234.

Reviewers: ldionne

Reviewed By: ldionne

Subscribers: christof, libcxx-commits

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

llvm-svn: 344096
2018-10-09 23:42:29 +00:00
Louis Dionne 4ad751e5c3 [libcxx] Mark std::async race condition test as unsupported on Darwin
PR38682 added a test to check for a race condition in std::future.
Part of the fix is part of the dylib, but there is no released version
of mac OS X that ships a dylib containing the fix. Hence, this test can
(and sometimes does) when testing on OS X. This commit marks the test
as unsupported to avoid spurious failures.

llvm-svn: 344053
2018-10-09 14:57:40 +00:00
Eric Fiselier 356af2318d Mork more tests as FLAKY
llvm-svn: 343435
2018-10-01 01:43:42 +00:00
Eric Fiselier a2d2e43bef Fix threaded test under no-threading configuration
llvm-svn: 343432
2018-10-01 01:05:51 +00:00
Louis Dionne 255f376f6b [libcxx] Fix the binder deprecation tests on Clang 5.
Tested on Docker containers with Clang 4, 5 and 6.

llvm-svn: 342855
2018-09-23 23:17:48 +00:00
Louis Dionne 593b23f6a7 [libcxx] Fix buildbots on Debian
Debian build bots are running Clang 4, which apparently does not support
the "deprecated" attribute properly. Clang pretends to support the attribute,
but the attribute doesn't do anything.

(live example: https://wandbox.org/permlink/0De69aXns0t1D59r)

On a separate note, I'm not sure I understand why we're even running the
libc++ tests under Clang-4. Is this a configuration we support? I can
understand that libc++ should _build_ with Clang 4, but it's not clear
to me that new libc++ headers should be usable under older compilers
like that.

llvm-svn: 342854
2018-09-23 22:16:35 +00:00
Louis Dionne ea5cd3b476 [libc++] Add deprecated attributes to many deprecated components
Summary:
These deprecation warnings are opt-in: they are only enabled when the
_LIBCXX_DEPRECATION_WARNINGS macro is defined, which is not the case
by default. Note that this is a first step in the right direction, but
I wasn't able to get an exhaustive list of all deprecated components
per standard, so there's certainly stuff that's missing. The list of
components this commit marks as deprecated is:

in C++11:
- auto_ptr, auto_ptr_ref
- binder1st, binder2nd, bind1st(), bind2nd()
- pointer_to_unary_function, pointer_to_binary_function, ptr_fun()
- mem_fun_t, mem_fun1_t, const_mem_fun_t, const_mem_fun1_t, mem_fun()
- mem_fun_ref_t, mem_fun1_ref_t, const_mem_fun_ref_t, const_mem_fun1_ref_t, mem_fun_ref()

in C++14:
- random_shuffle()

in C++17:
- unary_negate, binary_negate, not1(), not2()

<rdar://problem/18168350>

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, llvm-commits

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

llvm-svn: 342843
2018-09-23 18:35:00 +00:00
Eric Fiselier a793b84d81 Mark [[nodiscard]] tests unsupported on GCC prior to 7.0
llvm-svn: 342821
2018-09-22 21:01:07 +00:00
Eric Fiselier 67e881d112 Fix UB in SIMD tests.
One of the SIMD tests attempted to left shift a value by 42, which
is UB when the left hand side is a 32 bit integer type.

This patch adjusts the test to use the value 4 instead of 42.

llvm-svn: 342820
2018-09-22 20:09:02 +00:00
Roman Lebedev 2f02863bf2 [libcxx] Readjust nodiscard_extensions.pass.cpp test - just disable for ASAN
In rL342814, i have committed a blind fix to unbreak the asan buildbot,
but as it was later discussed, the leak is intentional,
so we can not fix the failure that way.

So this reverts the leak 'fix',
and simply disables the test in the presence of ASAN.

llvm-svn: 342819
2018-09-22 20:07:02 +00:00
Eric Fiselier 76c83ea16d Mark test as flaky
llvm-svn: 342818
2018-09-22 20:03:47 +00:00
Roman Lebedev 931d66cd22 [libcxx] Blind attempt to fix harmless leak in nodiscard_extensions.pass.cpp test
libcxx-libcxxabi-x86_64-linux-ubuntu-asan complains about a leak here.

llvm-svn: 342814
2018-09-22 19:09:57 +00:00
Roman Lebedev c65d39a464 [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]]
Summary:
The `[[nodiscard]]` attribute is intended to help users find bugs where
function return values are ignored when they shouldn't be. After C++17 the
C++ standard has started to declared such library functions as `[[nodiscard]]`.
However, this application is limited and applies only to dialects after C++17.
Users who want help diagnosing misuses of STL functions may desire a more
liberal application of `[[nodiscard]]`.

For this reason libc++ provides an extension that does just that! The
extension must be enabled by defining `_LIBCPP_ENABLE_NODISCARD`. The extended
applications of `[[nodiscard]]` takes two forms:

1. Backporting `[[nodiscard]]` to entities declared as such by the
   standard in newer dialects, but not in the present one.

2. Extended applications of `[[nodiscard]]`, at the libraries discretion,
   applied to entities never declared as such by the standard.

Users may also opt-out of additional applications `[[nodiscard]]` using
additional macros.

Applications of the first form, which backport `[[nodiscard]]` from a newer
dialect may be disabled using macros specific to the dialect it was added. For
example `_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`.

Applications of the second form, which are pure extensions, may be disabled
by defining `_LIBCPP_DISABLE_NODISCARD_EXT`.

This patch was originally written by me (Roman Lebedev),
then but then reworked by Eric Fiselier.

Reviewers: mclow.lists, thakis, EricWF

Reviewed By: thakis, EricWF

Subscribers: llvm-commits, mclow.lists, lebedev.ri, EricWF, rjmccall, Quuxplusone, cfe-commits, christof

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

llvm-svn: 342808
2018-09-22 17:54:48 +00:00
Eric Fiselier 2d79835ccb Fix diagnostic regex in variant tests to tolerate older clang versions
llvm-svn: 342609
2018-09-20 01:15:17 +00:00
Volodymyr Sapsai 8d6ac8f689 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:

llvm-svn: 342599
2018-09-19 23:31:34 +00:00
Marshall Clow 4a71f9cfcc Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263
llvm-svn: 342566
2018-09-19 18:29:57 +00:00
Eric Fiselier 7dca3127c2 Don't require relops on variant alternatives to all return the same
type.

Libc++ correctly asserts that a set of visitors for a variant all
return the same type. However, we use the visitation machinary to
perform relational operations. This causes a static assertion when
some of the alternatives relops return a UDT which is implicitly
convertible to bool instead of 'bool' exactly.

llvm-svn: 342560
2018-09-19 17:53:21 +00:00
Marshall Clow 8ae45e0e59 Remove unused include of "verbose_assert.h"
llvm-svn: 342524
2018-09-19 02:27:44 +00:00
Marshall Clow 08ebf19e52 Mark LWG#3102 as complete. No code changes, but I updated a test or two
llvm-svn: 342103
2018-09-13 02:23:52 +00:00
Marshall Clow f56972e224 Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955
llvm-svn: 342073
2018-09-12 19:41:40 +00:00