Commit Graph

9013 Commits

Author SHA1 Message Date
Arthur O'Dwyer fbcd5236af [libc++] [ranges] Fix `decltype(auto) ranges::iter_move`.
See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92894#c3
https://reviews.llvm.org/D119589#inline-1151299

Differential Revision: https://reviews.llvm.org/D120417
2022-03-07 13:31:16 -05:00
Arthur O'Dwyer 34206b869d [libc++] Overhaul std::quoted; fix its relationship to character traits.
Move `__quoted_output_proxy` into the one file that uses it.

A `const char*` has no associated traits class, so `std::quoted("literal")`
should be printable into any basic_ostream regardless of traits.

Use hidden-friend `operator<<` and `operator>>`, since we're permitted to.
(The exact signature is unspecified because the class itself is unspecified.)

We shouldn't support `std::quoted("literal")` in C++03 or C++11 mode.
(We do need `std::__quoted(s)` and `std::__quoted(cs)` in C++11 mode,
because they're used by `std::__fs::filesystem::path`.)

Differential Revision: https://reviews.llvm.org/D120135
2022-03-07 13:28:58 -05:00
Arthur O'Dwyer 1c6e752cfc [libc++] Better handling for zero-sized types.
Zero-sized types are a GCC extension, also supported by Clang.
In theory it's already invalid to `delete` a void pointer or a
pointer-to-incomplete, so we shouldn't need any special code
to catch those cases; but in practice Clang accepts both
constructs with just a warning, and GCC even accepts `sizeof(void)`
with just a warning! So we must keep the static_asserts.
The hard errors are tested in `unique_ptr_dltr_dflt/*.compile.fail.cpp`.

In ranges::begin/end, check `sizeof >= 0` instead of `sizeof != 0`,
so as to permit zero-sized types while still disallowing incomplete
types.

Fixes #54100.

Differential Revision: https://reviews.llvm.org/D120633
2022-03-07 11:50:00 -05:00
Nikolas Klauser 205557c908 [libc++][ranges] Implement ranges::max_element
Implement ranges::max_element

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D117523
2022-03-07 17:11:23 +01:00
Louis Dionne 27fe8605a8 [libc++][NFC] Improve release note formatting 2022-03-07 10:26:38 -05:00
Louis Dionne 7ab4fe1122 [libc++][NFC] Add missing whitespace in release notes 2022-03-07 09:00:21 -05:00
Louis Dionne 311ff39178 [libc++] Add missing header <cuchar>
Fixes llvm-project#44216

Differential Revision: https://reviews.llvm.org/D97870
2022-03-07 08:48:50 -05:00
Kai Luo 86478c7ad8 [libcxx][atomic] Remove workaround for PR31864
I believe the origin issue in PR31864 has been addressed by https://reviews.llvm.org/D59566.

As discussed in https://github.com/llvm/llvm-project/issues/53840, `ATOMIC_LLONG_LOCK_FREE == 2` sometimes is not consistent with `std::atomic<long long>::is_always_lock_free`, since the macro takes `long long`'s ABI alignment into account. https://reviews.llvm.org/D28213 proposed we should not rely on ABI alignment of types, thus we have consistent `ATOMIC_LLONG_LOCK_FREE` and `std::atomic<long long>::is_always_lock_free` on x86's old cpu. Currently, I plan to move on to remove the workaround which should have been addressed and don't want to break current tests.

Reviewed By: #libc, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119931
2022-03-06 00:56:32 +00:00
Nikolas Klauser 52915d78f4 [libc++] Granularize <utility> includes
Reviewed By: ldionne, #libc

Spies: EricWF, libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D120466
2022-03-05 19:31:46 +01:00
Nikolas Klauser 9b03c08e85 [libc++] Don't warn that coroutines aren't supported when including <experimental/coroutine>
This change makes the behavior of `<experimental/coroutine>` consistent with other headers that only work conditionally.

Reviewed By: ldionne, #libc

Spies: Mordante, ChuanqiXu, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D119964
2022-03-05 19:01:49 +01:00
Arthur O'Dwyer 988dae653f [libc++] Add _LIBCPP_HIDE_FROM_ABI to __quoted_proxy ctors.
ldionne says this looks right to him, too.

Reviewed as part of D120135.
2022-03-04 23:06:28 -05:00
Arthur O'Dwyer 9d93b97222 [libc++] [NFC] Formatting preliminary to D120135 (std::quoted)
This just gets some of the non-functional formatting out of the way
before the meat of D120135.
2022-03-04 23:06:28 -05:00
Arthur O'Dwyer 564c7fa1b7 [libc++] ADL-proof calls to __quoted and noskipws.
Reviewed as part of D120135.
2022-03-04 23:06:28 -05:00
Martin Storsjö 45415ef91b [libcxx] Fix the ctype `is` (pointer version) function for Windows
Previously, this test snippet would report incorrect information:

    F::mask m;
    std::wstring in(L"\u00DA"); // LATIN CAPITAL LETTER U WITH ACUTE
    f.is(in.data(), in.data() + 1, &m);
    // m & F::lower would be set

The single-character version of the `is` function wasn't
affected by this issue though.

Define `_LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA` for Windows,
as the `alpha` / `_ALPHA` constant is a mask consisting of
multiple bits set, which avoids setting `alpha` whenver any
of the bits is set, in the `do_is` implementation.

On Windows, with the "C" locale, wchars are classified according
to their Unicode interpretation, just as in the en_US.UTF-8 locale on
all platforms.

Due to the differing classification of some characters, the
`scan_is` and `scan_not` tests are quite annoying to fix, thus just
ifdef out some of the tests for the "C" locale there - the code gets
tested with the more standard en_US.UTF-8 locale anyway.

Differential Revision: https://reviews.llvm.org/D120796
2022-03-05 00:47:19 +02:00
Arthur O'Dwyer 3347e7d40f [libc++] [LWG3656] Update the return type of std::bit_width.
Fixes LWG3656, "Inconsistent bit operations returning a count".
https://cplusplus.github.io/LWG/issue3656

The fix has been approved for C++23 and left to vendors' discretion
in C++20 (but it sounds like everyone's on the same page that
of course it should be DR'ed back to C++20 too).

Differential Revision: https://reviews.llvm.org/D120444
2022-03-04 17:31:09 -05:00
Arthur O'Dwyer 7e1355eb13 [libc++] Mark __wrap_iter's private constructors as explicit.
This is slightly more user-visible than D119894, because the user is
expected to touch `__wrap_iter` directly. But the affected ctors are
non-public, so the user was never expected to be actually calling them.
And I didn't intentionally omit this from D119894; I just didn't
think of it.

Differential Revision: https://reviews.llvm.org/D120937
2022-03-04 13:24:38 -05:00
Louis Dionne 9fee527eca [runtimes] Trigger CI jobs when only the runtimes/ subdirectory is touched 2022-03-04 10:59:27 -05:00
Martin Storsjö b2d93400a9 [libcxx] [test] Fix get_string_en_US, get_long_double_en_US for Windows
In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".

Differential Revision: https://reviews.llvm.org/D120799
2022-03-04 10:18:07 +02:00
Martin Storsjö d32f46b076 [libcxx] [test] Fix the get/put long_double_zh_CN tests on Windows
Differential Revision: https://reviews.llvm.org/D120889
2022-03-04 10:17:44 +02:00
Mark de Wever 5f26d8636f [libc++] Removes base member from tests.
Change the tests to use the base friend function instead of members.
Also changed some types to have a base friends instead of members.

Reviewed By: #libc, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D120742
2022-03-03 21:46:04 +01:00
Nikolas Klauser 569d0cc46d [libc++] Remove _LIBCXX_MODULES_BUILD and ext/ headers from header tests
Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D120896
2022-03-03 19:53:23 +01:00
Louis Dionne 61f2b3ed21 [libc++] Move several defines to ADDITIONAL_COMPILE_FLAGS in the test suite
This avoids -Wmacro-redefined when turning warnings on with GCC.
2022-03-03 13:17:35 -05:00
Louis Dionne 863802ecf3 [libc++] Move .fail.cpp test to .verify.cpp 2022-03-03 13:17:35 -05:00
Ruslan Arutyunyan 41a62cc0b4 [libcxx][test][NFC] Add tests for constructors of unordered [multi]map since C++14
Add tests for C++14 constructors in unordered_map and unordered_multimap

unordered_[multi]map(size_type sz, const allocator_type& alloc);
unordered_[multi]map(size_type sz, const hasher& hash, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]map(InputIt first, InputIt last, size_type sz, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]map(InputIt first, InputIt last, size_type sz, const hasher& hash, const allocator_type& alloc);

unordered_[multi]map(initializer_list<value_type> init, size_type sz, const allocator_type& alloc);
unordered_[multi]map(initializer_list<value_type> init, size_type sz, const hasher& hash, const allocator_type& alloc);

Reviewed By: ldionne, rarutyun, #libc

Differential Revision: https://reviews.llvm.org/D119236
2022-03-03 19:17:18 +03:00
Jake Egan 3e87719177 [libc++] Fix initialization of __fill_
`basic_ios` delays initialization of `__fill_` to `widen(' ')` until `fill()` is called. But, `fill(char_type)` is missing this logic, so the fill character does not get initialized to whitespace if `fill(char_type)` is called first. This patch adds this logic to `fill(char_type)`.

Reviewed By: #libc, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D120751
2022-03-03 09:28:49 -05:00
Nikolas Klauser bd44174547 [libc++] Use -I instead of -isystem to include headers in the test suite
Using -isystem marks the headers as system headers, which means that we
don't actually get all the warnings that we'd normally get if we included
the headers as user headers.

The goal of the test suite is normally to mirror as closely as possible
how users would use the library. Technically, this change goes against
that philosophy, since users should be using `-isystem` (if they ever
need to specify the libc++ path explicitly, which should be a rare
occurence). However, I believe fishing out additional warnings from
the headers provides more value, hence this change. Ideally, we'd be
able to still use `-isystem`, but instruct Clang to still emit warnings
from the libc++ headers (e.g. we could tell Clang to emit warnings in
any file inside `<...>/usr/include/c++/v1`).

Reviewed By: #libc, ldionne, #libc_abi

Spies: Mordante, EricWF, mstorsjo, mgorny, aheejin, arichardson, philnik, jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D118616
2022-03-03 13:19:47 +01:00
Ruslan Arutyunyan 6cefc30a7f [libcxx][test][NFC] Add tests for C++14 constructors of unordered sets
Add tests for C++14 constructors in unordered_set and unordered_multiset:

unordered_[multi]set(size_type sz, const allocator_type& alloc);
unordered_[multi]set(size_type sz, const hasher& hash, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]set(InputIt first, InputIt last, size_type sz, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]set(InputIt first, InputIt last, size_type sz, const hasher& hash, const allocator_type& alloc);

unordered_[multi]set(initializer_list<value_type> init, size_type sz, const allocator_type& alloc);
unordered_[multi]set(initializer_list<value_type> init, size_type sz, const hasher& hash, const allocator_type& alloc);

Reviewed By: ldionne, Quuxplusone, rarutyun, #libc

Differential Revision: https://reviews.llvm.org/D119243
2022-03-03 15:15:03 +03:00
Martin Storsjö 9e2236fb7b Reapply [lit] Read command stdout/stderr as text on Windows
This takes care of normalizing newlines back to single LF instead
of CRLF.

Fix up a couple tests that accidentally pass binary data to stdout.

Differential Revision: https://reviews.llvm.org/D120623
2022-03-03 13:31:31 +02:00
Martin Storsjö df1e43c496 [libcxx] [test] Fix get/put long_double_ru_RU on Glibc, FreeBSD and Windows
Note, reducing ios.width() in put_long_double instead of using variable
padding, when using a variable width symbol. Some of those tests didn't
actually trigger any padding in the existing form, with a longer
currency symbol; reduce the width so there's no actual padding with the
slightly shorter currency symbol either.

The tests for the international currency symbol use the same amount of
padding on all platforms, so they still exercise the padding properly.

Differential Revision: https://reviews.llvm.org/D120317
2022-03-03 13:30:59 +02:00
Martin Storsjö 77fd54d2eb [libcxx] [test] Fix the collate compare test for Glibc, Windows and FreeBSD
The old expected behaviour was specific to Apple platforms,
while Glibc, Windows and FreeBSD collate differently (ignoring
case). Make the old tested behaviour a special case for Apple
platforms, and make the default case the one used by the other
three.

In clang-cl/DLL configurations, the test is hit by
https://llvm.org/PR41018 (making the test fail to link).

Differential Revision: https://reviews.llvm.org/D120797
2022-03-03 10:09:24 +02:00
Arthur O'Dwyer dc1c67624b [libc++] Preliminary cleanups to ranges::iter_move. NFC.
This is just getting some non-functional cleanups out of the way
prior to the meat of the change in D120417.
2022-03-02 17:51:17 -05:00
Martin Storsjö 142501117a [libcxx] [test] Fix en_US money locale formatting tests on Windows
In the en_US locale on Windows, negative currency amounts is formatted
as "($0.01)" instead of "-$0.01".

Adjust the test references accordingly, making these tests pass.

Differential Revision: https://reviews.llvm.org/D120798
2022-03-02 23:24:37 +02:00
Nikolas Klauser b324798fc8 [libc++] Check clang-tidy version
Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D120087
2022-03-02 18:42:04 +01:00
Arthur O'Dwyer e0e7bd15b9 [libc++] Add missing std:: qualification to __synth_three_way.
This might be unobservable, since __synth_three_way is only ever
called as a result of using an (ADL) operator on std::pair or std::tuple.
2022-03-02 12:15:19 -05:00
Arthur O'Dwyer 7624552ead [libc++] Explicitly reject URNG types with signed result_types.
Fixes #48965.

Differential Revision: https://reviews.llvm.org/D120630
2022-03-02 10:28:48 -05:00
Martin Storsjö ea4c198a0f [libcxx] [test] Make filesystem tests not rely on libc++ internals
As part of https://reviews.llvm.org/D119036
(506cf6dc04), `-DNOMINMAX` was
dropped from the Windows CI configurations, replaced with a
block with `_LIBCPP_PUSH_MACROS`, `#include <__undef_macros>`
and `_LIBCPP_POP_MACROS` (and
`ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX` left in two tests).

However, this workaround breaks the running the libc++ tests
against a different C++ standard library than libc++, as those
macros and that header are libc++ internals.

Therefore, reinstate `-DNOMINMAX` for clang-cl configurations
and remove the libc++ specific bits in filesystem_test_helper.h.

Differential Revision: https://reviews.llvm.org/D120478
2022-03-02 10:39:14 +02:00
Martin Storsjö 736c6e246f [libcxx] [test] Place output from newconfig tests under a 'test' subdir
Previously, all the output from the tests were placed directly in
the build directory. The tests produce a couple directories named
`__config_{exec,cache,src}__` which are easy to distinguish, but
the output from the individual tests are placed in subdirectories
named `std` or `libcxx`. Especially the build output from libcxx
tests ends up conflated in the same directories as are used for
building libcxx with cmake.

Differential Revision: https://reviews.llvm.org/D120479
2022-03-01 23:44:26 +02:00
David Tenty f642436cc2 [libc++][AIX] Use C++ overloads from libc++'s math.h
AIX's system header provides these C++ overloads for compatibility with
older XL C++ implementations, but they can be disabled by defining
__LIBC_NO_CPP_MATH_OVERLOADS__ since AIX 7.2 TL 5 SP 3.

Since D109078 landed clang will define this macro when using libc++ on
AIX and we already run the lit tests with it too. This change will
enable the overloads in libc++'s math.h and we'll continue to require
the compiler to define the macro going forward.

Reviewed By: ldionne, jsji, EricWF

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

co-authored-by: Jason Liu <jasonliu.development@gmail.com>
2022-03-01 15:53:41 -05:00
Brian Cain 9bf6e3e97e [libcxx] Make test case fmt specifiers more portable
These printf()s fail to compile like so on hexagon:

.../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:94:23: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
        printf("%u ", elem);
                ~~    ^~~~
                %lu
.../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:569:56: error: format specifies type 'unsigned int' but the argument has type 'uint32_t' (aka 'unsigned long') [-Werror,-Wformat]
        fprintf(stderr, "%s failed for 0x%08X\n", msg, bits);
                                         ~~~~          ^~~~
                                         %08lX
.../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:1096:43: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
    printf("Randomized test cases: %u\n", PrefixesToTest * Fractions);
                                   ~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                   %lu

Differential Revision: https://reviews.llvm.org/D120532
2022-03-01 12:07:23 -08:00
Arthur O'Dwyer f86c2b6f1f [libc++] Add `explicit` to a bunch of internal detail ctors.
Notably the following ctors remain non-explicit because they
are used as implicit conversions in too many places:
* __debug_less(_Compare&)
* __map_iterator(_TreeIterator)
* __map_const_iterator(_TreeIterator)
* __hash_map_iterator(_HashIterator)
* __hash_map_const_iterator(_HashIterator)

Differential Revision: https://reviews.llvm.org/D119894
2022-03-01 14:37:06 -05:00
Martin Storsjö d2617a6b52 [libcxx] [test] Fix the put_double, put_long_double tests for clang-cl
These tests are hit hard by a bug that is fixed in a newer version
of UCRT. Add a test for the specific bug, and XFAIL the tests if
that bug is present (as it is in CI).

Split out hex formatting of floats to separate test files, that
are excluded with `XFAIL: msvc`. (Based on reading the C standard for
printf formatting, it seems like this isn't necessarily a proper bug
in printf, but just a case of differing optional behaviour.)

Differential Revision: https://reviews.llvm.org/D120022
2022-03-01 21:33:30 +02:00
Martin Storsjö eb4dcc744d [libcxx] [test] Add a 'win32-' prefix to the 'broken-utf8-wchar-ctype' feature
This was suggested in the review of https://reviews.llvm.org/D120022.

Also indent the code for the compilation test one step compared
to the surrounding expression.

Differential Revision: https://reviews.llvm.org/D120469
2022-03-01 21:33:30 +02:00
Mark de Wever 93b333908d [libc++] Remove _LIBCPP_HAS_NO_STRONG_ENUMS.
All supported compilers have implemented this feature.
Therefore use the language version instead of the feature macro.

Reviewed By: #libc, philnik, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119865
2022-03-01 20:27:20 +01:00
Arthur O'Dwyer 0444a0e8a9 [libc++] Remove extraneous space in module.modulemap. NFC. 2022-03-01 14:25:09 -05:00
Arthur O'Dwyer a281bdd51b [libc++] [test] Improve the tests for std::{begin,end}(valarray).
Incidentally, this removes some unqualified ADL calls to `begin` and `end`.

Differential Revision: https://reviews.llvm.org/D119687
2022-03-01 14:24:46 -05:00
Michał Górny ba4f1e44e4 [libcxx] Add an explicit option to build against system-libcxxabi
Add an explicit LIBCXX_CXX_ABI=system-libcxxabi option for linking to
system-installed libc++abi. This fixes the ability to link against one
when building libcxx via the runtimes build, as otherwise the build
system insists on linking into in-tree targets.

Differential Revision: https://reviews.llvm.org/D119539
2022-03-01 13:44:56 -05:00
Louis Dionne 97e013dd6b [libc++] Re generate header tests
This must have been missed in 368faacac7.
2022-03-01 12:19:21 -05:00
Louis Dionne 3ee0cec88e [runtimes] Remove FOO_TARGET_TRIPLE, FOO_SYSROOT and FOO_GCC_TOOLCHAIN
Instead, folks can use the equivalent variables provided by CMake
to set those. This removal aims to reduce complexity and potential
for confusion when setting the target triple for building the runtimes,
and make it correct when `CMAKE_OSX_ARCHITECTURES` is used (right now
both `-arch` and `--target=` will end up being passed, which is downright
incorrect).

Differential Revision: https://reviews.llvm.org/D112155
2022-03-01 08:39:42 -05:00
Louis Dionne 368faacac7 [libc++] Revert "Protect users from relying on detail headers" & related changes
This commit reverts 5aaefa51 (and also partly 7f285f48e7 and b6d75682f9,
which were related to the original commit). As landed, 5aaefa51 had
unintended consequences on some downstream bots and didn't have proper
coverage upstream due to a few subtle things. Implementing this is
something we should do in libc++, however we'll first need to address
a few issues listed in https://reviews.llvm.org/D106124#3349710.

Differential Revision: https://reviews.llvm.org/D120683
2022-03-01 08:20:24 -05:00
Martin Storsjö f570da28e6 Revert "[lit] Read command stdout/stderr as text on Windows"
This reverts commit 640e45b9b2.

That commit seemed to quite conclusively break a number of buildbots.
2022-03-01 14:43:55 +02:00
Martin Storsjö 640e45b9b2 [lit] Read command stdout/stderr as text on Windows
This takes care of normalizing newlines back to single LF instead
of CRLF.

This on itself breaks on a couple tests that accidentally seem to
be writing binary data to stdout; make sure those cases are piped
to /dev/null instead of actually written to a terminal.

Differential Revision: https://reviews.llvm.org/D120623
2022-03-01 14:24:02 +02:00
Arthur O'Dwyer 6d751c410d [libc++] [ranges] Use "inline constexpr bool" not "constexpr bool" for helpers.
Reviewed as part of D118616.
2022-02-28 18:52:54 -05:00
Louis Dionne 6dfdf79b8c [libc++abi] Install the libc++abi headers from libc++abi
libc++abi should be responsible for installing its own headers, it
doesn't make sense for libc++ to be responsible for it.

Differential Revision: https://reviews.llvm.org/D101458
2022-02-28 17:22:53 -05:00
Louis Dionne 8057a8e26a [libc++][NFC] Fix typo in comment 2022-02-28 17:06:01 -05:00
Louis Dionne c0faf1f731 [libc++][NFC] Remove unused Lit feature in the test suite 2022-02-28 17:06:00 -05:00
Martin Storsjö 1521162d78 [libcxx] [test] Fix the monetary locale curr_symbol test on Windows, Apple and FreeBSD
International currency symbols (like USD, EUR) are returned with a
trailing space, like "USD ", on previously supported Unix platforms.
On Windows, the locales return them without a trailing space.

Also adjust the test for expecting a different unicode sequence for
the national currency symbol for ru_RU.UTF-8 and zh_CN.UTF-8.

Differential Revision: https://reviews.llvm.org/D120547
2022-02-28 23:41:14 +02:00
Arthur O'Dwyer a3255f219a [libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`.
`uniform_int_distribution<T>` is UB unless `T` is one of the non-character,
non-boolean integer types (`short` or larger). However, libc++ has never
enforced this. D114129 accidentally made `uniform_int_distribution<bool>`
into an error. Make it now *intentionally* an error; and likewise for the
character types and all user-defined class and enum types; but permit
`__[u]int128_t` to continue working.

Apply the same static_assert to all the integer distributions.

Differential Revision: https://reviews.llvm.org/D114920
2022-02-28 14:57:53 -05:00
Arthur O'Dwyer d4853e638b [libc++] [ranges] Permit std::mergeable and std::sortable with HAS_NO_INCOMPLETE_RANGES.
This follows the general direction of D118736 that
`_LIBCPP_HAS_NO_INCOMPLETE_RANGES` does *not* guard anything outside
of the `std::ranges::` namespace itself. This means we must permit
`ranges::less` etc. in no-ranges mode; that seems fine to me.

Differential Revision: https://reviews.llvm.org/D120139
2022-02-28 14:56:01 -05:00
Konstantin Varlamov 3906ebf750 [libc++] Fix double file closing in `std::filesystem::remove_all()`.
According to Linux documentation (see e.g. https://linux.die.net/man/3/closedir):

> A successful call to `closedir()` also closes the underlying file
> descriptor associated with `dirp`.

Thus, calling `close()` after a successful call to `closedir()` is at
best redundant. Worse, should a different thread open a file in-between
the calls to `closedir()` and `close()` and get the same file descriptor,
the call to `close()` might actually close a different file than was
intended.

rdar://89251874

Differential Revision: https://reviews.llvm.org/D120453
2022-02-28 12:56:36 -05:00
Martin Storsjö acf20001a0 [libcxx] [test] Fix one failing part of dsl.sh.py on Windows.
Windows UCRT has got a bug in older versions (present in CI), where
it successfully does set a locale named
`for_sure_this_is_not_an_existing_locale`. By adjusting the tested
locale name to `forsurethisisnotanexistinglocale`, that test works
as expected, failing to set the locale.

The bug is reported upstream at
https://developercommunity.visualstudio.com/t/setlocale-succeeds-for-bogus-locale-names-in-older/1652241,
but as it already is working correctly in newer versions, no action
was prompted there.

We could of course add a bug detection in features.py like other
existing `broken-*` features, but that would seem kinda
pointless as it would be doing exactly what this test does.
Instead just adjust the tested dummy locale name.

This bit was approved to be committed on its own, in
https://reviews.llvm.org/D120546 (which is left open to follow up on
review of the rest of that patch).
2022-02-27 22:06:18 +02:00
Martin Storsjö f1d0d6f70c [libcxx] [test] Fix the monetary locale pos/neg_format test for Windows and macOS
The zh_CN.UTF-8 locale on Glibc has got `n_sign_posn == 4` (which means
having the negative sign just after the currency symbol), but has
`int_n_sign_posn == 1` (which means before the string).

On Windows, there's no separate `int_n_sign_posn` field, so the same
`n_sign_posn` (which is 4 there too) is used for international currency
formatting too. This makes the ordering for the international case on
Windows be the same as for the national one right above it.

On Apple platforms, the fr_FR.UTF-8 locale has got `n_sign_posn == 2`
but `p_sign_posn == 1`, giving a different order for the French locale
for the negative format.

On Apple platforms for the zh_CN.UTF-8 locale, both `n_sign_posn` and
`int_n_sign_posn` are 4, but `p_sign_posn` and `int_p_sign_posn` are 1.

Differential Revision: https://reviews.llvm.org/D120550
2022-02-27 21:49:14 +02:00
Arthur O'Dwyer b6d75682f9 [libc++] [test] Check the presence of "pragma include_instead" in newly added headers.
Unless/until we revert D106124, we should make sure that every newly added
detail header includes this line.
2022-02-27 12:27:56 -05:00
Arthur O'Dwyer 7f285f48e7 [libc++] [test] Re-remove C++ comments from generated files.
A merge conflict in D106124 accidentally reverted this part of
b82683b2e/D110794.

> Even if these comments have a benefit in .h files (for editors that
> care about language but can't be configured to treat .h as C++ code),
> they certainly have no benefit for files with the .cpp extension.
2022-02-26 12:44:26 -05:00
Martin Storsjö 1198c309db [libcxx] [test] Remove an incorrect XFAIL, fix CI on main
9f5f084 (D119770) made this test pass in the Windows configuration too,
but didn't update the XFAIL accordingly.

Differential Revision: https://reviews.llvm.org/D120611
2022-02-26 12:29:42 -05:00
Nikolas Klauser aa8ebcad5d [libc++] Remove recursion in basic_string::insert(const_iterator, ForwardIterator, ForwardIterator)
`__addr_in_range` is a non-constexpr function, so we can't call it during constant evaluation.

Reviewed By: Quuxplusone, #libc, miscco

Spies: miscco, libcxx-commits

Differential Revision: https://reviews.llvm.org/D119633
2022-02-26 13:29:56 +01:00
Christopher Di Bella 5aaefa510e [libcxx][modules] protects users from relying on detail headers
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as <__ranges/access.h> instead of
<ranges>, and Hyrum's law suggests that users will eventually begin to
rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

Differential Revision: https://reviews.llvm.org/D106124
2022-02-26 09:00:25 +00:00
Martin Storsjö 0f5d0d4e82 [libcxx] Fix the error checking for wctob_l, fixing locale narrow function on Windows
According to POSIX.1 (and Glibc docs, and Microsoft docs), the wctob
function returns EOF on error, not WEOF. (And wctob_l should consequently
do the same.)

The previous misconception about what this function returns on errors
seems to stem from incorrect documentation in macOS, stemming from BSD
docs with the same issue. The corresponding documentation bug in FreeBSD
was fixed in 2012 in
945aab9099,
but it hasn't been fixed for macOS yet.

The issue seems to only be a documentation issue; the implementation
on macOS actually does use EOF, not WEOF:
https://opensource.apple.com/source/Libc/Libc-1439.40.11/locale/FreeBSD/wctob.c.auto.html

On most Unices, EOF and WEOF are the same value, but on Windows,
EOF is -1, while WEOF is (unsigned short)0xFFFF. By fixing this,
two tests start passing on Windows.

Differential Revision: https://reviews.llvm.org/D120088
2022-02-25 23:44:23 +02:00
Martin Storsjö 2d54bf3bc7 [libcxx] [test] Fix the monetary locale negative_sign test for en_US.UTF-8 on Windows
On Windows, the en_US.UTF-8 locale returns `n_sign_posn == 0`, which
means that the sign for a negative currency is parentheses around
the whole value, instead of a leading minus.

Differential Revision: https://reviews.llvm.org/D120549
2022-02-25 23:41:35 +02:00
Stefan Pintilie 96918f2af6 [libcxx] String format class marked as packed
This patch marks the class _Flags as packed because the design assumes that it
is packed and a number of tests also assume that it is packed. However on AIX
the class is not packed unless it is marked as such.

Reviewed By: hubert.reinterpretcast, #libc, Mordante, ldionne, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119567
2022-02-25 10:07:19 -06:00
Stefan Pintilie 9f5f08476e [libcxx] Fix the type in __estimate_column_width
It seems that we are using wchar_t in __estimate_column_width and assume that
it is a 32 bit type. However, on AIX 32 the size of wchar_t is only 16 bits.

Changed wchar_t to uint32_t since the variable is being passed to a function
that uses uint32_t anyway.

Reviewed By: hubert.reinterpretcast, daltenty, Mordante, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119770
2022-02-25 09:04:58 -06:00
Corentin Jabot 48f8a7c4f2 [libc++] Make sure calls to std::move are always qualified
This fixes instances of the newly added `-Wunqualified-std-cast-call`.

(Commit 7853371146 removed unqualified `move` from the tests,
but these unqualified `move`s remained undetected in the actual headers.)

Differential Revision: https://reviews.llvm.org/D120509
2022-02-24 19:58:08 -05:00
Nikolas Klauser de462a43d3 [libc++] Remove <chrono> include from <future>
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D120436
2022-02-24 10:05:51 +01:00
Martin Storsjö 5333732fce [libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms
This fixes issue #45084 (https://llvm.org/PR45739).

Remove unnecessary trailing spaces after the "RUB" international
currency symbol (and after the plain number in some parts of the
put_long_double test).

Both of these test files are
`XFAIL: netbsd || linux || LIBCXX-WINDOWS-FIXME`, and then have some of
their test cases commented out when `__APPLE__`. This patch comments-in
those test cases and adjusts them all to work on Apple, while leaving the
test `XFAIL`ed on NetBSD, Linux, and Windows.

Differential Revision: https://reviews.llvm.org/D120316
2022-02-24 10:21:36 +02:00
Nikolas Klauser deed246631 [libc++] Add empty line in ReleaseNotes.rst 2022-02-24 00:09:47 +01:00
Nikolas Klauser 489637e66d [libc++] Granularize chrono includes
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D120141
2022-02-23 23:06:26 +01:00
Martin Storsjö 3fb4439a0a [libcxx] [test] Fix time.get.byname get_one for Glibc and Windows
This matches the fixes for the wchar version in
f081cc5037.

Differential Revision: https://reviews.llvm.org/D120283
2022-02-23 22:58:34 +02:00
Jinsong Ji 9bd9cbfa2f [libc++][AIX] Fix trivial_abi return tests for unique_ptr/weak_ptr
The unique_ptr_ret and weak_ptr_ret tests are not expected to pass on
AIX. These tests check that unique_ptr and weak_ptr are returned by
value, but on AIX, all structs are always returned by reference.

```
3.9.6 Function Return Values
...

Note: Structures of any length and character strings longer than four
bytes are returned in a storage buffer allocated by the caller. The
address of this buffer is passed as a hidden first argument in GPR3,
which causes the first explicit argument word to be passed in GPR4. This
hidden argument is treated as a formal argument and corresponds to the
first word of the argument area.
```

Reviewed By: #powerpc, daltenty, #libc, Quuxplusone, philnik

Differential Revision: https://reviews.llvm.org/D119952
2022-02-23 14:22:34 -05:00
Owen Anderson 4745c994e4 Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.
Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Section E1.3.5 in the ARMv8 Architecture Reference Manual specifies:
  Underflow. The bit is set to 1 if the absolute value of the result
  of an operation, produced before rounding, is less than the minimum
  positive normalized number for the destination precision, and the
  rounded result is inexact.

Reviewed By: #libc, majnemer, EricWF

Differential Revision: https://reviews.llvm.org/D116338
2022-02-22 15:49:21 -08:00
Zarko Todorovski 7fb02d2752 [libc++][AIX] Add AIX error message as expected output
AIX's libc generates "Error -1 occurred" instead of the "Unknown Error"
expected by these test cases. Add this as expected output for AIX only.

Reviewed By: daltenty, #powerpc, #libc, zibi, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119982
2022-02-22 14:34:36 -05:00
David Spickett 9c720250d1 [libcxx][ci] Switch to CMAKE_CXX_COMPILER_TARGET for Arm bots
As suggested by the cmake warning:
CMake Warning at <...>/llvm-project/libcxx-ci/libcxx/CMakeLists.txt:289 (message):
  LIBCXX_TARGET_TRIPLE is deprecated, please use CMAKE_CXX_COMPILER_TARGET instead

Depends on D119948

Differential Revision: https://reviews.llvm.org/D120038
2022-02-22 09:42:55 +00:00
David Spickett 912bba5ae2 [libcxx][CI] Set Arm triples to match native clang build's default
We were using:
armv8-linux-gnueabihf
But for a native clang build the default target is:
armv8l-linux-gnueabihf

(ditto for v7)

Add the "l" to the target triples and update the one test
that is unsupported to look for the various possible names.

armv(7 or 8)(m or l, optionally)

The UNSUPPORTED does not include aarch64 because aarch64 Linux
(and others that follow Arm's AAPCS64) use quad precision for
long double where arm64 (darwin) does not:
https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#811arithmetic-types

Reviewed By: rovka

Differential Revision: https://reviews.llvm.org/D119948
2022-02-22 09:39:20 +00:00
Nikolas Klauser 68f4131c94 [libc++][ranges] Add ranges::in_found_result
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D119763
2022-02-21 23:08:14 +01:00
Nikolas Klauser c7b43b01dc [libc++] Replace [[no_unique_addredd]] with _LIBCPP_NO_UNIQUE_ADDRESS in __algorithm/min_max_result.h 2022-02-21 22:56:44 +01:00
Nikolas Klauser 807766be3a [libc++][ranges] Add ranges::min_max_result
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D119751
2022-02-21 22:52:01 +01:00
Martin Storsjö bcee450937 [libcxx] [test] Fix the thousands_sep expectation for fr_FR locales on Windows
Windows uses U+00A0 NO-BREAK SPACE as thousands separator in the
fr_FR locale.

Differential Revision: https://reviews.llvm.org/D120090
2022-02-21 23:08:56 +02:00
Martin Storsjö 865c7ab421 [libcxx] [test] Fix moneypunct grouping tests on Windows
For grouping strings, "\3" and "\3\3" are equivalent.

Differential Revision: https://reviews.llvm.org/D120091
2022-02-21 23:08:56 +02:00
Casey Carter 2d653b7e5b [libcxx][test] array and basic_string_view iterators are not portably pointers
Fixup tests that believe them to be so. Most notably including some heavy refactoring in `std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp`, which now detects pointers and validates that `iterator_concept` is present only for pointers.

Differential Revision: https://reviews.llvm.org/D117368
2022-02-21 10:54:08 -08:00
Casey Carter eb5950666b [libcxx][test] Update msvc_stdlib_force_include.h for C++23
Make distinct `TEST_STD_VER` values for C++20 and C++23; add C++23 deprecation suppression.

Fixes #53597
2022-02-20 11:35:33 -08:00
Nikolas Klauser 3431358333 [libc++] Replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in __filesystem/operations.h 2022-02-18 18:24:09 +01:00
Konstantin Varlamov 8e979460bb [libc++][ranges] Implement `std::sortable`.
Differential Revision: https://reviews.llvm.org/D119619
2022-02-17 20:17:42 -08:00
Konstantin Varlamov eea3d90af1 [libc++][ranges] Implement `std::mergeable`.
Differential Revision: https://reviews.llvm.org/D119489
2022-02-17 20:12:04 -08:00
Casey Carter 8d58cb62da [libcxx][test] Let the library indicate support for int128
Define `TEST_HAS_NO_INT128` accordingly.

Differential Revision: https://reviews.llvm.org/D120010
2022-02-17 14:07:49 -08:00
Martin Storsjö 38d25aecdf [libcxx] [test] Use proper UTF-8 locales on Windows
Since Windows 10 version 1803 (10.0.17134.0) (or Windows Server 2019),
the Windows Universal C Runtime (UCRT) actually does support UTF-8
locales - they're available e.g. via the same names as commonly on Unices,
e.g. "en_US.UTF-8".

The UTF-8 locale support unfortunately has a bug which breaks a couple
tests that were passing previously. That bug is fixed in the very
latest version of the UCRT (in UCRT 10.0.20348.0, available in Windows
11 or Windows Server 2022), so it will get resolved at some point
eventually, provided that the CI environment does get upgraded to a
newer version of Windows Server.

While the net number of xfailed/passing tests in this patch is a loss,
this does allow fixing a lot more locale tests properly for Windows
in later patches.

Intentionally not touching the ISO-8859-1/2 locales used for testing;
they're not detected and tested/used right now, and fixing that up
is another project.

Differential Revision: https://reviews.llvm.org/D119930
2022-02-18 00:02:34 +02:00
Nikolas Klauser f755806813 Remove __uncvref; use __uncvref_t instead
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119958
2022-02-17 22:54:31 +01:00
Louis Dionne 6c80e38554 [libc++][CI] Upload ABI lists for all jobs
Some jobs might not produce those, but it makes the blocks easier to
copy-paste and makes sure that if a job does produce an ABI list, it
will be updloaded in the artifacts.

Differential Revision: https://reviews.llvm.org/D120056
2022-02-17 16:10:08 -05:00
Nikolas Klauser 1cfa485769 [libc++] Implement P1165R1 (Make stateful allocator propagation more consistent)
Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119112
2022-02-17 22:00:48 +01:00
Casey Carter a7b9af7872 [libcxx][test] Silence signed/unsigned comparison warnings 2022-02-17 12:56:05 -08:00
Martin Storsjö 83c2aa467e [libcxx] [test] Fix locale.time.get.byname get_date and get_date_wide on Windows
Also apply the same fix on glibc. This takes the test one step closer
to passing on glibc, but it still fails on the zh_CN test (which
requires a more involved fix in libc++ itself).

Differential Revision: https://reviews.llvm.org/D119791
2022-02-17 10:54:39 +02:00
Martin Storsjö f081cc5037 [libcxx] [test] Fix the locale get_one_wide test for windows and glibc
Differential Revision: https://reviews.llvm.org/D119790
2022-02-17 10:54:18 +02:00
Martin Storsjö 77c7ce0384 [libcxx] [test] Make the put_long_double test pass on mingw, clarify quirks in put_double
Expect the same NAN formatting on Windows as on Glibc. (Both MSVC and
MinGW produce the same formatting there.)

The hex float formatting tests pass on MinGW, so opt in to those tests.

Document exactly what issues are remaining in Clang-cl/MSVC
configurations. (It's easily possible to make the tests pass there too,
but it requires a whole lot of small-scope ifndefs in the test file;
around 60 ifdefs in total for those both test files. Those could
be avoided if the CI environment could run with a newer version
of UCRT, but that's nontrivial to fix right away.)

Differential Revision: https://reviews.llvm.org/D119766
2022-02-17 10:53:28 +02:00
Nikolas Klauser 318507edee [libc++] Remove a few unneeded _LIBCPP_CXX03_LANG ifdefs
Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119896
2022-02-17 00:14:42 +01:00
Louis Dionne 1b06d2cf15 [libc++] Refactor the Apple build scripts
This patch upstreams some changes we've made internally to how we're
building the libc++ dylib on Apple platforms. The goal is still to
eventually get rid of `apple-install-libcxx.sh` entirely and have a
proper way to mirror what we do internally with just the normal CMake
configuration.

Differential Revision: https://reviews.llvm.org/D118912
2022-02-16 16:28:13 -05:00
Louis Dionne 259c58d7d8 [libc++abi] Bump the libc++abi version and add it to the post-release list
Differential Revision: https://reviews.llvm.org/D119947
2022-02-16 16:27:25 -05:00
Louis Dionne f87aa19be6 [libc++] Move everything related solely to _LIBCPP_ASSERT to its own file
This is the first step towards disentangling the debug mode and assertions
in libc++. This patch doesn't make any functional change: it simply moves
_LIBCPP_ASSERT-related stuff to its own file so as to make it clear that
libc++ assertions and the debug mode are different things. Future patches
will make it possible to enable assertions without enabling the debug
mode.

Differential Revision: https://reviews.llvm.org/D119769
2022-02-16 12:49:50 -05:00
Louis Dionne 2e3bb910e3 [runtimes] Move warning messages for FOO_SYSROOT & friends above their default value
Otherwise, the warnings always trigger.
2022-02-16 12:00:34 -05:00
Louis Dionne 9a460b848f [libc++][ci] Allow updating packages and config files on macOS CI nodes 2022-02-16 11:24:24 -05:00
Arthur O'Dwyer 37f7e31015 [libc++] [test] Qualify calls to std::get(tuple). NFC.
It actually *is* important (for structured bindings) that `get(tuple)`
be ADL-able; but that's not the point of this test in particular.

Reviewed as part of D119860.
2022-02-16 11:03:35 -05:00
Arthur O'Dwyer 79dc7551d8 [libc++] [test] Qualify calls to std::rethrow_exception. NFC.
We shouldn't be calling `rethrow_exception` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `rethrow_exception` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:34 -05:00
Arthur O'Dwyer f033bf88b4 [libc++] [test] Qualify calls to std::atomic_flag_{clear,test} functions. NFCI.
We shouldn't be calling these functions via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
the ADL ability of these functions in particular.

Reviewed as part of D119860.
2022-02-16 11:03:34 -05:00
Arthur O'Dwyer 98bb747c87 [libc++] [test] Qualify calls to std::getline. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:33 -05:00
Arthur O'Dwyer eae745c18e [libc++] [test] Qualify calls to iomanip functions in std/input.output/iostream.format/. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:33 -05:00
Arthur O'Dwyer 85a92deb59 [libc++] [test] Qualify calls to iomanip functions in std/localization/. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:32 -05:00
Arthur O'Dwyer 3b966c1fe9 [libc++] [test] Qualify `prev` as `std::prev` in a lot of tests. NFCI.
We shouldn't be calling `prev` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `prev` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:32 -05:00
Arthur O'Dwyer 5ffe11a9fc [libc++] [test] Qualify `next` as `std::next` in a lot of tests. NFCI.
We shouldn't be calling `next` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `next` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:31 -05:00
Arthur O'Dwyer 7853371146 [libc++] [test] Qualify `move` as `std::move` in a lot of tests. NFCI.
We shouldn't be calling `move` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `move` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:31 -05:00
Arthur O'Dwyer 3f3abaf40a [libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11.
Fixes #49601.

Differential Revision: https://reviews.llvm.org/D119891
2022-02-16 11:01:49 -05:00
Arthur O'Dwyer 3581fd32ee [libc++] [test] Remove `using std::any{,_cast}` from std/utilities/any/. NFCI.
Differential Revision: https://reviews.llvm.org/D119863
2022-02-16 11:00:02 -05:00
Arthur O'Dwyer 2b2ee24d53 [libc++] [test] Remove `using std::{make_,}optional` from the optional tests.
Drive-by remove some use of raw `new`, and expand test coverage a tiny bit.

Differential Revision: https://reviews.llvm.org/D119861
2022-02-16 10:59:43 -05:00
Louis Dionne 8f7f3c1f99 [libc++] Pass -fcxx-modules during our modules builds
Otherwise, AppleClang ignores -fmodules entirely, so we are not actually
testing anything.

Differential Revision: https://reviews.llvm.org/D119862
2022-02-16 10:30:23 -05:00
Louis Dionne 641a141da1 [runtimes] Deprecate FOO_SYSROOT & friends
As suggested in https://reviews.llvm.org/D112155.

Differential Revision: https://reviews.llvm.org/D119836
2022-02-16 09:44:08 -05:00
Nikolas Klauser f75f171b20 [libc++] Remove cpp17_input_iterator.h
Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119881
2022-02-16 04:17:40 +01:00
Nikolas Klauser 2e2f3158c6 [libc++] Granularize algorithm includes
Reviewed By: Mordante, ldionne, Quuxplusone, #libc, #libc_abi

Spies: #libc_vendors, libcxx-commits, miyuki

Differential Revision: https://reviews.llvm.org/D119667
2022-02-16 04:12:22 +01:00
Konstantin Varlamov 43bc1e5600 [libc++][ranges] Implement Ranges changes to `istream{,buf}_iterator`.
The changes from the One Ranges Proposal amount to adding:
- a constructor that takes a `default_sentinel_t` and is equivalent to
  the default constructor;
- an `operator==` that compares the iterator to `default_sentinel_t`.

The original proposal defined two overloads for `operator==` (different
argument order) as well as `operator!=`. This has been removed by
[P1614](https://wg21.link/p1614).

Differential Revision: https://reviews.llvm.org/D119620
2022-02-15 16:59:42 -08:00
Nikolas Klauser f10909a508 [libc++][test] Run clang-tidy during CI
I'm trying to get libc++ to the point of being able to run clang-tidy. This is a PR to see if clang-tidy is happy with all the CI configs.

Reviewed By: Quuxplusone, ldionne, #libc

Spies: mgorny, aheejin, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D117174
2022-02-16 00:22:08 +01:00
Arthur O'Dwyer f33d7493a5 [libc++] [test] Qualify `distance` as `std::distance` in a lot of tests. NFCI.
We shouldn't be calling `distance` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `distance` in particular.

Differential Revision: https://reviews.llvm.org/D119685
2022-02-15 16:20:52 -05:00
Louis Dionne 87b218b42b [libc++] Mark test as unsupported with apple-clang
This is to avoid spurious test failures in case apple-clang-14 doesn't
support _BitInt.
2022-02-15 16:12:08 -05:00
Louis Dionne 0e628a783b [libc++] Take more knobs into account when generating ABI lists
This change will make it possible to track exported symbols in more
configurations, notably the Apple system one, where we disable incomplete
features and the debug mode. Also, as a fly-by fix, shorten the name for
whether new is in libc++ or not.

Differential Revision: https://reviews.llvm.org/D119764
2022-02-15 16:11:16 -05:00
Louis Dionne 5c53afe5aa [libc++] Temporarily silence failing debug mode test
Also, fix the actual code so that the test would pass if we fixed the
issue that the method is instantiated in the dylib, and hence the debug
assertion will never fire except if the debug mode is enabled when the
dylib is being compiled.
2022-02-15 15:49:29 -05:00
Louis Dionne 7dad5f84f1 [libc++] Add missing UNSUPPORTED for the has-no-incomplete-ranges test
This wasn't caught because we don't test the combination of no-filesystem
and no-experimental-features in the CI.
2022-02-15 15:10:29 -05:00
Louis Dionne a61d07ac94 [libc++][ci] Pin apple-system to arm64 to relieve pressure on x86_64 hosts 2022-02-15 15:07:54 -05:00
Arthur O'Dwyer bbb0f2c759 [libc++] Replace `#include ""` with `<>` in libcxx/src/. NFCI.
Our best guess is that the two syntaxes should have exactly equivalent
effects, so, let's be consistent with what we do in libcxx/include/.

I've left `#include "include/x.h"` and `#include "../y.h"` alone
because I'm less sure that they're interchangeable, and they aren't
inconsistent with libcxx/include/ because libcxx/include/ never
does that kind of thing.

Also, use the `_LIBCPP_PUSH_MACROS/POP_MACROS` dance for `<__undef_macros>`,
even though it's technically unnecessary in a standalone .cpp file,
just so we have consistently one way to do it.

Differential Revision: https://reviews.llvm.org/D119561
2022-02-15 13:00:46 -05:00
Louis Dionne 987c7f407d [libc++] Revert <stdatomic.h> changes
This reverts commits a30a7948d and 5d1c1a243, which broke the LLDB
data formatters tests because they build with modules in C++11 mode.

Differential Revision: https://reviews.llvm.org/D97044
2022-02-15 12:59:14 -05:00
Konstantin Varlamov 49ff418ed5 [libc++][ranges][NFC] Small formatting fixes to the Ranges algorithms' status. 2022-02-15 09:43:29 -08:00
Mark de Wever 097f0fd158 [libc++][nfc] Add TEST_HAS_NO_FGETPOS_FSETPOS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D119742
2022-02-15 17:50:56 +01:00
Louis Dionne fd4cc87022 [libc++] Allow backdeployment CI to run on newer macOS
This should work now that we are using a matching libunwind.dylib when
we run the tests in back-deployment scenarios. The only restriction we
have now is to run on macOS x86_64, since that's what the old dylibs
were compiled for. This should allow us to move to newer AppleClangs
in the CI.

As a fly-by, fix missing availability annotations on optional's
monadic operations.

Differential Revision: https://reviews.llvm.org/D119840
2022-02-15 11:34:22 -05:00
Arthur O'Dwyer 690287b199 [libc++] [test] Improve test coverage for std::{c,}{begin,end}.
Incidentally, this removes some unqualified ADL calls to `begin` and `end`.

Differential Revision: https://reviews.llvm.org/D119677
2022-02-15 11:31:45 -05:00
Arthur O'Dwyer 7bdf41653c [libc++] Remove conditional noexcepts from view_interface.
As suggested in D117966.
These conditional noexcepts are *permitted* by the Standard (as long
as there were no mistakes in them, I guess); but not *mandated*.
The Standard doesn't put any noexcept-specifications on these member functions.
The same logic would apply to `transform_view::iterator::operator*`
and `transform_view::iterator::operator[]`, but the Standard mandates
conditional noexcept on `iter_move(transform_view::iterator)`, and
I think it doesn't make much sense to say "moving from this iterator
is conditionally noexcept but not-moving from it is noexcept(false),"
so I'm leaving transform_view alone for now.

Differential Revision: https://reviews.llvm.org/D119374
2022-02-15 11:12:42 -05:00
Arthur O'Dwyer 05337a756c [libc++] Rename *SAFE_STATIC to *CONSTINIT, and normalize its uses.
In src/, most files can use `constinit` directly because they're always
compiled with C++20. But some files, like "libcxxabi/src/fallback_malloc.cpp",
can't, because they're `#include`d directly from test cases in libcxxabi/test/
and therefore must (currently) compile as C++03. We might consider refactoring
those offending tests, or at least marking them `UNSUPPORTED: c++03`.

Differential Revision: https://reviews.llvm.org/D119264
2022-02-15 10:39:41 -05:00
Arthur O'Dwyer db33373596 [libc++] [test] Split "UNSUPPORTED: libcpp-no-concepts, libcpp-has-no-incomplete-ranges" onto two lines. NFC. 2022-02-15 10:38:21 -05:00
Arthur O'Dwyer 53406fb691 [libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
The logic here is that we are disabling *only* things in `std::ranges::`.
Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,
`common_iterator`, `projected`, `swappable`, and so on. Then, we include
anything from `std::ranges::` that is required in order to make those things
work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
`ranges::iter_move`, and so on. But then that's all. Everything else (including
notably all of the "views" and the `std::views` namespace itself) is still
locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.

Differential Revision: https://reviews.llvm.org/D118736
2022-02-15 10:38:21 -05:00
Louis Dionne a30a7948d5 [libc++] Fix broken stdatomic test on GCC
The test would trigger -Wtautological-compare. I think that the little
we gain from comparing addresses isn't worth the added complexity to
work around the warning.
2022-02-15 09:26:27 -05:00
Xing Xue 16667362d0 [libc++][AIX] Remove "pragma priority" from locale.cpp
Summary:
The pragma priority guarded for AIX in locale.cpp is no longer useful and is ignored by the current AIX build compilers. This patch removes it from the source.

Reviewed by: ldionne, hubert.reinterpretcast, libc++

Differential Revision: https://reviews.llvm.org/D119765
2022-02-15 08:36:29 -05:00
Nikolas Klauser a7c2a6289c [libc++] Guard warning pragmas
This makes the GCC output even cleaner!

Reviewed By: ldionne, #libc

Spies: mstorsjo, Quuxplusone, Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D119295
2022-02-15 00:41:11 +01:00
Nikolas Klauser ac428df47a [libc++] Replace _VSTD with std in __ranges/
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119497
2022-02-15 00:39:15 +01:00
Louis Dionne ae68ce5ca8 [libc++][NFC] Fix typo in comment 2022-02-14 18:26:10 -05:00
Martin Storsjö 7420cf1b15 [libcxx] [ci] Enable LIBCXX_ENABLE_WERROR where possible
Only opt out from it in the few configs (GCC based) where there still
are build warnings.

Differential Revision: https://reviews.llvm.org/D119573
2022-02-15 01:17:12 +02:00
Nikolas Klauser 30046a31b8 [libc++] Prepare string.nonmembers for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119487
2022-02-14 22:53:41 +01:00
Marek Kurdej 5d1c1a243c [libc++] [C++2b] [P0943] Add stdatomic.h header.
* https://wg21.link/P0943
* https://eel.is/c++draft/stdatomic.h.syn

Differential Revision: https://reviews.llvm.org/D97044
2022-02-14 16:39:22 -05:00
Louis Dionne 8c06061372 [libc++abi] Add a from-scratch testing config for Apple backdeployment
We added one for libc++ recently, and this patch adds one for libc++abi.
Also, as a fly-by fix, include older libunwind dylibs in the testing of
libc++ and libc++abi, which fixes some issues related to running
back-deployment tests on newer systems.

Differential Revision: https://reviews.llvm.org/D119466
2022-02-14 15:36:50 -05:00
Martin Storsjö e98f6fa1c7 [libcxx] [test] Fix the get_weekday test on glibc
This test feeds in the expected utf8 form of weekdays in various
languages, trying to match what libc++ has gathered internally
from `strftime()`. On glibc, the ru_RU.UTF-8 representation of the
tested weekday is spelled with upper case, while the existing
test reference is lower case.

Differential Revision: https://reviews.llvm.org/D118237
2022-02-14 22:21:16 +02:00
Martin Storsjö e5f362828a [libcxx] [test] Simplify the handling of platform specific NAN formatting in put_long_double
Also opt in to testing the hexadecimal float formatting for glibc; glibc
does matches the current test references there.

Differential Revision: https://reviews.llvm.org/D118238
2022-02-14 22:21:15 +02:00
Arthur O'Dwyer 6c4052166c [libc++] [test] Uncomment std::ranges::min_element in niebloid.compile.pass.cpp.
This should have been part of 3b470d1ce.
2022-02-14 15:12:10 -05:00
Martin Storsjö 7b89360d3a [libcxx] Fix setup of MSVC specific intrinsics in Ryu code
This fixes warnings about implicitly declared `_umul128` and
`__shiftright128` when building for x86_64 with clang-cl.

Use `_MSC_VER` instead of `_LIBCPP_COMPILER_MSVC` for enabling MSVC
specific code; `_MSC_VER` is defined both in clang-cl and MSVC,
while `_LIBCPP_COMPILER_MSVC` only is defined if building with the
actual MSVC compiler.

Include `ryu.h` at the head of `d2s_intrinsics.h`, as it uses
the `_LIBCPP_64_BIT` define, which is defined in `ryu.h`.

Now the Ryu files build without warnings with clang-cl for i386,
x86_64, arm and aarch64.

Differential Revision: https://reviews.llvm.org/D119647
2022-02-14 22:11:22 +02:00
Nikolas Klauser 2a8f9a5e95 [libc++] Implement P0627R6 (Function to mark unreachable code)
Reviewed By: ldionne, Quuxplusone, #libc

Spies: arichardson, mstorsjo, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D119152
2022-02-14 20:52:51 +01:00
Louis Dionne 57c3c48e6e [libc++][NFC] Remove redundant comment about availability of std::format 2022-02-14 14:28:26 -05:00
Louis Dionne 608ef3d32a [libc++][NFC] Remove trailing whitespace 2022-02-14 14:17:11 -05:00
Mark de Wever e404e22587 [libc++][nfc] Add TEST_HAS_NO_FILESYSTEM_LIBRARY.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D119642
2022-02-14 18:40:55 +01:00
Arthur O'Dwyer 5185f4a05b [libc++] [NFC] s/geenrally/generally/ 2022-02-14 11:27:06 -05:00
Igor Zhukov 01d8cb3e82 [libc++] [NFC] Fix a typo in Cxx2bIssues.csv
Differential Revision: https://reviews.llvm.org/D119694
2022-02-14 10:58:31 -05:00
Arthur O'Dwyer 35d4b48654 [libc++] Remove U+2009 THIN SPACE from comments in tests. NFC. 2022-02-14 10:30:36 -05:00
Arthur O'Dwyer fc3923fab4 [libc++] Remove U+00AD SOFT HYPHEN from comments in tests. NFC.
git grep  $(printf '\xc2\xad') ../libcxx
2022-02-14 10:26:25 -05:00
Konstantin Varlamov 55bd22f853 [libc++][ranges] Implement rbegin, rend, crbegin and crend.
Differential Revision: https://reviews.llvm.org/D119057
2022-02-14 03:29:59 -08:00
Joe Loser 861386dbd6
[libc++] Remove <experimental/filesystem> header
`<filesystem>` header has been around for a while now, so we can safely remove
`<experimental/filesystem>` header. `_LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM`
suggests we were going to remove `<experimental/filesystem>` in llvm 11 release,
but we never did. So, remove the experimental header now, its associated tests,
and the `_LIBCPP_DEPRECATED_EXPERIMENTAL_FILESYSTEM` macro.

Differential Revision: https://reviews.llvm.org/D119603
2022-02-12 19:43:57 -05:00
Mark de Wever 5ffb1047cd [libc++][nfc] Add TEST_HAS_NO_INT128.
This avoids using an libc++ internal macro in our tests.

D117992 removed them, but it seems new occurrences have been introduced.
2022-02-12 20:07:58 +01:00
Mark de Wever 84bb14599f [libc++][nfc] Add TEST_HAS_NO_THREADS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D119563
2022-02-12 19:24:06 +01:00
Joe Loser 8f0b2ac140
[libc++] Use _LIBCPP_NO_UNIQUE_ADDRESS for base in join_view
Despite the comment saying `[[no_unique_address]]` on the `__base_` data member
makes clang crash, this does not seem to be true on CI. So, mark `__base_` with
`_LIBCPP_NO_UNIQUE_ADDRESS`.

Differential Revision: https://reviews.llvm.org/D119208
2022-02-11 18:37:32 -05:00
Konstantin Varlamov e1e17a6489 [libc++][ranges][NFC] Refactor tests for `ranges::{begin,end}`.
- add some test cases for `cbegin`/`cend`;
- make class definitions generally follow the order in which they are
  used;
- add a missing include.

Reviewed By: philnik

Differential Revision: https://reviews.llvm.org/D119214
2022-02-11 15:15:51 -08:00
Martin Storsjö 415d676296 [libcxx] Fix a missed instance of _LIBCPP_NO_UNIQUE_ADDRESS
This was missed in 8a0a706f09 (added
after that patch was made originally).
2022-02-12 00:44:37 +02:00
Nikolas Klauser ccc740353d [libc++] Prepare string.ops for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119490
2022-02-11 22:31:32 +01:00
Louis Dionne c74b192404 [libc++] Revert the addition of _LIBCPP_HIDE_FROM_ABI and inline in __threading_support
This reverts commit 2722ac65. As explained in D115906, this was actually
unnecessary and it broke the external threading configuration.

Differential Revision: https://reviews.llvm.org/D119484
2022-02-11 15:54:02 -05:00
Louis Dionne 7338227882 [libc++] Disable local submodule visibility in the modules build
Differential Revision: https://reviews.llvm.org/D119468
2022-02-11 15:52:55 -05:00
Martin Storsjö 8a0a706f09 [libcxx] Wrap [[no_unique_address]] in a macro, for clang-cl
This should silence all remaining clang-cl build warnings.

Differential Revision: https://reviews.llvm.org/D119430
2022-02-11 22:02:32 +02:00
Konstantin Varlamov 10953974ed [libc++][NFC] Work around false positive ODR violations from ASan.
This works around a known issue in ASan. ASan doesn't instrument weak
symbols. Because instrumentation increases object size, the binary can
end up with two versions of the same object, one instrumented and one
not instrumented, with different sizes, which ASan will report as an ODR
violation. In libc++, this affects typeinfo for `std::bad_function_call`
which is emitted as a weak symbol in the test executable and as a strong
symbol in the shared library.

The main open issue for ASan appears to be
https://github.com/google/sanitizers/issues/1017.

Differential Revision: https://reviews.llvm.org/D119410
2022-02-11 11:56:51 -08:00
Nikolas Klauser 169a66eac8 [libc++] Remove __functional_base
Reviewed By: ldionne, Quuxplusone, #libc

Spies: Mordante, mgorny, libcxx-commits, arichardson, llvm-commits, arphaman

Differential Revision: https://reviews.llvm.org/D119439
2022-02-11 19:16:01 +01:00
Joe Loser 36fba521d9
[libc++] Remove unused include from ranges_swap_ranges.h
`ranges_swap_ranges.h` includes `<type_traits>` but does not use anything from
it. So, remove the include.

Differential Revision: https://reviews.llvm.org/D119491
2022-02-11 12:28:24 -05:00
Mark de Wever efe5cbaf42 [libc++][format] LWG-3648 format should not print bool with 'c'
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119350
2022-02-11 17:45:14 +01:00
Mark de Wever b6d6b8c9d8 [libc++][format] LWG-3654 basic_format_context::arg(size_t) should be noexcept
Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119349
2022-02-11 17:42:06 +01:00
Mark de Wever 9027887e23 [libc++][nfc] Add TEST_HAS_NO_CHAR8_T.
This avoids using an libc++ internal macro in our tests. This version
doesn't depend on the internal macro but redefines it.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119460
2022-02-11 17:37:05 +01:00
Nikolas Klauser 3b470d1ce9 [libc++][ranges] Implement ranges::min_element
Implement ranges::min_element

Reviewed By: Quuxplusone, Mordante, #libc

Spies: miscco, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D117025
2022-02-11 17:20:27 +01:00
Nikolas Klauser 1e77b396ff [libc++] Add ranges::in_fun_result
Add `ranges::in_fun_result`

Reviewed By: Quuxplusone, #libc, var-const

Spies: CaseyCarter, var-const, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D116974
2022-02-11 17:10:29 +01:00
Konstantin Varlamov aff115420d [libc++][ranges][NFC] Fix a typo in links on the Ranges status page. 2022-02-10 20:55:27 -08:00
Konstantin Varlamov 2151b3d093 [libc++][ranges][NFC] Update the status of predefined iterators.
`{back,front}_insert_iterator` and `ostream{,buf}_iterator` effectively
fully implement the One Ranges Proposal already, so mark them as done:
- the change to `difference_type` was made by D103273;
- default constructors and the associated default member initializers
  were removed by wg21.link/P2325 (implemented by D102468).

Also fix a stale template signature in the `<iterator>` synopsis.
2022-02-10 18:49:52 -08:00
Nikolas Klauser 8df7ff48e1 [libc++] Add LWG-issues from february 2022 plenary meeting
Reviewed By: ldionne, Quuxplusone, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119443
2022-02-10 23:21:28 +01:00
Martin Storsjö 8cffea061a [libcxx] Silence -Wformat-nonliteral warnings in the Windows support code
This brings the mingw build back to zero build warnings as it was
at some earlier time.

Differential Revision: https://reviews.llvm.org/D119134
2022-02-10 22:44:51 +02:00
Nikolas Klauser dcffa7d3e1 [libc++] Prepare string.modifiers tests for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119329
2022-02-10 21:43:18 +01:00
Louis Dionne 4ae83bb2b1 Update all LLVM documentation mentioning runtimes in LLVM_ENABLE_PROJECTS
We are moving away from building the runtimes with LLVM_ENABLE_PROJECTS,
however the documentation was largely outdated. This commit updates all
the documentation I could find to use LLVM_ENABLE_RUNTIMES instead of
LLVM_ENABLE_PROJECTS for building runtimes.

Note that in the near future, libcxx, libcxxabi and libunwind will stop
supporting being built with LLVM_ENABLE_PROJECTS altogether. I don't know
what the plans are for other runtimes like libc, openmp and compiler-rt,
so I didn't make any changes to the documentation that would imply
something for those projects.

Once this lands, I will also cherry-pick this on the release/14.x branch
to make sure that LLVM's documentation is up-to-date and reflects what
we intend to support in the future.

Differential Revision: https://reviews.llvm.org/D119351
2022-02-10 15:05:23 -05:00
Nikolas Klauser fb9646ed78 [libc++][P2321R2] Add vector<bool>::reference::operator=(bool) const
Add vector<bool>::reference::operator(bool) const

Reviewed By: Quuxplusone, ldionne, #libc

Spies: BRevzin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D117736
2022-02-10 20:27:46 +01:00
Jordan Rupprecht d6b1448809 [libc++] Remove usage of `_LIBCPP_DEBUG` in `__comp_ref_type` and replace with `_LIBCPP_DEBUG_LEVEL`
In libc++, checking specific `_LIBCPP_DEBUG_LEVEL` levels is used everywhere except in `comp_ref_type.h`. `_LIBCPP_DEBUG` is meant as a user-facing option, and internally libc++ should be checking the value of `_LIBCPP_DEBUG_LEVEL`.

The definition of `std::__debug_less` doesn't need to be hidden behind the macro, we can unconditionally expose it. It will be unused by `__comp_ref_type` unless debug mode is enabled.

This was suggested in D118940.

Reviewed By: #libc, philnik, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118950
2022-02-10 09:03:07 -08:00
Jordan Rupprecht 99e5c5256f [libc++] Fix std::__debug_less in c++17.
b07b5bd727 adds a use of `__comp_ref_type.h` to `std::min`. When libc++ is built with `-D_LIBCPP_DEBUG=0`, this enables `std::__debug_less`, which is only marked constexpr after c++17.

`std::min` itself is marked as being `constexpr` as of c++14, so by extension, `std::__debug_less` should also be marked `constexpr` for the same versions so that `std::min` can use it. This change lowers the guard from `> 17` to `> 11`.

Reproducer in godbolt: https://godbolt.org/z/ans3TGsj8

```

constexpr int x() { return std::min<int>({1, 2, 3, 4}); }

static_assert(x() == 1);
```

Reviewed By: #libc, philnik, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D118940
2022-02-10 08:52:17 -08:00
Mark de Wever fedbd264e3 [libc++][nfc] Add TEST_HAS_NO_LOCALIZATION.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119352
2022-02-10 17:44:37 +01:00
Nikolas Klauser c515b652a0 [libc++] Prepare string.{contains, ends_with, iterators, require, starts_with} tests for constexpr
Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119304
2022-02-10 16:56:05 +01:00
Nikolas Klauser 9d90531904 [libc++][ranges] Implement std::ranges::swap_ranges()
Implement `std::ranges::swap_ranges()`

Reviewed By: Quuxplusone, #libc, ldionne

Spies: ldionne, mgorny, jloser, libcxx-commits

Differential Revision: https://reviews.llvm.org/D116303
2022-02-10 16:01:45 +01:00
Nikolas Klauser c77de9490e [libc++][NFC] Reformat and modernize compressed_pair.h
Reviewed By: Quuxplusone, ldionne, Mordante, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D119335
2022-02-10 13:41:14 +01:00
Martin Storsjö 3dce6b329c [libcxx] [test] Fix the aligned storage test to work on Windows
Don't test alignment over 8 KB, which isn't supported on that
platform.

Differential Revision: https://reviews.llvm.org/D119348
2022-02-10 10:59:52 +02:00
Konstantin Varlamov 8f1d8785df [libc++][ranges] Implement `permutable`.
Differential Revision: https://reviews.llvm.org/D119222
2022-02-09 20:34:20 -08:00
Casey Carter 009791e0db [libcxx][test] optional's comparisons with optional are not portably constrained
so use them as concept test cases only with libc++.

Differential Revision: https://reviews.llvm.org/D116884
2022-02-09 14:00:24 -08:00
Mark de Wever ece0f70664 [libc++] Enables put_long_double test for glibc.
Glibc adds a +-sign for NaN-values when showpos fmtflags are set.

[tab:ios.fmtflags]
showpos generates a + sign in non-negative generated numeric output

Since NaNs aren't negative this behaviour seems correct. Enable the test
for glibc and add ifdefs to make sure the existing tests still pass.

This was noticed while working on D118971.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119260
2022-02-09 17:13:13 +01:00
Mark de Wever 11e4001ba2 [libc++][format][nfc] Header cleanup.
Remove the unneeded macro protection, forward declarations, and
includes.

Reviewed By: #libc, Quuxplusone, ldionne, philnik

Differential Revision: https://reviews.llvm.org/D118925
2022-02-09 17:12:04 +01:00
Mark de Wever d9d2ebbfcb [libc++][nfc] Use TEST_HAS_NO_WIDE_CHARACTERS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D119263
2022-02-09 17:10:12 +01:00
Louis Dionne f13dff68d1 [libc++] Try to fix the quoting of -isystem on Windows bots 2022-02-09 10:08:12 -05:00