Commit Graph

7991 Commits

Author SHA1 Message Date
Joe Loser 9451d9da95
[libc++][NFC] s/enable_if<...>::type/enable_if_t<...> in span
There is some use of `enable_if<...>::type` when the rest of the file
uses `enable_if_t`. So, use `enable_if_t` consistently throughout.
2021-09-27 19:21:07 -04:00
Louis Dionne 1e628d0c14 [libc++] Do not enable P1951 before C++23, since it's a breaking change
In reaction to the issues raised by Richard in https://llvm.org/D109066,
this commit does not apply P1951 as a DR in previous standard modes,
since it breaks valid code.

I do believe it should be applied as a DR, however ideally we'd get some
sort of statement from the Committee to this effect (and all implementations
would behave consistently). In the meantime, only implement P1951 starting
with C++23 -- we can always come back and apply it as a DR if that's what
the Committee says.

Differential Revision: https://reviews.llvm.org/D110347
2021-09-27 17:06:44 -04:00
Louis Dionne a64e46880c [libc++][NFC] Update status of old issue LWG2560 -- we implement it properly 2021-09-24 14:22:09 -04:00
Louis Dionne ff0b62dd88 [libc++][NFC] Mark LWG3158 as implemented
It has been implemented in 59e26308e6.
2021-09-24 14:11:52 -04:00
Mark de Wever 15dfe78340 [NFC][libc++] Update clang-format style.
Changes the style as requested by @ldionne in D103368.

Reviewed By: ldionne, #libc, Quuxplusone

Differential Revision: https://reviews.llvm.org/D109835
2021-09-24 19:28:07 +02:00
Louis Dionne 03fb6f04f9 [libc++] Refactor the tests for common_view to reduce duplication 2021-09-24 13:23:44 -04:00
Mark de Wever f881776175 [libc++] Require a C++20 capable compiler.
This enforces libcxx and its benchmarks are compiled by a C++20 capable
compiler. Based on review comments in D103413.

Differential Revision: https://reviews.llvm.org/D110338
2021-09-24 11:38:26 -04:00
Louis Dionne 1295694364 [libc++][NFC] Add missing link to a ranges review 2021-09-24 11:37:38 -04:00
David Spickett 5efafc3e65 Revert "[libcxx][pretty printers] Import gdb module in gdb feature check"
This reverts commit 0c2a454845.

This was my mistake. When gdb can find its data directory it'll
import it automatically. If it can't (like when you're using a
version from a build folder) you need to give it the data
directory path.

We're safe to assume gdb is installed for testing purposes
so it'll import it for us.
2021-09-24 09:11:28 +00:00
David Spickett 0c2a454845 [libcxx][pretty printers] Import gdb module in gdb feature check
Earlier versions of GDB do not do this automatically.
(from my checks 8.3 does not and 9.2 does)
2021-09-24 09:04:44 +00:00
David Spickett 0a36c72dee [libcxx][pretty printers] Check GDB Python scripting support
I found this after upgrading from Ubuntu bionic (gdb 8.1.1) to
Focal (gdb 9.2). (where this test fails, but that's for a
different patch)

9.2 allows you to set breakpoint commands from
Python, which was added in 8.3.
(bintutils a913fffbdee21fdd50e8de0596358be425775678
"Allow breakpoint commands to be set from Python")

The reason this test never failed before was because it did so
silently. "source <python file>" doesn't fail even if that script
raises an Exception.

To fix this extend the gdb lit feature to check that:
* gdb exists
* has Python support
* allows you to set breakpoint commands

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D110334
2021-09-24 08:32:11 +00:00
Louis Dionne a6406ce18c [libc++][NFC] Refactor the std::reverse_view tests
Mostly, remove the global assumption that all ranges have size 8.
I should have called this out during the initial review.
2021-09-23 18:35:56 -04:00
Louis Dionne e6126faba0 [libc++] Remove unused macro in __config
That macro was being defined but not used anywhere in libc++, so it
must be safe to remove it.

As a fly-by fix, also remove mentions of this macro in other places
in LLVM, to make sure they were not depending on the value defined in
libc++.

