Commit Graph

9195 Commits

Author SHA1 Message Date
Mark de Wever 2b5e3ef83c Revert "[libc++][CI] Updates Docker image."
This reverts commit f2f0dba818.

This Docker file doesn't work on the CI. It fails to clone the checkout.
This seems like an issue with a newer glibc on an older Docker where the
clone3() call fails.

This needs further investigation before relanding.
2022-06-08 19:18:35 +02:00
Louis Dionne 0392d425bb [libc++][NFC] Add missing 'return 0' 2022-06-08 12:56:20 -04:00
Louis Dionne 7611eb4869 [libc++][NFC] Simplify enable_if for std::copy optimization
Get rid of the __is_trivially_copy_assignable_unwrapped helper, which
is only used in one place, and use __iter_value_type instead of
iterator_traits<T>::value_type.

Differential Revision: https://reviews.llvm.org/D127230
2022-06-08 12:46:08 -04:00
Louis Dionne 90668adf68 [libc++] Make sure we add /llvm to the list of safe directories
With the new version of Git in Ubuntu Jammy (which is now what we use in
our Docker image), we need to add `/llvm` to the list of safe directories
to avoid failures.
2022-06-08 12:26:17 -04:00
Nikolas Klauser 916e9052ba [libc++] Implement ranges::adjacent_find
Reviewed By: Mordante, var-const, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D126610
2022-06-08 12:15:03 +02:00
Joe Loser b2aec7e6ed
Revert "[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX"
This reverts commit 3583826bb5.

Instead of marking the test unsupported for AIX, the choice is to bump the
timeout for CI as done in 76c7e1f2a8 and
222bd83d50

Differential Revision: https://reviews.llvm.org/D127242
2022-06-07 19:00:56 -06:00
Louis Dionne f3966eaf86 [libc++] Make the Debug mode a configuration-time only option
The debug mode has been broken pretty much ever since it was shipped
because it was possible to enable the debug mode in user code without
actually enabling it in the dylib, leading to ODR violations that
caused various kinds of failures.

This commit makes the debug mode a knob that is configured when
building the library and which can't be changed afterwards. This is
less flexible for users, however it will actually work as intended
and it will allow us, in the future, to add various kinds of checks
that do not assume the same ABI as the normal library. Furthermore,
this will make the debug mode more robust, which means that vendors
might be more tempted to support it properly, which hasn't been the
case with the current debug mode.

This patch shouldn't break any user code, except folks who are building
against a library that doesn't have the debug mode enabled and who try
to enable the debug mode in their code. Such users will get a compile-time
error explaining that this configuration isn't supported anymore.

In the future, we should further increase the granularity of the debug
mode checks so that we can cherry-pick which checks to enable, like we
do for unspecified behavior randomization.

Differential Revision: https://reviews.llvm.org/D122941
2022-06-07 16:33:53 -04:00
Mark de Wever b968c3452b [libc++] Removes _LIBCPP_AVAILABILITY_TO_CHARS.
After moving the std::to_chars base 10 implementation from the dylib to
the header the integral overloads of std::to_chars are available on all
platforms.

Remove the _LIBCPP_AVAILABILITY_TO_CHARS availability macro and update
the tests.

Depends on D125704

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D125745
2022-06-07 18:59:19 +02:00
Mark de Wever f2f0dba818 [libc++][CI] Updates Docker image.
- Updates the image to use Ubuntu Jammy.
- Installs GCC-12 as preparation to migrate to that GCC version.

Reviewed By: ldionne, #libc, jloser

Differential Revision: https://reviews.llvm.org/D126666
2022-06-07 18:52:31 +02:00
Mark de Wever dea7a8e616 [libc++] Don't use static constexpr in headers.
This was noticed in the review of D125704. In that commit only the new
table has been adapted. This adapts the existing tables.

Note since libc++'s charconv is backported to C++11 it's not possible to
use inline constexpr variables. The were introduced in C++17.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D126887
2022-06-07 18:47:44 +02:00
Louis Dionne 222bd83d50 [libc++] Forgot to bump the CI timeout everywhere 2022-06-07 10:01:01 -04:00
Louis Dionne 76c7e1f2a8 [libc++] Bump timeout to avoid spurious failures on AIX 2022-06-07 10:00:32 -04:00
Nikolas Klauser b79b2b6772 [libc++] Implement ranges::find_first_of
Reviewed By: Mordante, var-const, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D126529
2022-06-06 22:29:02 +02:00
Martin Storsjö dfa88927ae [libcxx] Omit dllimport in public headers in MinGW mode
In MinGW environments, thanks to slightly different code generation
and linker tricks, it's possible to link against a DLL C++ standard
library without dllimport attributes.

