3175 Commits

Author SHA1 Message Date
Richard Smith
7e5c56366a P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of is_invocable that would internally conjure up a deprecated function type.
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings.

Reviewers: mclow.lists, EricWF

Subscribers: christof, ldionne, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@375307 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-19 00:06:00 +00:00
Casey Carter
fb944628a6 [libc++][test] Use <version> to get config on MSVC
...instead of `<ciso646>`.

Also includes some NFC comment changes.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374854 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-15 00:22:38 +00:00
Casey Carter
5f31123bc7 [libc++][test] Portability fix for std::any tests
Ensure that `large_tracked_t` defined in `any_helpers.h` is in fact too large to fit in `std::any`'s small object buffer.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374806 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 19:05:04 +00:00
Casey Carter
cb623673dc [libc++][test] Add license headers to test/support/archetypes.*
Differential Revision: https://reviews.llvm.org/D68947

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374797 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 18:00:34 +00:00
Casey Carter
4fd9329d34 [libc++][test] Silence more warnings in variant tests
More cases of signed-to-unsigned conversion warnings that missed the train for d2623522.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374778 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-14 14:38:12 +00:00
Casey Carter
79d2a7134b [libc++][test] std::variant test cleanup
* Add the conventional `return 0` to `main` in `variant.assign/conv.pass.cpp` and `variant.ctor/conv.pass.cpp`