Differential Revision: https://reviews.llvm.org/D110289
2021-09-23 13:09:32 -04:00
Louis Dionne fd04fd9ac9 [libc++] Use CMake interface targets to setup benchmark flags
This is a re-application of da0592e4c8 which was reverted in
1454018dc1 because it was incompatible with older CMakes.
Instead, disable the benchmarks when CMake is too old to
support those idioms.

Differential Revision: https://reviews.llvm.org/D110285
2021-09-23 12:14:01 -04:00
Louis Dionne 1711a6ec65 [libc++] Remove uses of _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
All supported compilers provide support for variable templates now.

Differential Revision: https://reviews.llvm.org/D110284
2021-09-23 08:53:59 -04:00
Kent Ross f4abdb0c07 [libc++][spaceship] Implement std::pair::operator<=>
Implements parts of P1614, including synth-three-way and three way comparison for std::pair.

Reviewed By: #libc, Quuxplusone, Mordante

Differential Revision: https://reviews.llvm.org/D107721
2021-09-22 22:36:46 -07:00
Arthur O'Dwyer 85d4e29fd8 [libc++] Fix __wrap_iter to be a proper contiguous iterator.
Instead of overloading `__to_address`, let's specialize `pointer_traits`.
Function overloads need to be in scope at the point where they're called,
whereas template specializations do not. (User code can provide pointer_traits
specializations to be used by already-included library code, so obviously
`__wrap_iter` can do the same.)

`pointer_traits<__wrap_iter<It>>` cannot provide `pointer_to`, because
you generally cannot create a `__wrap_iter` without also knowing the
identity of the container into which you're trying to create an iterator.
I believe this is OK; contiguous iterators are required to provide
`to_address` but *not* necessarily `pointer_to`.

Differential Revision: https://reviews.llvm.org/D110198
2021-09-22 18:51:46 -04:00
Louis Dionne 474816384f [libc++][NFC] Add missing whitespace in <compare> 2021-09-22 16:41:18 -04:00
Louis Dionne cb793e1a36 [libc++][NFCI] Remove uses of _LIBCPP_INLINE_VAR
All supported compilers provide support for inline variables in C++17 now.
Also, as a fly-by fix, replace some uses of _LIBCPP_CONSTEXPR by just
constexpr.

The only exception in this patch is `std::ignore`, which is provided
prior to C++17. Since it is defined in an anonymous namespace, it always
has internal linkage anyway, so using an inline variable there doesn't
provide any benefit. Instead, `inline` was removed entirely on `std::ignore`.

Differential Revision: https://reviews.llvm.org/D110243
2021-09-22 16:03:00 -04:00
Joe Loser 9fb3669429
[libc++][test] Remove disable_missing_braces_warning.h from tests
Several tests include `disable_missing_braces_warning.h` but do not need
to. Remove the include.

Inspired from discussion at https://reviews.llvm.org/D109668

Reviewed By: ldionne, #libc, Mordante

Differential Revision: https://reviews.llvm.org/D109711
2021-09-22 16:00:16 -04:00
Joe Loser 400b33e18d
[libc++] Disallow volatile types in std::allocator
LWG 2447 is marked as `Complete`, but there is no `static_assert` to
reject volatile types in `std::allocator`. See the discussion at
https://reviews.llvm.org/D108856.

Add `static_assert` in `std::allocator` to disallow volatile types. Since this
is an implementation choice, mark the binding test as `libc++` only.

Remove tests that use containers backed by `std::allocator` that test
the container when used with a volatile type.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D109056
2021-09-22 11:47:38 -04:00
Louis Dionne b034593c87 [libc++][NFC] Add link to Discord channel from documentation 2021-09-22 11:13:53 -04:00
Louis Dionne 84d07f4dfe [libc++] Add some missing _LIBCPP_HIDE_FROM_ABI markup
Also, as a fly-by fix, use `inline` directly to define inline variables
(all compilers support it).

Differential Revision: https://reviews.llvm.org/D110208
2021-09-21 23:11:23 -04:00
Joe Loser bc4a23811b
[libc++][test] Fix iterator assertion in span.cons/deduct.pass.cpp
Two tests in span.cons/deduct.pass.cpp accidentally check whether the
iterator range from member begin and member end are equivalent to the
ones from free begin and free end. This is obviously true and not
intended. Correct the intent by comparing the size/data from the span
with the source input.

