Commit Graph

8741 Commits

Author SHA1 Message Date
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