* Fix some MSVC signed-to-unsigned conversion warnings by replacing `int` literarls with `unsigned int` literals

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374723 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-13 16:46:16 +00:00
Casey Carter
6dc4120468 [libc++][test] <=> now has a feature-test macro
...which `test/support/test_macros.h` can use to detect compiler support.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374722 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-13 16:46:12 +00:00
Casey Carter
1f4cad9f28 [libc++][test] Silence MSVC warning in std::optional test
`make_optional<string>(4, 'X')` passes `4` (an `int`) as the first argument to `string`'s `(size_t, charT)` constructor, triggering a signed/unsigned mismatch warning when compiling with MSVC at `/W4`. The incredibly simple fix is to instead use an unsigned literal (`4u`).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374684 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-12 19:01:46 +00:00
Casey Carter
dda1e448f9 [libc++][test] Change IsSmallObject's calculation for std::any's small object buffer
`sizeof(std::any) - sizeof(void*)` is correct for both libc++ and the MSVC standard library.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374407 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-10 18:07:12 +00:00
Casey Carter
193f1880bd [libc++][test] Miscellaneous MSVC cleanups
* Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++.
* Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`.
* Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined.
* Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings.
* Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374248 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-09 22:19:17 +00:00
Sterling Augustine
09d641ffc2 Add an off-by-default option to enable testing for gdb pretty printers.
Summary:
The current version of the pretty printers are not python3 compatible,
so turn them off by default until sufficiently improved.

Reviewers: MaskRay, tamur

Subscribers: mgorny, christof, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@373796 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-04 22:15:28 +00:00
Fangrui Song
2b539adf22 Make libc++ gdb pretty printer Python 3 compatible
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@373691 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-04 04:47:33 +00:00
Fangrui Song
11a6f223fb Fix libc++ pretty printer test for Python 3 after D67238 (take 2)
In both Python 2 and Python 3, gdb.Value.string returns a 'str'. We just
need to delete a `encode("utf-8")` which would return a 'bytes' in
Python 3.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@373570 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-03 06:19:50 +00:00
Fangrui Song
d81b9578e5 Fix libc++ pretty printer test for Python 3 after D67238
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@373452 91177308-0d34-0410-b5e6-96231b3b80d8
2019-10-02 11:49:47 +00:00
Louis Dionne
9637883af0 [libc++] Take 2: Implement LWG 3158
Summary:
LWG 3158 marks the allocator_arg_t constructor of std::tuple as
conditionnally explicit based on whether the default constructors
of the tuple's members are explicitly default constructible.

This was previously committed as r372778 and reverted in r372832 due to
the commit breaking LLVM's build in C++14 mode. This issue has now been
addressed.

Reviewers: mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@373092 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-27 15:06:52 +00:00
Louis Dionne
00f026a08c [libc++] Take 2: Implement LWG 2510
Summary:
LWG2510 makes tag types like allocator_arg_t explicitly default
constructible instead of implicitly default constructible. It also
makes the constructors for std::pair and std::tuple conditionally
explicit based on the explicit-ness of the default constructibility
for the pair/tuple's elements.

This was previously committed as r372777 and reverted in r372832 due to
the commit breaking LLVM's build in C++14 mode. This issue has now been
addressed.

Reviewers: mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372983 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-26 14:51:10 +00:00
David Zarzycki
b0651b603e [libcxx] Do not implicitly #include assert.h
Users should only get the assert() macros if they explicitly include
them.

Found after switching from the GNU C++ stdlib to the LLVM C++ stdlib.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372963 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-26 11:12:29 +00:00
Louis Dionne
172204fa13 [libc++] Purge mentions of GCC 4 from the test suite
We don't support GCC 4 and older according to the documentation, so
we should pretend it doesn't exist.

This is a re-application of r372787.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372916 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 19:40:48 +00:00
Eric Fiselier
5265e271ed Add forward declaration of operator<< in <string_view> as required.
This declaration was previously missing despite appearing in the
synopsis. Users are still required to include <ostream> to get the
definition of the streaming operator.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372909 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 18:56:54 +00:00
Eric Fiselier
38930647ce add tests that debug mode catches nullptr->string_view conversions in comparison operators
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372907 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 18:43:40 +00:00
Marshall Clow
56448456d8 Add a missing default parameter to regex::assign. This is LWG3296; reviewed as https://reviews.llvm.org/D67944
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372896 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 16:40:30 +00:00
Ilya Biryukov
29a4eab8c5 Revert r372777: [libc++] Implement LWG 2510 and its follow-ups
This also reverts:
 - r372778: [libc++] Implement LWG 3158
 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older
 - r372787: Purge mentions of GCC 4 from the test suite

Reason: the change breaks compilation of LLVM with libc++, for details see
http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372832 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-25 09:10:38 +00:00
Louis Dionne
1ee6c64cc8 [libc++] Purge mentions of GCC 4 from the test suite
We don't support GCC 4 and older according to the documentation, so
we should pretend it doesn't exist.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372787 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 22:42:36 +00:00
Louis Dionne
afa5393dd5 [libc++] Try fixing tests that fail on GCC 5 and older
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372782 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 22:13:17 +00:00
Zoe Carver
fdf768205a [libc++] Remove C++03 variadics in shared_ptr
Summary: As suggested by @ldionne in D66178, this patch removes C++03 variadics //only//. Following patches will apply more updates.

    Reviewers: ldionne, EricWF, mclow.lists

    Subscribers: christof, dexonsmith, libcxx-commits, ldionne

    Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372780 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 20:55:54 +00:00
Louis Dionne
8bcf92aad2 [libc++] Implement LWG 3158
Summary:
LWG 3158 marks the allocator_arg_t constructor of std::tuple as
conditionnally explicit based on whether the default constructors
of the tuple's members are explicitly default constructible.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372778 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 20:22:34 +00:00
Louis Dionne
3d85029503 [libc++] Implement LWG 2510
Summary:
LWG2510 makes tag types like allocator_arg_t explicitly default
constructible instead of implicitly default constructible. It also
makes the constructors for std::pair and std::tuple conditionally
explicit based on the explicit-ness of the default constructibility
for the pair/tuple's elements.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372777 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-24 20:18:54 +00:00
Louis Dionne
239c70ec62 [libc++] Mark CTAD tests as not failing on AppleClang 10.0.1
They do fail on AppleClang 10.0.0, but not AppleClang 10.0.1

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372632 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-23 17:22:13 +00:00
Louis Dionne
a57e4bf8e8 [libc++] Mark iostreams test as XFAIL on older macOSes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372620 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-23 15:40:47 +00:00
Marshall Clow
70a91436c2 Revert "Extension: Mark the default constructor of chrono::duration as conditionally noexcept"; this breaks the gcc5 bot for C++11
This reverts commit c8ca15c95c4c0d6d1356500d5fe49a319ea4ca01.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372546 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-23 06:16:41 +00:00
Marshall Clow
95436dd8cf Extension: Mark the default constructor of chrono::duration as conditionally noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372539 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-23 04:16:48 +00:00
Dan Albert
a4ccec7e8e Revert "Revert "Implement std::condition_variable via pthread_cond_clockwait() where available""
With the fix for non-Linux.

This reverts commit c1c519d2f1a66dd2eeaa4c321d8d7b50f623eb71.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372242 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-18 18:13:32 +00:00
Dan Albert
77ce2c648e Revert "Implement std::condition_variable via pthread_cond_clockwait() where available"
This reverts commit 5e37d7f9ff257ec62d733d3d94b11f03e0fe51ca.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372034 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-16 21:20:32 +00:00
Dan Albert
74a9c964df Implement std::condition_variable via pthread_cond_clockwait() where available
std::condition_variable is currently implemented via
pthread_cond_timedwait() on systems that use pthread. This is
problematic, since that function waits by default on CLOCK_REALTIME
and libc++ does not provide any mechanism to change from this
default.

Due to this, regardless of if condition_variable::wait_until() is
called with a chrono::system_clock or chrono::steady_clock parameter,
condition_variable::wait_until() will wait using CLOCK_REALTIME. This
is not accurate to the C++ standard as calling
condition_variable::wait_until() with a chrono::steady_clock parameter
should use CLOCK_MONOTONIC.

This is particularly problematic because CLOCK_REALTIME is a bad
choice as it is subject to discontinuous time adjustments, that may
cause condition_variable::wait_until() to immediately timeout or wait
indefinitely.

This change fixes this issue with a new POSIX function,
pthread_cond_clockwait() proposed on
http://austingroupbugs.net/view.php?id=1216. The new function is
similar to pthread_cond_timedwait() with the addition of a clock
parameter that allows it to wait using either CLOCK_REALTIME or
CLOCK_MONOTONIC, thus allowing condition_variable::wait_until() to
wait using CLOCK_REALTIME for chrono::system_clock and CLOCK_MONOTONIC
for chrono::steady_clock.

pthread_cond_clockwait() is implemented in glibc (2.30 and later) and
Android's bionic (Android API version 30 and later).

This change additionally makes wait_for() and wait_until() with clocks
other than chrono::system_clock use CLOCK_MONOTONIC.<Paste>

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372016 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-16 17:57:48 +00:00
Eric Fiselier
4428baf8bd Add debug check for null pointers passed to <string_view>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371925 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-14 19:55:28 +00:00
Eric Fiselier
539921b79e Mark [[nodiscard]] test as unsupported with GCC 5
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371886 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 19:09:29 +00:00
Eric Fiselier
2612dbb394 Fix pretty printer test with GCC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371884 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 19:04:33 +00:00
Eric Fiselier
c69c68298a Fix various test failures with GCC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371880 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 18:40:46 +00:00
Eric Fiselier
0bed487070 Fix failing negative compilation test for some versions of Clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371874 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 17:39:06 +00:00
Eric Fiselier
45a3109dbb Recommit r370502: Make vector unconditionally move elements when
exceptions are disabled.

The patch was reverted due to some confusion about non-movable types. ie
types
that explicitly delete their move constructors. However, such types do
not meet
the requirement for `MoveConstructible`, which is required by
`std::vector`:

Summary:

`std::vector<T>` is free choose between using copy or move operations
when it
needs to resize. The standard only candidates that the correct exception
safety
guarantees are provided. When exceptions are disabled these guarantees
are
trivially satisfied. Meaning vector is free to optimize it's
implementation by
moving instead of copying.

This patch makes `std::vector` unconditionally move elements when
exceptions are
disabled. This optimization is conforming according to the current
standard wording.

There are concerns that moving in `-fno-noexceptions`mode will be a
surprise to
users. For example, a user may be surprised to find their code is slower
with
exceptions enabled than it is disabled. I'm sympathetic to this
surprised, but
I don't think it should block this optimization.

Reviewers: mclow.lists, ldionne, rsmith
Reviewed By: ldionne
Subscribers: zoecarver, christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D62228

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371867 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 16:09:33 +00:00
Marshall Clow
dbc7f4efd2 Only initialize the streams cout/wcout/cerr/wcerr etc once, rather than any time Init::Init is called. Fixes PR#43300
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371864 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-13 15:28:06 +00:00
Sterling Augustine
a0b20c4c30 Add gdb pretty printers for a wide variety of libc++ data structures (take 2).
Summary:
This patch is an exact duplicate of https://reviews.llvm.org/D65609, except
that it uses the newly introduced testing framework to detect if gdb is present
so that the tests won't fail on machines without gdb.

Reviewers: echristo, EricWF

Subscribers: christof, ldionne, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371131 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 21:35:05 +00:00
Vedant Kumar
8b2db26471 [libcxx] Codesign test executables if necessary
If LLVM_CODESIGNING_IDENTITY is set, test executables need to be
codesigned.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371126 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 21:24:23 +00:00
Sterling Augustine
39bc9e010c Add testing infrastructure to check if gdb is available for testing.
Reviewers: echristo, EricWF

Subscribers: mgorny, christof, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371120 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 20:44:08 +00:00
Louis Dionne
ffced82bd0 [libc++] Revert "Make vector unconditionally move elements when exceptions are disabled."
This reverts r370502, which broke the use case of a copy-only T (with a
deleted move constructor) when exceptions are disabled. Until we figure
out the right behavior, I'm reverting the commit.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371068 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 13:50:28 +00:00
Louis Dionne
7de36b7778 [libc++] Add a test for resizing of a vector with copy-only elements
See https://reviews.llvm.org/D62228#1658620

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@371067 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-05 13:50:18 +00:00
Louis Dionne
87e6185621 [libc++] Move __clamp_to_integral to <cmath>, and harden against min()/max() macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370900 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 13:35:03 +00:00
Louis Dionne
c9ac8d5330 [libc++] Add __truncating_cast for safely casting float types to integers
This is needed anytime we need to clamp an arbitrary floating point
value to an integer type.

Thanks to Eric Fiselier for the patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370891 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-04 12:48:32 +00:00
Sterling Augustine
1cdafefbbc Revert "Add gdb pretty printers for a wide variety of libc++ data structures."
This reverts commit d8c9f2f572fe06a34ccfc28ee9223b64d7d275d3.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370553 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-31 00:00:34 +00:00
Sterling Augustine
025042504e Add gdb pretty printers for a wide variety of libc++ data structures.
Summary: Also add a test suite.

Reviewers: EricWF

Subscribers: christof, llvm-commits

Tags: #llvm

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

Run a pep8 formatter.

Run pep8 formatter.

Convert to PEP8, address other comments from code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370551 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-30 23:43:34 +00:00