This allows using one single set of headers for linking against
either the DLL or a static library, leaving the decision entirely
up to the linking stage (where it can be switched with options like
-static-libstdc++).

This matches how libstdc++ headers work; there's no dllimport attributes
by default (unless the user has defined _GLIBCXX_DLL when including
headers).

This allows using one single set of headers while linking against
either a DLL or a static library, just like on Unix platforms.

This matches how libc++ has been used in MinGW configurations for
years (by first building the DLL, then configuring a static-only
build and installing on top, overwriting the libc++ config file
with one for static linking) by multiple MinGW toolchains, making
the dllimport-less use the de-facto tested configuration in the wild.

This also allows building all of libc++ in one single CMake
configuration, instead of having to do two separate builds on top of
each other.

(Linking against a DLL without dllimport can break if e.g. templates
use inconsistent visibility attributes - in cases where it still
works when using explicit dllimport; such a case was fixed in
948dd664c3 / D99932. With this as the
default configuration, we can catch such issues in CI.)

Differential Revision: https://reviews.llvm.org/D125924
2022-06-06 23:19:22 +03:00
Martin Storsjö 4940caaebb [libcxx] [test] Don't use header defines for detecting linking against a DLL
In clang-cl/MSVC environments, linking against a DLL C++ standard
library requires having dllimport attributes in the headers; this
has been used for detecting whether the tests link against a DLL,
by looking at the libc++ specific define
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS.

In mingw environments, thanks to slightly different code generation
and a couple linker tricks, it's possible to link against a DLL C++
standard library without dllimport attributes. Therefore, don't
rely on the libc++ specific header define for the detection.

Replace the detection with a runtime test.

Differential Revision: https://reviews.llvm.org/D125922
2022-06-06 23:19:22 +03:00
Louis Dionne a8cf78c739 [libc++][NFC] Move span tests under views.span 2022-06-06 14:06:05 -04:00
Louis Dionne 2453c515ac [libc++][NFC] Fix outdated comment in span test 2022-06-06 14:06:05 -04:00
Louis Dionne eebbfbcd50 [libc++][NFC] Add missing includes 2022-06-06 12:58:23 -04:00
Louis Dionne b8f6f9e741 [libc++] Avoid creating temporaries in unary expressions involving valarray
Currently, unary expressions involving valarray will create a temporary.
This leads to dangling references in expressions like `-a * b`, because
`-a` is a temporary and the resulting expression will refer to it. This
patch fixes the problem by creating a lazy expression to perform the unary
operation instead of eagerly creating a temporary valarray. This is
permitted by the Standard, which does not specify the exact type of
most expressions involving valarrays.

This is technically an ABI break, however I believe the actual potential
for breakage is very low.

rdar://90152242

Differential Revision: https://reviews.llvm.org/D125019
2022-06-06 12:58:23 -04:00
Louis Dionne 4eab04f849 [libc++] Remove a bunch of conditionals on _LIBCPP_DEBUG_LEVEL
Instead of providing two different constructors for iterators that
support the debug mode, provide a single constructor but leave the
container parameter unused when the debug mode is not enabled.

This allows simplifying all the call sites to unconditionally pass
the container, which removes a bunch of duplication in the container's
implementation.

Note that this patch does add some complexity to std::span, however
that is only because std::span has the ability to use raw pointers
as iterators instead of __wrap_iter. In retrospect, I believe it was
a mistake to provide that capability, and so it will be removed in a
future patch, along with the complexity added by this patch.

Differential Revision: https://reviews.llvm.org/D126993
2022-06-06 09:54:26 -04:00
Nikolas Klauser 8171586176 [libc++][ranges] Implement ranges::binary_search and ranges::{lower, upper}_bound
Reviewed By: Mordante, var-const, ldionne, #libc

Spies: sstefan1, libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D121964
2022-06-06 13:33:18 +02:00
David Spickett c8db406127 Revert "[libcxx] Temporarily skip Arm configs"
This reverts commit d4220af527.

