Commit Graph

3079 Commits

Author SHA1 Message Date
Chandler Carruth
9daab637c1 Update generator script to use the new license file header.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351650 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 11:38:40 +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
Chandler Carruth
4abbf7dac3 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Eric Fiselier
14072788a3 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351625 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 03:27:05 +00:00
Eric Fiselier
89e287b0ae correct script name in generated tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 05:43:02 +00:00
Eric Fiselier
455f16a829 Attempt to make test_macros.h even more minimal
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351292 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 02:16:57 +00:00
Eric Fiselier
8290a8d271 Fix feature test macros for atomics/mutexes without threading
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351291 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 02:10:28 +00:00
Eric Fiselier
6840e5476e 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351290 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 01:54:34 +00:00
Eric Fiselier
272871b658 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351289 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 01:51:12 +00:00
Eric Fiselier
a8b9f59e8c 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351286 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 01:37:43 +00:00
Dan Albert
ae62476eac 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351225 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 19:14:15 +00:00
Petr Hosek
b7b2997a4a [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351220 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 18:55:55 +00:00
Casey Carter
9e69b7db4d [test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351148 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 01:53:12 +00:00
Marshall Clow
65c8c4faa6 Generalize the comparison test structure to support cross-type comparisons. NFC to the library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351140 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 00:05:05 +00:00
Marshall Clow
749373168d Change from a to a . Fixes PR#39871.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350972 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-11 21:57:12 +00:00
Marshall Clow
ef48e7bcce Don't use the form '2017y' in tests, since some gcc versions don't allow it
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350930 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-11 15:45:56 +00:00
Marshall Clow
8d42566e70 Implement the 'sys_time' portions of the C++20 calendaring stuff. Reviewed as D56494
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350929 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-11 15:12:04 +00:00
Louis Dionne
134a848236 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350884 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-10 20:06:11 +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
a131ebfcaf [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]

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350772 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 23:20:24 +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
350f501ab7 Mark two UDL tests as being unsupported with Clang 7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350739 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 16:34:17 +00:00
Louis Dionne
ee53ced93e [libcxx] Remove outdated XFAILs for aligned deallocation
AppleClang 10 has been fixed and so these tests don't fail anymore.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350736 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 16:13:04 +00:00
Eric Fiselier
cd72c52980 Mark two more tests as FLAKY
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350692 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-09 05:48:54 +00:00
Louis Dionne
ed1d77ad35 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350649 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 20:26:56 +00:00
Marshall Clow
11a8815e5a 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350603 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 02:48:45 +00:00
Volodymyr Sapsai
354589c472 [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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350583 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08 00:03:16 +00:00
Eric Fiselier
4626eac620 Mark more tests as flaky
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350550 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 18:21:18 +00:00
Marshall Clow
a9c67b27fa Add the feature test macros that were defined in p1353r0 to the headers of the appropriate tests. No actual tests yet, so NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350535 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 16:17:52 +00:00
Eric Fiselier
6420803549 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350485 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-06 00:37:31 +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
Marshall Clow
7de83dce41 De-tab a couple tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350330 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-03 17:18:40 +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
fdb4802a74 Fix copy paste error in file_clock tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349886 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 04:27:45 +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
874280d14d 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349883 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-21 03:54:57 +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
Louis Dionne
8daffdabc5 [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349780 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-20 17:55:31 +00:00
Volodymyr Sapsai
d805c8746a [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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349676 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 20:08:43 +00:00
Eric Fiselier
1e048a3c69 Work around GCC 9.0 regression
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349663 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 18:58:22 +00:00
Marshall Clow
ff04a5678c Add missing include to test. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349639 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-19 16:39:04 +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
Marshall Clow
3af9c5fa77 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349522 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 19:07:30 +00:00
Louis Dionne
6ad953652d [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349484 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 13:46:28 +00:00
Louis Dionne
b8811ad2ca [libcxx] Handle AppleClang 9 and 10 in XFAILs for aligned allocation tests
I forgot that those don't behave like Clang trunk, again.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349427 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 00:42:09 +00:00
Louis Dionne
3d4bcc1de6 [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`.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349426 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18 00:30:15 +00:00
Eric Fiselier
dfa283e2cf Fix FP comparisons when SSE isn't available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349387 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 20:17:43 +00:00
Michal Gorny
4b8645f0dc [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349379 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 19:14:08 +00:00
Michal Gorny
c88aa7fa75 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349378 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 19:13:41 +00:00