Commit Graph

5239 Commits

Author SHA1 Message Date
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 45b511fb05 Fix size_t/off_t mixup in std::filesystem.
Summary: ftruncate takes an off_t, not a size_t.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: christof, ldionne, libcxx-commits

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

llvm-svn: 351226
2019-01-15 19:16:25 +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
Hans Wennborg eb60fbfdb4 Update year in license files
In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

llvm-svn: 351194
2019-01-15 15:10:32 +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
Petr Hosek 2fefe153dd [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing
When catopen is missing, do_open, do_get and do_close end up being
no-op, and as such their parameters will be unused which triggers a
warning/error when building with -Wunused-parameter.

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

llvm-svn: 351027
2019-01-13 22:15:37 +00:00
Marshall Clow e495760140 Change from a to a . Fixes PR#39871.
llvm-svn: 350972
2019-01-11 21:57:12 +00:00
Adhemerval Zanella 63ea958521 [libcxx] Call __count_bool_true for bitset count
This patch aims to help clang with better information so it can inline
__bit_reference count function usage for both std::biset. Current clang
inliner can not infer that the passed typed will be used only to select
the optimized variant, it evaluates the type argument and type check as
a load plus compare (although later optimization phases correctly
optimized this out).

It is mainly to help llvm inliner to generate better code for std::bitset
count for aarch64. It helps on both runtime and code size, since if inline
decides that _VSTD::count should not be inlined the vectorization will
create both aligned and unaligned variants (which add both code size and
runtime costs)

llvm-svn: 350936
2019-01-11 17:31:17 +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
Louis Dionne 227371ded6 [libcxx] Add a script to run CI on older MacOS versions
This script can be used by CI systems to test things like availability
markup and binary compatibility on older MacOS versions. This is still
a bit rough on the edges, for example we don't test libc++abi yet.

llvm-svn: 350752
2019-01-09 19:40:20 +00:00
Louis Dionne cb4e59ed92 [libcxx] Add a script to run CI on MacOS
CI systems like Green Dragon should use this script so as to make
reproducing errors easy locally.

llvm-svn: 350740
2019-01-09 16:35:55 +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
Petr Hosek a2685cd6dc [libcxx] Support building hermetic static library
This is useful when static libc++ library is being linked into
shared libraries that may be used in combination with libraries.
We want to avoid we exporting libc++ symbols in those cases where
this option is useful. This is provided as a CMake option and can
be enabled by libc++ vendors as needed.

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

llvm-svn: 350489
2019-01-06 06:14:31 +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
Kamil Rytarowski 74b936ec98 Revert "D56064: More tolerance for flaky tests in libc++ on NetBSD"
Requested by EricWF.

llvm-svn: 350477
2019-01-05 20:11:54 +00:00
Marshall Clow 71c1680d2c De-tab a couple tests. NFC
llvm-svn: 350330
2019-01-03 17:18:40 +00:00
Kamil Rytarowski 2803bcf5b0 More tolerance for flaky tests in libc++ on NetBSD
Summary:
Tests marked with the flaky attribute ("FLAKY_TEST.")
can still report false positives in local tests and on the
NetBSD buildbot.

Additionally a number of tests (probably all threaded
ones) unmarked with the flaky attribute is flaky on
NetBSD.

An ideal solution on the libcxx side would be to raise
max retries for NetBSD and mark failing tests with
the flaky flag, however this adds more maintenance
burden and constant monitoring of flaky tests.

Reduce the work and handle flaky tests as more flaky
on NetBSD and allow flakiness  of other tests on
NetBSD.

Reviewers: mgorny, EricWF

Reviewed By: mgorny

Subscribers: christof, llvm-commits, libcxx-commits

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

llvm-svn: 350170
2018-12-30 23:05:14 +00:00
Louis Dionne 9f3561c292 [libcxx] Remove unused macro _LIBCPP_HAS_UNIQUE_TYPEINFO
Summary:
We already have the negation of that as _LIBCPP_HAS_NONUNIQUE_TYPEINFO.
Having both defined is confusing, since only one of them is used.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

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

llvm-svn: 349947
2018-12-21 20:14:43 +00:00
Louis Dionne 5517aa6172 [NFC] Fix typo in comment
llvm-svn: 349932
2018-12-21 17:32:23 +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 8c0c8e154b Don't forward declare _FilesystemClock in C++03
llvm-svn: 349887
2018-12-21 04:30:04 +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
Eric Fiselier 5763cbb426 Mark two filesystem LWG issues as complete - nothing to do
llvm-svn: 349877
2018-12-21 02:17:00 +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