Linaro bots are back online.
2022-06-06 08:25:51 +00:00
Joe Loser 3583826bb5
[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX
The `ranges.transform.pass.cpp` often times out on CI for AIX (32-bit and 64-bit)
only. Mark the test as `UNSUPPORTED` for `AIX` for now. It should be looked into in
the future.

Differential Revision: https://reviews.llvm.org/D127051
2022-06-05 13:45:29 -06:00
varconst 7c63cc198b [libc++][ranges][NFC] Fix a patch link in ranges status. 2022-06-03 20:39:00 -07:00
varconst faf43ad7ae [libc++][ranges][NFC] Mark range algorithms that are in progress. 2022-06-03 20:02:46 -07:00
Joe Loser 4fc502368a
[libc++][test] Skip string_view tests for other vendors on older modes
`string_view` is supported all the way back to C++03 as an extension in
`libc++`, and so many of the tests run in all standards modes for all vendors.
This is unlikely desired by other standard library vendors using our test suite.
So, disable the tests for vendors other than `libc++` in these older standards
modes.

Differential Revision: https://reviews.llvm.org/D126850
2022-06-03 13:51:49 -06:00
Nikolas Klauser ef8e918261 [libc++] Forward more often to memmove in copy
In D122982 I accidentally disabled the memmove optimization. This re-enables it and adds more cases where copy forwards to memmove.
Fixes https://github.com/llvm/llvm-project/issues/33687

Reviewed By: var-const, #libc, ldionne

Spies: pkasting, ayzhao, dcheng, xbolva00, libcxx-commits

Differential Revision: https://reviews.llvm.org/D124328
2022-06-03 20:29:18 +02:00
Nikolas Klauser a29a1a33ac [libc++] Fix conjunction/disjunction and mark a few LWG issues as complete
Fixes #54803
Fixes #53133

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D125221
2022-06-03 10:31:42 +02:00
Joe Loser 4be36dc77f
[libc++][test] Fix unused variable warning in string_view tests
In 6423a9f0ec, I accidentally thought this was
getting tested, but these variables are unused. Just remove the lines instead of
leaving them commented out.

Differential Revision: https://reviews.llvm.org/D126901
2022-06-02 13:33:37 -06:00
Will Hawkins 7b291b6f50 [libc++] Fix typo in comment at __optional_storage_base
Small typo fix(es) for struct definition of __optional_storage_base for
a reference type.

Reviewed By: #libc, jloser, philnik

Differential Revision: https://reviews.llvm.org/D126621
2022-06-02 19:46:04 +02:00
Mark de Wever 89818f2dc0 [libc++] Lets to_chars use header implementation.
This removes the duplicated code from the dylib. Instead the dylib will
call the new functions in the header. Since this code is unneeded it's
removed from the unstable ABI.

Depends on D125704

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D125761
2022-06-02 17:11:32 +02:00
Joe Loser 6423a9f0ec
[libc++][test] Enable some more string_view tests
Some test cases for `ends_with.ptr.pass` and `starts_with.ptr.pass` for
`string_view` are commented out, but work just fine. Uncomment them.

Differential Revision: https://reviews.llvm.org/D126849
2022-06-02 08:56:02 -06:00
Xing Xue dfaee3c9cf [libunwind][ci][AIX] Add libunwind to buildbot CI
Summary:
This patch changes scripts to add libunwind CI on AIX. Test config file ibm-libunwind-shared.cfg.in is introduced for testing on AIX.

Reviewed by: ldionne, MaskRay, libunwind, ibc++abi

Differential Revision: https://reviews.llvm.org/D126017
2022-06-02 09:03:10 -04:00
Mark de Wever b3d1142d09 [libc++][doc] Fixes unwanted list nesting. 2022-06-02 08:02:19 +02:00
Mark de Wever a15ae4139c [libc++] Make to_chars base 10 header only.
The functions to_chars and from_chars should offer 128-bit support. This
is the first step to implement 128-bit version of to_chars. Before
implementing 128-bit support the current code will be polished.

This moves the code from the dylib to the header in prepartion of

P2291 "Add Constexpr Modifiers to Functions to_chars and from_chars for
Integral Types in <charconv> Header"

Note some more cleanups will be done in follow-up commits
- Remove the _LIBCPP_AVAILABILITY_TO_CHARS from to_chars. With all code
  in the header the availablilty macro is no longer needed. This
  requires enabling the unit tests for additional platforms.
- The code in the dylib can switch to using the header implementation.
  This allows removing the code duplicated in the header and the dylib.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D125704
2022-06-02 08:00:31 +02:00
Joe Loser 93a375a15c
[libc++][test] Enable constexpr string comparison tests
Some tests in `string.view.comparison` are not enabled due to previous lack of
support for `constexpr std::string`. Now that it is implemented, we can enable
these tests.

Differential Revision: https://reviews.llvm.org/D126737
2022-06-01 19:26:20 -06:00
Mark de Wever 10c4eec278 [NFC][libc++][format] Improves naming.
Based on review comments in D110499.

Depends on D110499

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D125610
2022-06-01 21:05:31 +02:00
Mark de Wever 04a3146caa [libc++][format] Fixes string-literal formatting.
Formatting a string-literal had an off-by-one issue where the NUL
terminator became part of the formatted output.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D126665
2022-06-01 17:49:09 +02:00
David Spickett d4220af527 [libcxx] Temporarily skip Arm configs
The machine hosting these agents will be down
for maintenance June 2nd.

We (Linaro) will remove this once the agents are back online.

Differential Revision: https://reviews.llvm.org/D126688
2022-06-01 08:37:32 +00:00
zhijian 44d5221adb [libc++][CI] AIX does not have alternative for time_put_byname
Reviewers: David Tenty, Mark de Wever

Differential Revision: https://reviews.llvm.org/D126376
2022-05-31 14:20:34 -04:00
zhijian fa958c3a94 [libc++][CI] fixed "LOCALE_fr_FR_UTF_8" for my_facet for AIX
SUMMARY:

fixed "LOCALE_fr_FR_UTF_8" for my_facet for AIX

Reviewers: David Tenty, Mark de Wever

Differential Revision: https://reviews.llvm.org/D125927
2022-05-31 14:12:01 -04:00
zhijian 248287fe0a [libc++][CI] fixed convert_thousands_sep_ru_RU for Russian in the libcxx/test/support/locale_helpers.h for AIX
Reviewers: David Tenty, Mark de Wever

Differential Revision: https://reviews.llvm.org/D125923
2022-05-31 13:55:59 -04:00
zhijian 9d1b260fae [libc++][CI][AIX] change grouping() return value of std::moneypunct_byname for en_US.UTF-8
Reviewers: David Tenty, Mark de Wever
Differential Revision: https://reviews.llvm.org/D126474
2022-05-31 13:20:31 -04:00
Mark de Wever 9e5c293492 [libc++] Removes __cpp_lib_monadic_optional.
P0798R8 "Monadic operations for std::optional" has been implemented, so
this LWG issue can be adopted.

During review it was discovered another paper bumped the macro. The
part affecting optional of this paper is done, the variant isn't. The
status page is updated to reflect the current state.

Implements
- LWG 3621 Remove feature-test macro __cpp_lib_monadic_optional

Updates status of
- P2231R1 Missing constexpr in std::optional and std::variant

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D125813
2022-05-31 19:18:34 +02:00
Joe Loser 40e52d3033
[libc++][test] Enable some ADL robust algorithm tests
Some algorithm ADL robustness tests are commented out, but work as is. Uncomment
them.

Differential Revision: https://reviews.llvm.org/D126670
2022-05-30 17:50:08 -06:00
Louis Dionne fe7cd1d199 [libc++][NFC] Improve comment about vector and string base class ABI flags 2022-05-30 16:26:49 -04:00
Louis Dionne f8239eec8d [libc++] Reduce the verbosity when running the libc++ Lit configuration
We print the same information as before, however we do it with less
verbosity unless `--debug` is used.
2022-05-30 12:03:24 -04:00
Joe Loser 7f1e048041
[libc++][test] Remove Clang <= 3.7 workaround in is_default_constructible test
Clang 3.7 and below is not actively used or supported in the test suite now, so
remove the workaround in the test.

Differential Revision: https://reviews.llvm.org/D126603
2022-05-29 11:57:06 -06:00
Mark de Wever 773c6e4358 [libc++][doc] Clarify wording on the status page.
Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D125630
2022-05-29 15:33:26 +02:00
Mark de Wever 4cb184ce1c [libc++] Adds __format_string as nasty macro.
Both D121530 and D125606 had issues with this macro.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D125629
2022-05-29 15:32:11 +02:00