Commit Graph

149 Commits

Author SHA1 Message Date
Eric Fiselier
6507e2af11 Mark destroying delete test as UNSUPPORTED with clang 7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365856 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-12 01:16:08 +00:00
Marshall Clow
b6e011b18b Add include for 'test_macros.h' to all the tests that were missing them. Thanks to Zoe for the (big, but simple) patch. NFC intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362252 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-31 18:35:30 +00:00
Eric Fiselier
bfea7307ae fix test for older clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361594 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 03:15:32 +00:00
Eric Fiselier
57436c8125 fix destroying delete test with older apple compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361593 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-24 02:46:34 +00:00
Eric Fiselier
087c094fec P0722R3: Implement library support for destroying delete
Summary:
This provides the `std::destroying_delete_t` declaration in C++2a and after. (Even when the compiler doesn't support the language feature).

However, the feature test macro `__cpp_lib_destroying_delete` is only defined when we have both language support and  C++2a.


Reviewers: ldionne, ckennelly, serge-sans-paille, EricWF

Reviewed By: EricWF

Subscribers: dexonsmith, riccibruno, christof, jwakely, jdoerfert, mclow.lists, ldionne, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@361572 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23 23:46:44 +00:00
Marshall Clow
321a1f890d Implement midpoint for floating point types. Reviewed as https://reviews.llvm.org/D61014.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359184 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-25 12:11:43 +00:00
Eric Fiselier
250205c9d2 Add std::is_constant_evaluated.
Clang recently added __builtin_is_constant_evaluated() and GCC 9.0
has it as well.

This patch adds support for it in libc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359119 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-24 17:54:25 +00:00
Eric Fiselier
dbd4f51025 Fix implementation of ::abs and std::abs LWG 2192.
Summary:
All overloads of `::abs` and `std::abs` must be present in both `<cmath>` and `<cstdlib>`. This is problematic to implement because C defines `fabs` in `math.h` and `labs` in `stdlib.h`. This introduces a circular dependency between the two headers. 

This patch implements that requirement by moving `abs` into `math.h` and making `stdlib.h` include `math.h`. In order to get the underlying C declarations from the "real" `stdlib.h` inside our `math.h` we need some trickery. Specifically we need to make `stdlib.h` include next itself.

Suggestions for a cleaner implementation are welcome.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: krytarowski, fedor.sergeev, dexonsmith, jdoerfert, jsji, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359020 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-23 18:01:58 +00:00
Billy Robert O'Neal III
3fd12d449b [libcxx] [test] Revert r356632 add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]]."
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356635 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-21 00:24:43 +00:00
Billy Robert O'Neal III
82e238eecb [libcxx] [test] Add (void) casts to operator new calls, to suppress warnings generated by [[nodiscard]].
This allows these tests to pass when compiled by MSVC++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@356632 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-20 23:58:46 +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
Louis Dionne
8734fa79ec [libcxx] Include <cstring> in tests that use strcmp
Reviewed as https://reviews.llvm.org/D56503.
Thanks to Andrey Maksimov for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351847 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-22 17:45:00 +00:00
Eric Fiselier
c6fd2de6a1 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351670 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-20 01:21:35 +00:00
Eric Fiselier
d162d3fe47 Revert "Fix aligned allocation availability XFAILs after D56445."
This reverts commit r351625.

That fix was incomplete. I'm reverting so I can commit a complete fix
in a single revision.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351669 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-20 01:12:53 +00:00
Chandler Carruth
9daab637c1 Update generator script to use the new license file header.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351650 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 11:38:40 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Eric Fiselier
14072788a3 Fix aligned allocation availability XFAILs after D56445.
D56445 bumped the minimum Mac OS X version required for aligned
allocation from 10.13 to 10.14. This caused libc++ tests depending
on the old value to break.

This patch updates the XFAILs for those tests to include 10.13.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351625 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 03:27:05 +00:00
Eric Fiselier
89e287b0ae correct script name in generated tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351299 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 05:43:02 +00:00
Eric Fiselier
8290a8d271 Fix feature test macros for atomics/mutexes without threading
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351291 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 02:10:28 +00:00
Eric Fiselier
a8b9f59e8c Implement feature test macros using a script.
Summary:
This patch implements all the feature test macros libc++ currently supports, as specified by the standard or cppreference prior to C++2a.

The tests and `<version>` header are generated using a script. The script contains a table of each feature test macro, the headers it should be accessible from, and its values of each dialect of C++.
When a new feature test macro is added or needed, the table should be updated and the script re-run.



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

Reviewed By: mclow.lists

