Commit Graph

9013 Commits

Author SHA1 Message Date
Louis Dionne d0af4276d6 [libc++] Switch to the new testing configurations by default
We've been meaning to remove support for the legacy testing configuration
for a long time. This patch switches the default from the legacy config
to the appropriate new-style configuration based on a few hints.

We've been running with the new-style configuration for more than a year
in our CI, however it's possible that this will uncover issues with some
users that run the tests on platforms that we don't support yet with the
new-style configs. Unfortunately, there is no way to know about it other
than to land this patch and see whether anything breaks.

Differential Revision: https://reviews.llvm.org/D121632
2022-03-17 14:26:56 -04:00
David Spickett 14452c4958 Revert "[libcxx][CI] Use temporary clang-13 bots for Arm/AArch64"
This reverts commit 406d418c0c.

Our regular bots are now using clang-13. The previous set will remain
online for a while to check reviews that haven't rebased to include
this change yet.

Differential Revision: https://reviews.llvm.org/D121894
2022-03-17 10:49:49 +00:00
Nikolas Klauser 1458458b55 [libc++] Remove <utility> includes
Reviewed By: ldionne, Quuxplusone, #libc

Spies: libcxx-commits, arphaman

Differential Revision: https://reviews.llvm.org/D121054
2022-03-17 00:12:33 +01:00
Nikolas Klauser 14324fa428 [libc++] Add warning pragma macros in the test suite
Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D121552
2022-03-17 00:11:20 +01:00
Louis Dionne 197737b539 [libc++][NFC] Reindent release notes bullet points 2022-03-16 17:26:32 -04:00
Louis Dionne 4001b82b15 [libc++][NFC] Rename member variables to avoid shadowing conflict in future patch 2022-03-16 15:45:38 -04:00
Mark de Wever e72cedcb01 [libc++][NFC] Add TEST_HAS_NO_INCOMPLETE_RANGES.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D121515
2022-03-16 17:42:48 +01:00
Louis Dionne 78669c4185 [libc++][tests] Use CMake provided paths for includes and libdir instead of hardcoding them
In the new-style testing configurations, we were hardcoding paths to the
`include` and `lib` directories, which was incorrect but always went
unnoticed because the hardcoded values always happened to match the
actual value.

When using new-style configs with the bootstrapping build, this falls
appart -- and we never noticed this because the bootstrapping build was
still using old style configs.

This patch removes the %{install} substitution, which makes it too
tempting to hardcode installation paths, and it also switches the
bootstrapping build to actually using new-style configs like we
always intended to do.

Differential Revision: https://reviews.llvm.org/D121700
2022-03-16 12:35:06 -04:00
Louis Dionne 0bc451e7e1 [libc++] Fix incorrect availability markup for bad_optional_access & friends
In 7fb40e1569, I changed the availability for bad_optional_access and
friends from macOS 10.14 to 10.13 after conducting an investigation on
old dylibs. It turns out that macOS 10.13 did have bad_optional_access,
however the dylib on iOS didn't match the dylib on macOS, so those
exception classes were only introduced in iOS 12.

Thanks to Aditya Kumar for noticing this.

Differential Revision: https://reviews.llvm.org/D121735
2022-03-16 09:03:22 -04:00
Louis Dionne 0389462587 [libc++] Do not install the C++ ABI library's headers as part of libc++'s build
It's the role of the C++ ABI library to install its own headers, not libc++.
This fixes an existing issue causing spurious CI failures where both libc++
and libc++abi would try to install <cxxabi.h> & friends in the same location,
leading to failures during the installation step.

