Commit Graph

1643 Commits

Author SHA1 Message Date
JF Bastien
6ba69cac26 Fix char.traits.specializations.char8_t main return
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356504 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:25:07 +00:00
Louis Dionne
582679a3fe [libc++] Build <filesystem> support as part of the dylib
Summary:
This patch treats <filesystem> as a first-class citizen of the dylib,
like all other sub-libraries (e.g. <chrono>). As such, it also removes
all special handling for installing the filesystem library separately
or disabling part of the test suite from the lit command line.

Reviewers: mclow.lists, EricWF, serge-sans-paille

Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356500 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 19:09:33 +00:00
Marshall Clow
ddb1b0576a Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. These are just rebranded 'operator[]', and should be noexcept like it is.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356435 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-19 03:30:07 +00:00
Marshall Clow
527149c670 Update a deque test with more assertions. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356266 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-15 15:00:41 +00:00
Marshall Clow
9039043195 Mark vector::operator[] and front/back as noexcept. We already do this for string and string_view. This should give better codegen inside of noexcept functions. Add tests for op[]/front/back/at, because apparently we had none.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356224 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-15 00:29:35 +00:00
Marshall Clow
fa199b9339 Add noexcept to operator[] for array and deque. This is an extension. We already do this for string and string_view. This should give better codegen inside of noexcept functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356209 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 21:56:57 +00:00
Marshall Clow
3f377ef16a Reorg the midpoint pointer test into runtime and constexpr tests; comment out the volatile constexpr tests for GCC because our experimental gcc bot barfs on them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356177 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:43:41 +00:00
Marshall Clow
3166f3aa00 Fix two of the three bot failures for midpoint; the ones regarding the lack of '__int128_t'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356169 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 17:20:02 +00:00
Marshall Clow
5310aa3850 Add std::midpoint for integral and poiner types. Described in P0811, reviewed as D59099.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 16:25:55 +00:00
Eric Fiselier
a9efe90666 Properly constrain basic_string(Iter, Iter, Alloc = A())
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356140 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-14 12:31:10 +00:00
Louis Dionne
9807685d51 [libc++] Enable deprecation warnings by default
Summary:
In r342843, I added deprecation warnings to some facilities that were
deprectated in C++14 and C++17. However, those deprecation warnings
were not enabled by default.

After discussing this on IRC, we had finally gotten consensus to enable
those warnings by default, and I'm getting around to doing that only
now.

Reviewers: mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355961 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-12 20:10:06 +00:00
Eric Fiselier
2ab98fbcd4 Allow optional to tolerate being used with a nested class.
When Clang tries to complete a type containing `std::optional` it
considers the `in_place_t` constructor with no arguments which checks
if the value type is default constructible. If the value type is a
nested class type, then this check occurs too early and poisons the
is_default_constructible trait.

This patch makes optional deduce `in_place_t` so we can prevent
this early SFINAE evaluation. Technically this could break people
doing weird things with the in_place_t tag, but that seems less
important than making the nested class case work.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355877 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-11 22:55:21 +00:00
Marshall Clow
526bce48cc Eradicate all the ptrdiff_ts in span left over from applying P1227. A couple of other minor cleanups. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355481 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-06 03:59:44 +00:00
Davide Italiano
a011222d74 Reinstate libc++ patches now that the lldb formatter has been updated.
"[libc++] Fix <atomic> failures on GCC"
"[libc++] Change memory_order to an enum class"
"[libc++] decoupling Freestanding atomic<T> from libatomic.a"

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355427 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 18:40:49 +00:00
Davide Italiano
3438c15d15 [libcxx] Revert set of atomic patches that broke lldb.
Revert "[libc++] Fix <atomic> failures on GCC"
Revert "[libc++] Change memory_order to an enum class"
Revert "[libc++] decoupling Freestanding atomic<T> from libatomic.a"

The lldb formatter nededs to be updated. Shafik and Louis will
coordinate to do so.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355417 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 17:38:33 +00:00
Louis Dionne
018402394d [libc++] Fix <atomic> failures on GCC
Summary:
In https://reviews.llvm.org/D58201, we turned memory_order into an enum
class in C++20 mode. However, we were not casting memory_order to its
underlying type correctly for the GCC implementation, which broke the
build bots. I also fixed a test that was failing in C++17 mode on GCC 5.

Reviewers: EricWF, jfb, mclow.lists

Subscribers: zoecarver

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355409 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 15:49:58 +00:00
Louis Dionne
1bf0d1eb64 [libc++] Change memory_order to an enum class
This implements P0439R0.

Thanks to Zoe Carver for the patch.
Differential Revision: https://reviews.llvm.org/D58201

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355403 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-05 14:50:25 +00:00
Louis Dionne
d386d7e49a [libc++] Fix forgotten fclose() in unit test
Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58732

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355162 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 01:32:44 +00:00
Louis Dionne
f1546581e5 [libc++] Increase portability of xalloc test
Do not assume that xalloc() starts at 0, which is not specified by the
Standard.