Subscribers: arphaman, jfb, ldionne, libcxx-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351286 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-16 01:37:43 +00:00
Casey Carter
9e69b7db4d [test] Fix logic error in <compare> tests; enable for MSVC Dev16
Submitted upstream as https://reviews.llvm.org/D53763.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351148 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-15 01:53:12 +00:00
Marshall Clow
a9c67b27fa Add the feature test macros that were defined in p1353r0 to the headers of the appropriate tests. No actual tests yet, so NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@350535 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-07 16:17:52 +00:00
Eric Fiselier
50f14e23b5 Unbreak green dragon bots w/o __builtin_launder
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349373 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 18:37:59 +00:00
Eric Fiselier
2d0643acea Expect Clang diagnostics in std::launder test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349364 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-17 16:56:24 +00:00
Marshall Clow
f927635d87 Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349178 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-14 18:49:35 +00:00
Marshall Clow
544d1ba9a3 Fix problems with char8_t stuff on compilers that don't support char8_t yet
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-11 06:06:49 +00:00
Marshall Clow
96484477d1 Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348828 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-11 04:35:44 +00:00
Louis Dionne
f01e82fd42 [libcxx] Remove the availability_markup LIT feature
It is now equivalent to the 'availability' LIT feature, so there's no
reason to keep both.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348653 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-07 21:48:39 +00:00
Louis Dionne
7ea279fbed [libcxx] Add XFAILs for aligned allocation tests on AppleClang 9
Some people are still running the test suite using AppleClang 9.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@348507 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-06 18:06:47 +00:00
Marshall Clow
a815a3f8cc First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane. (second try)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347930 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-29 23:21:18 +00:00
Marshall Clow
ebdb54773c Revert commit r347904 because it broke older compilers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347908 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-29 20:04:47 +00:00
Marshall Clow
50509d15b8 First part of P0482 - Establish that char8_t is an integral type, and that numeric_limits<char8_t> is valid and sane.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347904 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-29 19:49:48 +00:00
Louis Dionne
893cf80335 [libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347585 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-26 19:30:08 +00:00
Louis Dionne
739fdd4850 [NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@347367 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-21 00:03:17 +00:00
Stephan T. Lavavej
439de45011 [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-14 03:06:06 +00:00
Marshall Clow
9110b80a63 Update commnents to reflect the changes for LWG#3127. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344951 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-22 20:49:50 +00:00
Marshall Clow
3d1d9230d8 Update commnents to reflect the changes for LWG#3122. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344950 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-22 20:44:37 +00:00
Billy Robert O'Neal III
0a890c95ca [libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX
The test is trying to avoid saying aligned_alloc on Windows' UCRT, which does not (and can not) implement aligned_alloc. However, it's testing for c1xx, meaning clang on Windows will fail this test when using the UCRT.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344829 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-20 03:35:45 +00:00
Eric Fiselier
52a8692f86 Fix threaded test under no-threading configuration
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343432 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-01 01:05:51 +00:00
Marshall Clow
e3973fd962 Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342073 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 19:41:40 +00:00
Marshall Clow
575d6888eb Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulates it from the singlar; this means it will only return 0 or 1.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342063 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-12 16:59:09 +00:00
Marshall Clow
43d7c79aae Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339816 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 21:19:08 +00:00
Marshall Clow
a87d98049c Mark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, since those calls were introduced in C++11. They're already guarded by an ifdef in the code, so this is a 'belt-and-suspenders' change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339804 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 19:27:53 +00:00
Louis Dionne
a1b4766c47 [libcxx] Fix XFAILs for aligned allocation tests on older OSX versions
Summary:
Since r338934, Clang emits an error when aligned allocation functions are
used in conjunction with a system libc++ dylib that does not support those
functions. This causes some tests to fail when testing against older libc++
dylibs. This commit marks those tests as UNSUPPORTED, and also documents the
various reasons for the tests being unsupported.

Reviewers: vsapsai, EricWF

Subscribers: christof, dexonsmith, cfe-commits, mclow.lists, EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 00:30:03 +00:00
Louis Dionne
010c53f892 [libc++] Disable failing C11 feature tests for <cfloat> and <float.h>
Summary:
Those tests are breaking the test bots. A Bugzilla has been filed to
make sure those tests are re-enabled: https://bugs.llvm.org/show_bug.cgi?id=38572

Reviewers: mclow.lists, EricWF

Subscribers: krytarowski, christof, dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339742 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-15 00:18:01 +00:00
Louis Dionne
4d5214346e [libc++] Add missing #include in C11 features tests
Summary:
These #includes are quite important, since otherwise any

    #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES)

checks are always false, and so we don't actually test for C11 support
in the standard library.

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339675 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 13:29:17 +00:00
Marshall Clow
ea96e3a707 Final bit of P0063 - make sure that aligned_alloc is available when the underlying C library supports it
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338457 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 23:39:12 +00:00
Marshall Clow
4983a7a649 Test for the presence of a bunch of new macros for c++17. These macros come from C11. Part of P0063
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338454 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 23:29:06 +00:00
Marshall Clow
8a16d40991 import timespec and timespec_get into namespace std if we're under c++17 or later AND the underlying C library has them. Fixes PR#38220, but doesn't implement all of P0063 yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@338419 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-31 19:25:00 +00:00