Differential Revision: https://reviews.llvm.org/D121706
2022-03-16 08:53:47 -04:00
Louis Dionne e39095a32e [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite
This should make CI consistent on all the compilers we support. Most of
this patch is working around various warnings emitted by GCC in our code
base, which are now being shown when we compile the tests.

After this patch, the whole test suite should be warning free on all
compilers we support and test, except for a few warnings on GCC that
we silence explicitly until we figure out the proper fix for them.

Differential Revision: https://reviews.llvm.org/D120684
2022-03-15 17:17:54 -04:00
Louis Dionne d4c39f1ab9 [libc++] Add workaround to avoid breaking users of <span> when <ranges> are disabled
Back in 3a208c6894, we implemented the range-based constructor for <span>.
However, in doing so, we removed a previous non-standard constructor that
we provided before shipping <ranges>. Unfortunately, that breaks code that
was relying on a range-based constructor until we ship all of <ranges>.

This patch reintroduces the old non-conforming constructors and tests
that were removed in 3a208c6894 and uses them whenever <ranges> is
not provided (e.g. in LLVM 14). This is only a temporary workaround
until we enable <ranges> by default in C++20, which should hopefully
happen by LLVM 15.

The goal is to cherry-pick this workaround back to the LLVM 14 release
branch, since I suspect the constructor removal may otherwise cause
breakage out there, like the breakage I saw internally.

We could have avoided this situation by waiting for C++20 to be finalized
before shipping std::span. For example, we could have guarded it with
something like _LIBCPP_HAS_NO_INCOMPLETE_RANGES to prevent users from
accidentally starting to depend on it before it is stable. We did not
have these mechanisms when std::span was first implemented, though.

Differential Revision: https://reviews.llvm.org/D121626
2022-03-15 16:36:33 -04:00
Louis Dionne d4d8f03619 [libc++] Update URL to old libc++ dylibs 2022-03-15 16:18:51 -04:00
Dimitry Andric 7ab1ab0db4 [libc++] Make __dir_stream visibility declaration consistent
The class `__dir_stream` is currently declared in two places: as a
top-level forward declaration in `directory_iterator.h`, and as a friend
declaration in class `directory_entry`, in `directory_entry.h`.

The former has a `_LIBCPP_HIDDEN` attribute, but the latter does not,
causing the Firefox build to complain about the visibility not matching
the previous declaration. This is because Firefox plays games with
pushing and popping visibility.

Work around this by making both `__dir_stream` declarations consistently
use `_LIBCPP_HIDDEN`.

Reviewed By: ldionne, philnik, #libc

Differential Revision: https://reviews.llvm.org/D121639
2022-03-15 19:30:35 +01:00
Louis Dionne f6fd1c1438 [libc++] Overhaul all tests for assertions and debug mode
Prior to this patch, there was no distinction between tests that check
basic assertions and tests that check full-fledged iterator debugging
assertions. Both were disabled when support for the debug mode is not
provided in the dylib, which is stronger than it needs to be.

Furthermore, all of the tests using "debug_macros.h" that contain more
than one assertion in them were broken -- any code after the first
assertion would never be executed.

This patch refactors all of our assertion-related tests to:
1. Be enabled whenever they can, i.e. basic assertions tests are run
   even when the debug mode is disabled.
2. Use the superior `check_assertion.h` (previously `debug_mode_helper.h`)
   instead of `debug_macros.h`, which allows multiple assertions in the
   same program.
3. Coalesce some tests into the same file to make them more readable.
4. Use consistent naming for test files -- no more db{1,2,3,...,10} tests.

This is a large but mostly mechanical patch.

Differential Revision: https://reviews.llvm.org/D121462
2022-03-15 10:56:34 -04:00
Louis Dionne 849e749d7f [libc++][NFC] Remove several redundant #if _LIBCPP_STD_VER > 17 in <span>
It turns out that the whole header is only enabled in C++20 and above,
so these checks were redundant (and always true).

Differential Revision: https://reviews.llvm.org/D121604
2022-03-14 13:53:30 -04:00
Joe Loser d2baefae68
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI.
All supported compilers that support C++20 now support concepts. So, remove
`_LIB_LIBCPP_HAS_NO_CONCEPTS` in favor of `_LIBCPP_STD_VER > 17`. Similarly in
the tests, remove `// UNSUPPORTED: libcpp-no-concepts`.

Differential Revision: https://reviews.llvm.org/D121528
2022-03-13 12:32:06 -04:00
Mark de Wever 5ac257da35 [libc++] Remove unneeded tests.
As suggested in D120742.
2022-03-12 12:22:38 +01:00
Mark de Wever ec1a7647ee [libc++][NFC] Use TEST_HAS_NO_EXCEPTIONS.
The test should use the already available test macro.
2022-03-12 12:22:25 +01:00
Mark de Wever 5f016f5b7a [libc++] Add a missing test case. 2022-03-12 12:22:15 +01:00
Nikolas Klauser ee0f8c4010 [libc++][ranges] Implement ranges::find{, _if, _if_not}
Reviewed By: var-const, #libc, ldionne

Spies: ldionne, tcanens, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D121248
2022-03-12 01:46:02 +01:00
Louis Dionne a805a15b28 [libc++] Remove workaround for missing declarations on Windows store apps
We don't need preprocessor logic to exclude those declarations when compiling for
the Windows App Store, because that is handled by using_if_exists now.

Differential Revision: https://reviews.llvm.org/D108632
2022-03-11 09:08:30 -05:00
Louis Dionne 21f73d5826 [libc++] Remove workaround for C11 features on compilers that don't support using_if_exists
Instead of carrying around #ifdefs to determine whether those functions
are available on the platform, unconditionally use the using_if_exists
attribute to import it into namespace std only when available. That was
the purpose of this attribute from the start.

This change means that trying to use libc++ with an old SDK (or on an
old platform for platforms that ship system headers in /usr/include)
will require a recent Clang that supports the using_if_exists attribute.
When using an older Clang or GCC, the underlying platform has to support
a C11 standard library.

Differential Revision: https://reviews.llvm.org/D108203
2022-03-11 09:06:43 -05:00
Louis Dionne 611469c5c5 [libc++] Remove raw call to debug handler from __char_traits_length_checked
As a fly-by fix, also move it closer to where it is needed, and add a
comment explaining the existence of this weird function.

Differential Revision: https://reviews.llvm.org/D121231
2022-03-11 09:05:29 -05:00
Louis Dionne 071762199f [libc++] Add tests for the content of <cstddef>
As discussed in D114786.

Differential Revision: https://reviews.llvm.org/D121110
2022-03-10 15:54:15 -05:00
Louis Dionne 553ab7a090 [libc++] Remove operator-> from iterator archetypes that don't need it
operator-> is not a requirement for most iterators, so remove it. To
account for this change, the `common_iterator.operator->` test needs to
be refactored quite a bit -- improve test coverage while we're at it.

Differential Revision: https://reviews.llvm.org/D118400
2022-03-10 15:52:34 -05:00
Louis Dionne 28e82982fe [libc++] Bump minimum compiler requirements
Now that we've branched for the LLVM 14 release, our support window
moves to clang-13 and clang-14. Similarly, AppleClang 13 has been
released for some time now, so that should be the oldest compiler
we support, per our policy.

A possible follow-up would be to remove _LIBCPP_HAS_NO_CONCEPTS, since
I don't think we support any compiler that doesn't support concepts
anymore.

Differential Revision: https://reviews.llvm.org/D118831
2022-03-10 08:59:19 -05:00
Louis Dionne 6b9e0af8db [libc++] Add test coverage for std::shared_ptr<const T>
Those tests were extracted from D120996.

Differential Revision: https://reviews.llvm.org/D121340
2022-03-10 08:49:31 -05:00
Louis Dionne a54d028895 Revert "[libc++] Remove extension to support allocator<const T>"
This reverts commit 276ca873. That commit has quite a history at this
point. It was first landed in dbc647643577, which broke std::shared_ptr<T const>
and was reverted in 9138666f5. It was then re-applied in 276ca873, with
the std::shared_ptr issue fixed, but it caused widespread breakage at
Google (which suggests it would cause similar breakage in the wild too),
so now I'm reverting again.

Instead, I will add a escape hatch that vendors can turn on to enable
the extension and perform a phased transition over one or two releases
like we sometimes do when things become non-trivial.
2022-03-09 17:04:18 -05:00
Louis Dionne 54c4c01553 [libc++] Enable format_to and vformat_to tests even outside of Debug mode
These tests don't seem specific to the debug mode, so it makes sense to
run them even when the debug mode is disabled. When we run with the debug
mode enabled, we'll get the out-of-bounds checking that this test seems
to be concerned with.

Differential Revision: https://reviews.llvm.org/D121241
2022-03-09 12:38:30 -05:00
Mark de Wever 3925f98de4 [libc++][NFC] Cleanups in <charconv>.
Based on review comments in D97705 applied some code cleanups in
<charconv>. The header now uses a more recent libc++ style.

Reviewed By: Quuxplusone, #libc, philnik

Differential Revision: https://reviews.llvm.org/D121223
2022-03-09 17:52:02 +01:00
Louis Dionne 0f622bd281 [libc++] Don't manually override NDEBUG in the dylib build
LIBCXX_ENABLE_ASSERTIONS does not have any relationship to the `assert`
macro -- it only controls assertions that are internal to the library.
Playing around with `NDEBUG` only muddies the picture further than it
already is.

Also, remove a failing assertion in the benchmarks. That assertion had
never been exercised because we defined `NDEBUG` manually, and it was
failing since we introduced the ability to generate a benchmark vector
with the Quicksort adversary ordering (which is obviously not sorted).

This was split off of https://llvm.org/D121123.

Differential Revision: https://reviews.llvm.org/D121244
2022-03-09 10:05:38 -05:00
David Spickett 406d418c0c [libcxx][CI] Use temporary clang-13 bots for Arm/AArch64
This is a stop gap until I am able to update the usual bots
to clang-13.

Differential Revision: https://reviews.llvm.org/D121224
2022-03-09 09:16:41 +00:00
Martin Storsjö 9286a8238b [libcxx] [test] XFAIL the get/put long_double_ru_RU tests on Glibc < 2.27
Those older versions used a different monetary decimal separator.
To avoid unnecessary churn to support that, just XFAIL the test
on those older versions. (Up until
df1e43c496, the whole test was XFAILed
on all versions of glibc.)

Differential Revision: https://reviews.llvm.org/D120979
2022-03-09 10:17:20 +02:00
Martin Storsjö abe46776f3 [libcxx] [test] Fix the classic_table test on Windows
On Windows, constants like F::alpha and F::print are bitmasks
consisting of multiple bits (e.g. F::alpha consisting of both the
bits F::upper and F::lower). In such a case, we can't check that
all the bits from all the expected constants are set. Instead,
check that (p[i] & mask) != 0 returns the expected value.

Differential Revision: https://reviews.llvm.org/D120802
2022-03-09 10:12:55 +02:00
Arthur O'Dwyer 2b0ec7ca44 [libc++] Fix a use-after-move introduced in D118003.
Thanks to Eric Fiselier for catching this!
2022-03-08 21:57:40 -05:00
Nikolas Klauser c2cd15a665 [libc++][ranges] Implement ranges::mismatch
Implement `ranges::mismatch`

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D117817
2022-03-08 23:20:40 +01:00
Louis Dionne 508d7dd2a2 [libc++] Remove stray #undef
I think that was left after we removed _CONSTEXPR_TERNARY based on a
review comment -- the #undef was never removed.
2022-03-08 16:34:28 -05:00
Louis Dionne 276ca87382 [libc++] Remove extension to support allocator<const T>
This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.

This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.

This is a re-application of dbc647643577, which was reverted in 9138666f5
because it broke std::shared_ptr<T const>. Tests have now been added and
we've made sure that std::shared_ptr<T const> wouldn't be broken in this
version.

Differential Revision: https://reviews.llvm.org/D120996
2022-03-08 15:05:12 -05:00
Louis Dionne 3f66882417 [libc++][NFC] Rename ostreambuf_iterator test 2022-03-08 14:49:20 -05:00
Arthur O'Dwyer 79d08e398c [libc++] "Bottom-up heapsort" improvement to sort_heap.
https://en.wikipedia.org/wiki/Heapsort#Bottom-up_heapsort
In `pop_heap` specifically, the item we insert at the top and
sift downward is guaranteed to be leaf-sized, so we expect it
to go pretty far down. Sift it down as if it were INT_MIN, and
then bubble it back up if needed.
Also known as "heapsort with bounce."

Numbers are here: https://godbolt.org/z/cvfnYW6fe

Fixes #10008.

Differential Revision: https://reviews.llvm.org/D118003
2022-03-08 13:48:21 -05:00
Arthur O'Dwyer e3d3755c47 [libc++] Complexity regression tests for make_heap and sort_heap.
Reviewed as part of D118003.
2022-03-08 13:48:20 -05:00
Louis Dionne 95c0f2d115 [libc++] Remove workarounds for re-defining _LIBCPP_ASSERT in the test suite
As a fly-by fix, enable the complexity-changing assertions in __debug_less
only when the full debug mode is enabled, since debugging level 0 is usually
understood to only contain basic assertions that do not change the complexity
of algorithms.

Differential Revision: https://reviews.llvm.org/D121129
2022-03-08 10:41:38 -05:00
Nikolas Klauser 7aef4a0cae [libc++] Enable more clang-tidy checks and list potential candidates
These are some checks that make sense in libc++ IMO. The checks after `#TODO: investigate these checks` are candidates, but they can't be enabled without some cleanup.

Reviewed By: ldionne, #libc

Spies: aheejin, libcxx-commits

Differential Revision: https://reviews.llvm.org/D120925
2022-03-08 14:14:55 +01:00
Kai Luo a7adf7b9e9 [libcxx][AIX] Remove `LIBCXX-AIX-FIXME` in isalwayslockfree check after 86478c7ad8
The workaround has been removed via https://reviews.llvm.org/D119931, checks passed on AIX-32.

Reviewed By: ldionne, daltenty, jsji, #libc

Differential Revision: https://reviews.llvm.org/D121081
2022-03-08 01:23:33 +00:00
Louis Dionne 9138666f54 Revert "[libc++] Remove extension to support allocator<const T>"
This reverts commit bed3240bf7.

I will need to add more tests for std::shared_ptr<T const> before
re-landing this.
2022-03-07 17:35:12 -05:00
Arthur O'Dwyer 844a9c0ef4 [libc++] Make common_iterator's proxy types into aggregates.
Saves one move in each case, which is basically nothing perf-wise;
this is more about simplifying the code.

Differential Revision: https://reviews.llvm.org/D121130
2022-03-07 15:44:10 -05:00
Martin Storsjö ebde6fc23b [libcxxabi] Fix cmake order dependency wrt dllexporting
If LIBCXX_ENABLE_SHARED isn't explicitly set on the cmake command
line, isn't set in the cache, and the libcxxabi project is configured
before libcxx, then LIBCXX_ENABLE_SHARED isn't defined yet. Once
the libcxx cmake project has been parsed, LIBCXX_ENABLE_SHARED would
have been set to its default value of ON.

This makes sure that the symbols are properly dllexported in such
a configuration scenario.

Differential Revision: https://reviews.llvm.org/D120982
2022-03-07 15:36:04 -05:00
Louis Dionne bed3240bf7 [libc++] Remove extension to support allocator<const T>
This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.

This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.

Differential Revision: https://reviews.llvm.org/D120996
2022-03-07 15:36:03 -05:00
Jinsong Ji 706e37c8e0 [libc++][AIX][test] Enable put_double/long_double locale tests
AIX print -0.0 , inf, nan differently, which are causing the test
failures. We are OK for most other tests.

This patch remove the tests related these limitations conditionally on AIX,
so that we can enable the other tests to avoid losing test coverage.

The general direction is:

```
if strings don't differ between environments, keep the string literal "INF" and the padding, instead of folding them into variables.
```

Reviewed By: ldionne, #libc, Mordante

Differential Revision: https://reviews.llvm.org/D120448
2022-03-07 14:21:28 -05:00
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