Thanks to Andrey Maksimov for the patch.
Differential Revision: https://reviews.llvm.org/D58299

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355160 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-01 00:51:54 +00:00
Louis Dionne
aeeba70ab1 [libc++] Add is_nothrow_convertible from P0758R1
Reviewed as https://reviews.llvm.org/D58019.
Thanks to Zoe Carver for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@355010 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 17:57:38 +00:00
Marshall Clow
ae4afd034b Implment the last part of P1024: tuple-like interface to span. Reviewed as https://reviews.llvm.org/D58706.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354988 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 15:41:37 +00:00
Marshall Clow
dd2ae1242f Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as https://reviews.llvm.org/D58642
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354950 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 02:58:56 +00:00
Marshall Clow
680a56e1aa Fix an ambiguity in the tests that gcc-tot complained about.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354944 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:52 +00:00
Louis Dionne
a4bb2d075d [libc++] Add a test for PR14074
PR14074 was fixed in r165884, but no tests were added.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354943 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 01:29:09 +00:00
Louis Dionne
21c042e77e [libc++] Mark several tests as XFAIL on macosx10.7
Those tests fail when linking against a new dylib but running against
macosx10.7. I believe this is caused by a duplicate definition of the
RTTI for exception classes in libc++.dylib and libc++abi.dylib, but
this matter still needs some investigation.

This issue was not caught previously because all the tests always linked
against the same dylib used for running (because LIT made it impossible
to do otherwise before r349171).

rdar://problem/46809586

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354940 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:57:57 +00:00
Marshall Clow
b3c66aa0ab First part of P1227R2 - change span over to use 'size_t' instead of 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354936 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-27 00:32:16 +00:00
Marshall Clow
452149ea33 Implement P1357: Traits for [Un]bounded Arrays; adopted in Kona
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354891 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-26 16:07:03 +00:00
Marshall Clow
a333218455 LWG3101 - span's Container constructors need another constraint. Reviewed as https://reviews.llvm.org/D57058.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354805 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 18:32:57 +00:00
Marshall Clow
c67930bd74 Commit LWG3144 - span does not have a const_pointer typedef. Reviewed as D57039.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354802 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:58:03 +00:00
Marshall Clow
e5cb744bf1 First part of P1024: Usability Enhancements for std::span. Remove operator() for indexing, and add 'front' and 'back' calls.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354801 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-25 17:54:08 +00:00
Louis Dionne
98173dc3c4 [libcxx] Make sure all experimental tests are disabled when enable_experimental=False
Summary:
Previously, we'd run some experimental tests even when enable_experimental=False
was used with lit.

Reviewers: EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354725 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-23 11:24:03 +00:00
Louis Dionne
06dd101a65 [NFC] Fix incorrect comment in std::function test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@354537 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 00:53:26 +00:00
Louis Dionne
712d476de3 [libcxx] Do not assume the number of elements in a moved-from associative container
Reviewed as https://reviews.llvm.org/D57903.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353955 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-13 16:43:44 +00:00
Eric Fiselier
ecc2c089fd Add fenv.h header
Summary:
Some implementations of fenv.h use macros to define the functions they provide. This can cause problems when `std::fegetround()` is spelled in source.

This patch adds a `fenv.h` header to libc++ for the sole purpose of turning those macros into real functions.

Reviewers: rsmith, mclow.lists, ldionne

Reviewed By: rsmith

Subscribers: mgorny, christof, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353767 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 23:47:19 +00:00
Chandler Carruth
b20da37b6b Update some newly added files that mistakenly used the old file header
to the new one.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353668 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-11 08:39:14 +00:00
Kamil Rytarowski
e4dbc70699 Mark another test as flaky
Reported on the NetBSD buildbot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353622 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-09 18:39:07 +00:00
Louis Dionne
5569a5e69c [libc++] Fix XFAILs when exceptions are disabled
It turns out that I un-XFAILed too many tests in r353210: some tests
actually fail whether exceptions are enabled or not because they use
types that are marked as unavailable even when exceptions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353215 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:55:23 +00:00
Louis Dionne
4806bce5a8 [libc++] Fix XFAILs on macOS when exceptions are disabled
Some tests are marked as failing on platforms where the dylib does not
provide the required exception classes. However, when testing with
exceptions disabled, those tests shouldn't be marked as failing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353210 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 20:11:58 +00:00
Louis Dionne
c6d9b0768b [libc++] Use UNSUPPORTED instead of TEST_STD_VER #ifdef
When the whole test only works starting at some version of the Standard,
use UNSUPPORTED lit markup instead of #ifdef TEST_STD_VER. This provides
more visibility into the test suite.

Reviewed as https://reviews.llvm.org/D57704.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353206 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:50:17 +00:00
Louis Dionne
60c45f5f7c [libcxx] Start defining lit features for tests depending on availability
This patch removes some vendor-specific availability XFAILs from the
test suite. In the future, when a new feature is introduced in the
dylib, an availability macro should be created and a matching lit
feature should be created. That way, the test suite can XFAIL whenever
the implementation lacks the necessary feature instead of being
cluttered by vendor-specific annotations.