While in the neighborhood, add test for const int arr[N], remove extraneous
type aliases, unused <type_traits> header, and the
disable_missing_braces_warning.h include.

Reviewed By: Quuxplusone, ldionne, #libc

Differential Revision: https://reviews.llvm.org/D109668
2021-09-21 22:46:08 -04:00
David Tenty 7a320b279d [libcxx][AIX] Remove locale fallbacks for old OS levels
These routines were add years ago during initial porting attempts to AIX and are mostly build hacks for routines which we're missing at the time, but are available now on recent AIX OS levels.

Thus builds on modern AIX OS levels no longer need these and they cause problems if you try to build the library with a generic triple (i.e. powerpc-ibm-aix) as we'll pull them in and encounter duplicate definitions from the OS.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D110183
2021-09-21 21:14:50 -04:00
Louis Dionne f8b1cc3657 [libc++abi] Remove unnecessary atomic_support.h header from libc++abi
The file was a duplicate of atomic_support.h in libc++. Since we now
require the libc++ sources in order to build libc++abi, it's OK to
remove this duplication.

Thanks to @chandlerc for noticing this.

Differential Revision: https://reviews.llvm.org/D110103
2021-09-21 19:55:21 -04:00
Yuanfang Chen 45c0ebe00e [libc++] Surpress -Wunused-value warning in variant
The idiom helps with parameter unpacking so the return value is not
important. Make it explicit.
2021-09-21 15:33:10 -07:00
Arthur O'Dwyer c9af0e61fa [libc++] counting_semaphore should not be default-constructible.
Neither the current C++2b draft, nor any revision of [p1135],
nor libstdc++, claims that `counting_semaphore` should be
default-constructible. I think this was just a copy-paste issue
somehow.

Also, `explicit` was missing from the constructor.

Also, `constexpr` remains missing; but that's probably more of a
technical limitation, since apparently there are some platforms
where we don't (can't??) use the atomic implementation and
have to rely on pthreads, which obviously isn't constexpr.

Differential Revision: https://reviews.llvm.org/D110042
2021-09-21 16:19:31 -04:00
Mark de Wever a04a6ce772 [libc++][format] Adds parser std-format-spec.
This implements the generic std.format.spec framework for all types.

The Unicode support will be added in a separate patch.

Implements parts of:
- P0645 Text Formatting

Completes:
- LWG-3242 std::format: missing rules for arg-id in width and precision
- P1892 Extended locale-specific presentation specifiers for std::format

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D103368
2021-09-21 18:29:58 +02:00
Arthur O'Dwyer d5db71d19f [libc++] [P0919] Some belated review on D87171.
- Simplify the structure of the new tests.
- Test const containers as well as non-const containers,
    since it's easy to do so.
- Remove redundant enable-iffing of helper structs' member functions.
    (They're not instantiated unless they're called, and who would call them?)
- Fix indentation and use more consistent SFINAE method in <unordered_map>.
- Add _LIBCPP_INLINE_VISIBILITY on some swap functions.

Differential Revision: https://reviews.llvm.org/D109011
2021-09-20 14:46:38 -04:00
Arthur O'Dwyer df81bb71aa [libc++] [LIBCXX-DEBUG-FIXME] Constexpr char_traits::copy mustn't compare unrelated pointers.
Now that __builtin_is_constant_evaluated() is present on all supported
compilers, we can use it to skip the UB-inducing assert in cases where
the computation might be happening at constexpr time.

Differential Revision: https://reviews.llvm.org/D101674
2021-09-20 14:44:59 -04:00
Arthur O'Dwyer d7d7060127 Eliminate _LIBCPP_EQUAL_DELETE in favor of `=delete`.
All supported compilers have supported `=delete` as an extension
in C++03 mode for many years at this point.

