Commit Graph

3079 Commits

Author SHA1 Message Date
Louis Dionne
e9a1ea42bf [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347475 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-22 17:43:22 +00:00
Louis Dionne
a0b648f164 [libcxx] Add XFAIL for test on OS X 10.12 to 10.14
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347473 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-22 16:38:03 +00:00
Louis Dionne
79132e8628 [libcxx] Remove incorrect XFAIL on macos 10.12
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347461 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-22 13:40:56 +00:00
Louis Dionne
5beaebf500 [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347423 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 20:53:07 +00:00
Louis Dionne
3ad8fb7ecd [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347421 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 20:47:00 +00:00
Eric Fiselier
bac4a9b67f Fix missing includes in test header
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347416 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 20:39:24 +00:00
Zhihao Yuan
580cde08e1 [libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)
Summary:
Avoid buffer overflow by replacing the pointer interface with an array reference interface in C++2a.
Tentatively ready on Batavia2018.

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

Reviewers: mclow.lists, ldionne, EricWF

Reviewed By: ldionne

Subscribers: libcxx-commits, cfe-commits, christof

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347377 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 03:30:10 +00:00
Louis Dionne
739fdd4850 [NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347367 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 00:03:17 +00:00
Marshall Clow
7c5126bcc4 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++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347360 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-20 22:55:40 +00:00
Marshall Clow
3b4ca5b4af Mark P0771 as complete; we already did this - I just added tests to be sure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347343 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-20 20:37:07 +00:00
Louis Dionne
98dc85caf6 [NFC][libcxx] Fix incorrect comments
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347267 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 22:06:42 +00:00
Louis Dionne
f9b79dcfc3 [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).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347264 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 20:53:38 +00:00
Louis Dionne
22507d63b6 [libcxx] Update test of trivial copyability of reference_wrapper
N4151 is not an extension anymore, it was standardized in C++14.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347263 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 20:21:45 +00:00
Louis Dionne
c8f785547c [libcxx] Fix incorrect #include for std::hash
Reviewed as https://reviews.llvm.org/D54705.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347233 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 17:40:16 +00:00
Louis Dionne
a320121c4c [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347232 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 17:39:50 +00:00
Louis Dionne
13b7f7b500 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347219 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-19 15:37:04 +00:00
Louis Dionne
20c43d22bb [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347085 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-16 19:52:47 +00:00
Eric Fiselier
09e56c1598 Work around C++03 decltype limitations
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346917 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-15 00:27:06 +00:00
Eric Fiselier
c2c6c1de6b Get tests compiling with -Wunused-local-typedef
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346914 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-15 00:11:02 +00:00
Stephan T. Lavavej
c6da5c57fe [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.
C++11's [hash.requirements] never required these typedefs from users.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346912 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:55 +00:00
Stephan T. Lavavej
5d11d6e664 [libcxx] [test] Include <cassert> for assert().
This fixes compiler errors with MSVC's STL.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346911 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:51 +00:00
Stephan T. Lavavej
5e97ad3674 [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.)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346910 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 23:23:46 +00:00
Eric Fiselier
b124ade497 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346888 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 20:38:46 +00:00
Stephan T. Lavavej
439de45011 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 03:06:06 +00:00
Marshall Clow
98d4ace735 Implement P0972R0: <chrono> zero(), min(), and max() should be noexcept. Reviewed as https://reviews.llvm.org/D53828
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346766 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 17:22:41 +00:00
Louis Dionne
52ddb5e2b8 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346764 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 17:04:05 +00:00
Eric Fiselier
16a8e7ec37 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 06:30:36 +00:00
Marshall Clow
3870a97d86 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 05:33:31 +00:00
Louis Dionne
e754a7a9d2 [NFC] Reformat std::optional tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346630 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-12 01:38:30 +00:00
Dan Albert
73d2eccc78 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345900 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 22:35:51 +00:00
Louis Dionne
5dc37768e2 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345893 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 21:24:32 +00:00
Louis Dionne
f10e0ac7b0 [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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345834 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01 14:41:37 +00:00
Erik Pilkington
71ac96a43b 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345744 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-31 17:31:35 +00:00
Eric Fiselier
3238cbf311 XFAIL test on OS X availability
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345529 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-29 19:52:22 +00:00
Eric Fiselier
207b919735 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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345525 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-29 19:25:02 +00:00
Eric Fiselier
293b83d6e6 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345434 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 22:54:46 +00:00
Eric Fiselier
924b8f34f6 Work around gcc.gnu.org/PR87766
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345425 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 20:20:12 +00:00
Eric Fiselier
6dcb34abc2 XFAIL sized deallocation test with GCC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345400 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 16:37:11 +00:00
Marshall Clow
5be216356b Run the min/max tests agaist the header <charconv>. Fix that header so it passes. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345352 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-26 01:00:56 +00:00
Eric Fiselier
e09f85bbe5 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345281 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25 17:21:30 +00:00
Eric Christopher
1b9ee84408 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345239 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-25 06:20:12 +00:00
Eric Fiselier
0cfdf55219 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345214 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 22:44:01 +00:00
Petr Hosek
842383f69c 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 21:29:15 +00:00
Eric Fiselier
005bb4c72c Fix use of libc++ specific macro in support/test_macros.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345173 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 18:37:42 +00:00
Mikhail Maltsev
0423faff95 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345148 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-24 15:09:08 +00:00
Marshall Clow
9678b5d267 Mark the move construct/move assign tests as unsupported on C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345001 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 05:22:09 +00:00
Marshall Clow
374084fce8 Add tests for match_results copy/move assignment operators. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344998 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 02:51:26 +00:00
Marshall Clow
268b4d01c2 Remove a 'const' from the synopsis. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344997 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 02:31:11 +00:00
Marshall Clow
a894ebb441 Add tests for match_results copy/move construction. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344988 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-23 01:27:47 +00:00
Marshall Clow
9110b80a63 Update commnents to reflect the changes for LWG#3127. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-22 20:49:50 +00:00