Right now, those vendor-specific annotations are still somewhat cluttering
the test suite by being in `config.py`, but at least they are localized.
In the future, we could design a way to define those less intrusively or
even automatically based on the availability macros that already exist
in <__config>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353201 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-05 19:22:38 +00:00
JF Bastien
e15dd4e32e Support tests in freestanding
Summary:
Freestanding is *weird*. The standard allows it to differ in a bunch of odd
manners from regular C++, and the committee would like to improve that
situation. I'd like to make libc++ behave better with what freestanding should
be, so that it can be a tool we use in improving the standard. To do that we
need to try stuff out, both with "freestanding the language mode" and
"freestanding the library subset".

Let's start with the super basic: run the libc++ tests in freestanding, using
clang as the compiler, and see what works. The easiest hack to do this:

In utils/libcxx/test/config.py add:

  self.cxx.compile_flags += ['-ffreestanding']

Run the tests and they all fail.

Why? Because in freestanding `main` isn't special. This "not special" property
has two effects: main doesn't get mangled, and main isn't allowed to omit its
`return` statement. The first means main gets mangled and the linker can't
create a valid executable for us to test. The second means we spew out warnings
(ew) and the compiler doesn't insert the `return` we omitted, and main just
falls of the end and does whatever undefined behavior (if you're luck, ud2
leading to non-zero return code).

Let's start my work with the basics. This patch changes all libc++ tests to
declare `main` as `int main(int, char**` so it mangles consistently (enabling us
to declare another `extern "C"` main for freestanding which calls the mangled
one), and adds `return 0;` to all places where it was missing. This touches 6124
files, and I apologize.

The former was done with The Magic Of Sed.

The later was done with a (not quite correct but decent) clang tool:

  https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed

This works for most tests, though I did have to adjust a few places when e.g.
the test runs with `-x c`, macros are used for main (such as for the filesystem
tests), etc.

Once this is in we can create a freestanding bot which will prevent further
regressions. After that, we can start the real work of supporting C++
freestanding fairly well in libc++.

<rdar://problem/47754795>

Reviewers: ldionne, mclow.lists, EricWF

Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353086 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-04 20:31:13 +00:00
Eric Fiselier
23b5c8797f Move the feature test macros script to the utils directory.
It doesn't make a lot of sense to keep it with the tests,
deep into the test suite directonies.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352970 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-02 23:13:49 +00:00
Marshall Clow
5d83dada72 add a test and a couple minor bug fixes for the implicit-signed-integer-truncation sanitizer. This is PR#40566
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352926 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-01 21:59:27 +00:00
Marshall Clow
125313b00b Fix a bit of libc++-specific behavior in the regex tests; add a missing test. Reviewed as https://reviews.llvm.org/D57391 Thanks to Andrey Maksimov for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352781 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-31 18:54:26 +00:00
Eric Fiselier
a32a775e66 Fix PR40495 - is_invokable_v<void> does not compile
The meta-programming that attempted to form the invoke call expression
was not in a SFINAE context. This made it a hard error to provide
non-referencable types like 'void' or 'void (...) const'.

This patch fixes the error by checking the validity of the call
expression within a SFINAE context.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352522 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 18:01:14 +00:00
Marshall Clow
92f58d1b36 Mark some of the behavior in the move w/allocator constructors of deque/unordered containers as 'libc++-specific'. Thanks to Andrey Maksimov for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352512 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29 16:12:45 +00:00
Petr Hosek
4267db0b26 [libc++] Use runtime rather then compile-time glibc version check
glibc supports versioning, so it's possible to build against older
version and run against newer version. This is sometimes relied on
in practice, e.g. in Fuchsia build we build against older sysroot
(equivalent to Ubuntu Trusty) to cover the broadest possible range
of host systems, but that doesn't necessarily match the system that
binary is going to run on which may have newer version, in which case
the compile test used in curr_symbol is going to fail. Using runtime
check is more reliable.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352425 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-28 20:39:50 +00:00
Kamil Rytarowski
9788355e30 Mark awk.pass.cpp as XFAIL for NetBSD
Reported on the NetBSD 8 build bot.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352097 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 20:26:02 +00:00
Marshall Clow
e7e7b2e6bd D14686: 'Protect against overloaded comma in random_shuffle and improve tests' I had to cut back on the tests with this, because they were not C++03 friendly. Thanks to gribozavr for the patch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352087 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 19:20:19 +00:00
Louis Dionne
42cbe7a2aa [libcxx] Portability fix: unordered_set and unordered_multiset iterators are not required to be the same
The unordered_set and unordered_multiset iterators are specified in the standard as follows:

using iterator             = implementation-defined; // see [container.requirements]
using const_iterator       = implementation-defined; // see [container.requirements]
using local_iterator       = implementation-defined; // see [container.requirements]
using const_local_iterator = implementation-defined; // see [container.requirements]

The pairs iterator/const_iterator and local_iterator/const_local_iterator
are not required to be the same. The reasonable requirement would be that
iterator can convert to const_iterator and local_iterator can convert to
const_local_iterator. This patch weakens the check and makes the test
more portable.

Reviewed as https://reviews.llvm.org/D56493.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@352083 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-24 19:09:22 +00:00