Differential Revision: https://reviews.llvm.org/D109942
2021-09-20 13:26:59 -04:00
Alfonso Gregory a2c319fdc6 [LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project
This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D107717
2021-09-16 18:29:57 +02:00
Nehal J Wani 1613ab8a4a [libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list
When `libcxx` or `libcxxabi` is built with `-DLLVM_USE_SANITIZER=MemoryWithOrigins`
**and** `-DLIBCXX[ABI]_USE_COMPILER_RT=ON`, all of the `LIBCXX[ABI]_SUPPORTS_*_FLAG`
checks fail, since the value of `CMAKE_REQUIRED_FLAGS` is not set correctly.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=51774

Reviewed By: #libc, #libc_abi, compnerd, ldionne

Differential Revision: https://reviews.llvm.org/D109342
2021-09-16 18:26:29 +02:00
Muiez Ahmed 4247381e26 [SystemZ][z/OS] Missing wchar functions libc++
The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.

Differential Revision: https://reviews.llvm.org/D98207
2021-09-13 09:43:21 -04:00
Arthur O'Dwyer 7ba3627b54 [libc++] Clean up test_iterators.h. NFCI.
The majority of the changes here are whitespace.
Also simplify `ThrowingIterator`'s bookkeeping (NFC).
Also move some free operators into hidden friends, for sanity's sake.
Also `=delete` some more comma operators.
Also use `constexpr` in C++20 instead of `TEST_CONSTEXPR_CXX14`.

Differential Revision: https://reviews.llvm.org/D103341
2021-09-09 21:20:33 -04:00
Xing Xue f53fafbacb [libc++] Add missing short wchar handling for codecvt_utf8, codecvt_utf16 and codecvt_utf8_utf16
Summary:
AIX have 2 byte wchar in 32 bit mode and 4 byte wchar in 64 bit mode.
This patch add more missing short wchar handling under the existing _LIBCPP_SHORT_WCHAR macro.

Marked test case ctor_move.pass.cpp as XFAIL for 32-bit mode on AIX because UTF-8 constants used cannot be converted to 2-byte wchar (by xingxue).

Authored by: jasonliu

Reviewed by: ldionne, zibi, SeanP, libc++

Differential Revision: https://reviews.llvm.org/D100777
2021-09-09 16:20:36 -04:00
Louis Dionne 53438979fe [libc++][NFC] Consistently reindent test cases for stringbuf 2021-09-09 15:16:08 -04:00
Louis Dionne 7a3d54a217 [libc++][NFC] Move misplaced XFAIL annotation
For consistency with the other surrounding tests.
2021-09-09 14:46:07 -04:00
Louis Dionne ad2b7a14f0 [libc++][NFC] Add #endif comment for long #if-#endif block 2021-09-09 14:43:10 -04:00
Louis Dionne 367a9e709d [libc++][NFC] Remove remnants of _LIBCPP_HAS_NO_STDOUT, which should have been removed by 87dd51983c 2021-09-09 14:27:31 -04:00
Louis Dionne dd662f0f3d [libc++][NFC] Fix typo in comment 2021-09-09 14:00:22 -04:00
Louis Dionne 6382ec1abb [libc++][NFC] Reorder includes in locale.cpp
Also, include <type_traits> unconditionally. There really isn't much
of a benefit in skipping it when exceptions are disabled.
2021-09-09 13:53:44 -04:00
Louis Dionne f40bba48a5 [libc++][NFC] Move misplaced comment about implementation of ctype<wchar_t> 2021-09-09 13:29:24 -04:00
Louis Dionne 1190f38530 [libc++] Add missing include of <cstddarg> for va_xxx functions 2021-09-09 13:26:11 -04:00
Louis Dionne 720b556036 [libc++][NFC] Move __char_traits_length_checked outside of wchar_t definitions
This will simplify an upcoming diff.
2021-09-09 13:24:11 -04:00
Louis Dionne 71752e0008 [libc++][NFC] Remove #endif comments for really small conditionals on _LIBCPP_HAS_NO_UNICODE_CHARS
We generally don't put a comment on the #endif when the #if block is so small
that it's unambiguous what the #endif refers to.
2021-09-09 11:25:10 -04:00
Louis Dionne cf765b1929 [libc++][NFC] Reindent documentation for LIBCXX_ENABLE_UNICODE 2021-09-09 11:14:39 -04:00
Louis Dionne b1fb3d75c9 [libc++] Implement C++20's P0476R2: std::bit_cast
Thanks to Arthur O'Dwyer for fixing up some of the tests.

Differential Revision: https://reviews.llvm.org/D75960
2021-09-09 11:05:54 -04:00
Louis Dionne 3765d284c4 [libc++] Provide a way to trigger rebuild of Docker images in the CI 2021-09-09 09:59:44 -04:00