Commit Graph

111 Commits

Author SHA1 Message Date
Nikolas Klauser e06ca31239 [libc++] Canonicalize the ranges results and their tests
Reviewed By: var-const, Mordante, #libc, ldionne

Spies: ldionne, libcxx-commits

Differential Revision: https://reviews.llvm.org/D121435
2022-04-02 08:26:31 +02:00
Louis Dionne 6a7f055117 [libc++] Re-enable workaround for pre-ranges CTAD in std::span
See https://reviews.llvm.org/D121626 for details -- this re-enables the
CTAD we removed, since it does break some stuff as well (even though it's
not nearly as bad as the removed constructors fixed by D121626).

Differential Revision: https://reviews.llvm.org/D122184
2022-03-21 21:56:42 -04:00
Nikolas Klauser 14324fa428 [libc++] Add warning pragma macros in the test suite
Reviewed By: ldionne, #libc, EricWF

Spies: EricWF, libcxx-commits

Differential Revision: https://reviews.llvm.org/D121552
2022-03-17 00:11:20 +01:00
Mark de Wever e72cedcb01 [libc++][NFC] Add TEST_HAS_NO_INCOMPLETE_RANGES.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D121515
2022-03-16 17:42:48 +01:00
Casey Carter 8d58cb62da [libcxx][test] Let the library indicate support for int128
Define `TEST_HAS_NO_INT128` accordingly.

Differential Revision: https://reviews.llvm.org/D120010
2022-02-17 14:07:49 -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
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 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
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
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
Mark de Wever 9027887e23 [libc++][nfc] Add TEST_HAS_NO_CHAR8_T.
This avoids using an libc++ internal macro in our tests. This version
doesn't depend on the internal macro but redefines it.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119460
2022-02-11 17:37:05 +01:00
Mark de Wever fedbd264e3 [libc++][nfc] Add TEST_HAS_NO_LOCALIZATION.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119352
2022-02-10 17:44:37 +01:00
Mark de Wever 959678425d [libc++][nfc] Add TEST_HAS_NO_UNICODE_CHARS.
This avoids using an libc++ internal macro in our tests.

Reviewed By: #libc, philnik, ldionne

Differential Revision: https://reviews.llvm.org/D118832
2022-02-03 08:02:25 +01:00
Arthur O'Dwyer 2eb2ff2a02 [libc++] Merge _LIBCPP_HAS_NO_RANGES into _LIBCPP_HAS_NO_CONCEPTS. NFC.
The macro that opts out of `std::ranges::` functionality is called
`_LIBCPP_HAS_NO_INCOMPLETE_RANGES`, and is unrelated to this macro
which is specifically about _compiler_ support for the _syntax_.

The only non-mechanical diff here is in `<__config>`.

Differential Revision: https://reviews.llvm.org/D118507
2022-01-31 12:10:22 -05:00
Mark de Wever 8f972cb0fd [libc++][nfc] Add TEST_HAS_NO_INT128.
Avoid using the libc++ internal `_LIBCPP_HAS_NO_INT128` in our tests.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117992
2022-01-27 17:31:27 +01:00
Casey Carter 67d483aba2 [libcxx][test] Use TEST_HAS_BUILTIN in test code
... rather than using `__has_builtin` directly. This both (1) allows a compiler that doesn't speak `__has_builtin` to workaround with preprocessor magic, and (2) avoids diagnostics about things that look like function like macros after `#if` but are not.
2022-01-20 01:47:29 -08:00
Casey Carter 4e00a1921f [libcxx][test] compiler options are non-portable
... it's easier to suppress warnings internally, where we can detect the compiler.

* Rename `TEST_COMPILER_C1XX` to `TEST_COMPILER_MSVC`
* Rename all `TEST_WORKAROUND_C1XX_<meow>` to `TEST_WORKAROUND_MSVC_<meow>`

Differential Revision: https://reviews.llvm.org/D117422
2022-01-18 11:34:57 -08:00
Arthur O'Dwyer fa244345e1 [libc++] [test] ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS is not supported on AIX.
I believe all four of these failures are directly due to the pattern where
allocations in the dylib are unobserved by the client program. If AIX32 and AIX64
don't support that, we should just disable the ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS
macro on AIX, and then we don't need to XFAIL these tests.

This also means I won't need to XFAIL a dozen other tests in D89057,
which rely heavily on ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS and
also currently fail on AIX.
See https://buildkite.com/llvm-project/libcxx-ci/builds/7669

Differential Revision: https://reviews.llvm.org/D116866
2022-01-14 12:48:04 -05:00
Louis Dionne 7c7d59a35d [libc++] Use TEST_HAS_NO_UNICODE instead of _LIBCPP_HAS_NO_UNICODE in the test suite
Differential Revision: https://reviews.llvm.org/D116973
2022-01-11 10:34:59 -05:00
Casey Carter 1d3964d2ad [libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
... even when `!defined(_LIBCPP_VERSION)`. (Note that the previous definition for this case - `((void)0);` - is ill-formed at namespace scope.) Ditto for `LIBCPP_ASSERT`, `LIBCPP_ASSERT_NOEXCEPT`, `LIBCPP_ASSERT_NOT_NOEXCEPT`, and `LIBCPP_ONLY`.

Differential Revision: https://reviews.llvm.org/D116880
2022-01-10 16:35:31 -08:00
Arthur O'Dwyer b4a13e4c98 [libc++] [test] C++14/17-friendly `TEST_IS_CONSTANT_EVALUATED` macro.
Reviewed as part of D114658.
Ultimately this will probably have to be flipped around and renamed
`TEST_IS_RUNTIME`, and extended with `TEST_IS_RUNTIME_OR_CXX20` (once
constexpr std::string support is added) and so on for every new C++
version. But we don't need that flexibility yet, so we're not adding it.
2021-12-01 15:02:54 -05:00
Arthur O'Dwyer 4a8734deb7 [libc++] [test] Add "robust_re_difference_type.compile.pass.cpp" for all the algorithms.
Also, mark these tests as compile-only. They actually are safe to run — notice that
the code "runs" at constexpr-time in C++20, without error — because both of the
input ranges are entirely filled with nullptr, so no matter how you shuffle the
elements, they remain sorted and partitioned and heapified and everything.
But there's no real reason to run them at runtime, so let's just avoid the distraction.

Test cases that fail in trunk right now are commented out with `TODO FIXME`.

Differential Revision: https://reviews.llvm.org/D113906
2021-11-18 00:12:41 -05:00
Louis Dionne f4c1258d56 [libc++] Add an option to disable wide character support in libc++
Some embedded platforms do not wish to support the C library functionality
for handling wchar_t because they have no use for it. It makes sense for
libc++ to work properly on those platforms, so this commit adds a carve-out
of functionality for wchar_t.

Unfortunately, unlike some other carve-outs (e.g. random device), this
patch touches several parts of the library. However, despite the wide
impact of this patch, I still think it is important to support this
configuration since it makes it much simpler to port libc++ to some
embedded platforms.

Differential Revision: https://reviews.llvm.org/D111265
2021-10-12 06:08:23 -04:00
Arthur O'Dwyer c333505fa5 [libc++] [test] Remove filenames from copyright headers. NFCI.
Discussed in D110794.
2021-10-01 12:14:00 -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
Louis Dionne 77b32055ec [libc++] Assume that compilers support extended constexpr in C++14 mode
We don't support any compiler that doesn't support C++14 constexpr when
compiling in C++14 mode anymore, so we can just assume that we have C++14
extended constexpr when compiling in C++14 mode. This allows us to remove
some workarounds for older compilers.

Differential Revision: https://reviews.llvm.org/D108638
2021-08-25 08:41:07 -04:00
Louis Dionne ed7c81d172 [libc++] Convert test-suite workarounds for some C11 features to XFAILs
Instead of trying to sniff out what features are supported by the
library being tested, the way we normally handle these things is with
Lit annotations. This should not be treated differently.

Differential Revision: https://reviews.llvm.org/D108209
2021-08-18 08:28:11 -04:00
Louis Dionne 6900df37d2 [libc++] Remove Lit annotations for unsupported GCC versions from the test suite
Since we officially don't support several older compilers now, we can
drop a lot of the markup in the test suite. This helps keep the test
suite simple and makes sure that UNSUPPORTED annotations don't rot.

This is the first patch of a series that will remove annotations for
compilers that are now unsupported.

Differential Revision: https://reviews.llvm.org/D107787
2021-08-12 13:30:47 -04:00
Martin Storsjö 128b2136ec [libcxx] [test] Generalize defines for skipping allocation checks
This allows waiving the right amount of asserts on Windows and zOS.
This should supersede D107124 and D105910.

Differential Revision: https://reviews.llvm.org/D107755
2021-08-10 11:05:00 +03:00
Louis Dionne 851a335b1e [libc++] Add a job running GCC with C++11
This configuration is interesting because GCC has a different level of
strictness for some C++ rules. In particular, it implements the older
standards more stringently than Clang, which can help find places where
we are non-conforming (especially in the test suite).

Differential Revision: https://reviews.llvm.org/D105936
2021-07-15 22:13:03 -04:00
Martin Storsjö be34d5f74a [libcxx] [test] Remove an incorrect TEST_HAS_ALIGNED_ALLOC define from test_macros.h
This was added inconsistently in
19fd9039ca242f408493b5c662f9d908eab8555e; Windows doesn't have the
aligned_alloc function (neither MSVC nor MinGW toolchains) and we don't
define _LIBCPP_HAS_ALIGNED_ALLOC while building libcxx.

Differential Revision: https://reviews.llvm.org/D103399
2021-05-31 22:13:22 +03:00
Martin Storsjö 0e8f5e4a68 [libcxx] [test] Skip alloc counter checks for operations within the libc++ DLL
If libc++ is built as a DLL, calls to operator new within the DLL aren't
overridden if a user provides their own operator in calling code.
Therefore, the alloc counter doesn't pick up on allocations done within
std::string, so skip that check if running on windows. (Technically,
we could keep the checks if running on windows when not built as a DLL,
but trying to keep the conditionals simple.)

Differential Revision: https://reviews.llvm.org/D100219
2021-05-01 09:26:23 +03:00
Christopher Di Bella c05d1eed35 [libcxx][iterator][ranges] adds `input_iterator` and `input_range`
Implements parts of:
    * P0896R4 The One Ranges Proposal`

Depends on D100269.

Differential Revision: https://reviews.llvm.org/D100271
2021-04-30 22:49:06 +00:00
Martin Storsjö f9ddb81d79 [libcxx] [test] Ifdef out tests that rely on perms::none on directories for triggering errors
On Windows, one can't use perms::none on a directory to trigger
failures to read the directory entries.

These remaining tests can't use GetWindowsInaccessibleDir() sensibly,
e.g. for tests that rely on toggling accessibility back and forth during
the test, or where the semantics of the dir provided by
GetWindowsInaccessibleDir() doesn't allow for running the ifdeffed tests
meaningfully.

Differential Revision: https://reviews.llvm.org/D97538
2021-04-19 23:03:12 +03:00
Arthur O'Dwyer 9abff04e50 [libc++] Fix test_macros.h in the same way as commit 49e5a896 fixed __config.
Since D99515, this header triggers -Wundef on Mac OSX older than 10.15.
This is now fixed.
2021-04-04 18:08:19 -04:00
Marek Kurdej 5c703f0fd8 [libc++] Build and test with -Wundef warning. NFC.
This will avoid typos like `_LIBCPP_STD_VERS` (<future>) or using `#if TEST_STD_VER > 17` without including "test_macros.h".

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D99515
2021-04-01 08:32:56 +02:00
Martin Storsjö f5f3a59837 [libcxx] [test] Disable some allocation checks in class.path tests on windows
On windows, the path internal representation is wchar_t, and
input/output often goes through utf8 inbetween, which causes extra
allocations.

MS STL also fails a number of strict allocation checks, so this
shouldn't be a standards compliance issue.

Differential Revision: https://reviews.llvm.org/D98398
2021-03-15 18:52:48 +02:00
Alex Richardson 077a84f911 [libc++] Sync TEST_HAS_TIMESPEC_GET and _LIBCPP_HAS_TIMESPEC_GET on FreeBSD
Commit 5e416ba943 (D71522) updated the
__config header but didn't change test_macros.h.
This fixes libcxx/language.support/has_timespec_get.compile.pass.cpp on
FreeBSD12/13.

Reviewed By: #libc, dim, ldionne

Differential Revision: https://reviews.llvm.org/D94292
2021-01-19 15:02:57 +00:00
Marek Kurdej 044b892c79 [libc++] Use c++20 instead of c++2a consistently.
* The only exception is that the flag -std=c++2a is still used not to break compatibility with older compilers (clang <= 9, gcc <= 9).
* Bump _LIBCPP_STD_VER for C++20 to 20 and use 21 for the future standard (C++2b).

That's a preparation step to add c++2b support to libc++.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D93383
2021-01-07 13:11:33 +01:00
Louis Dionne bb09ef9598 [libc++] Fix failures when running the test suite without RTTI 2020-09-21 20:17:24 -04:00
Louis Dionne a5faf3c849 [libc++] Re-enable tests for C11 math macros in <float.h> and <cfloat>
Fixes http://llvm.org/PR38572.
2020-07-29 15:12:54 -04:00
Louis Dionne 67dfba9629 [libc++] Provide std::aligned_alloc and std::timespec_get on Apple platforms
rdar://66113878
2020-07-28 15:13:05 -04:00
Louis Dionne 1bd7c02233 [libc++] Clean up tests for "optional" C11 features
First, add a TEST_HAS_QUICK_EXIT macro to mirror other C11 features like
TEST_HAS_ALIGNED_ALLOC, and update the tests for that.

Second, get rid of TEST_HAS_C11_FEATURES and _LIBCPP_HAS_C11_FEATURES,
which were only used to ensure that feature macros don't get out of
sync between <__config> and "test_macros.h". This is not necessary
anymore, since we have tests for each individual macro now.
2020-07-28 15:13:05 -04:00
Louis Dionne 77b9abfc8e [libc++] Complete overhaul of constexpr support in std::array
This commit adds missing support for constexpr in std::array under all
standard modes up to and including C++20. It also transforms the <array>
tests to check for constexpr-friendliness under the right standard modes.

Fixes https://llvm.org/PR40124
Fixes rdar://57522096
Supersedes https://reviews.llvm.org/D60666

Differential Revision: https://reviews.llvm.org/D80452
2020-05-28 12:31:06 -04:00
Louis Dionne f46bb9dd5c [NFC] Reformat TEST_FOO macros in test_macros.h
To make them easier to read and to make it easier to add new ones.
2020-05-27 16:54:43 -04:00
Louis Dionne b632fe5a36 [libc++] Quote the filesystem static env root in the source files instead of the command line
Otherwise, trying to reproduce a failing filesystem test by copy-pasting
the command-line used and running that in the shell won't work, because
the shell will eat quoting around the define and we'll end up with a
non-stringized path in the .cpp file.
2020-03-31 09:40:01 -04:00
Michał Górny e1882af9f6 [libc++] Update feature list for NetBSD
Add NetBSD to the same feature list as Fuchsia since it matches
in available features, effectively enabling aligned_alloc(),
timespec_get() and C11 features.  Remove now-duplicate declaration
of quick_exit() support.

Differential Revision: https://reviews.llvm.org/D71511
2019-12-20 17:50:47 +01:00
Eric Fiselier f97936fabd [libc++] Cleanup and enable multiple warnings.
Too many warnings are being disabled too quickly. Warnings are
important to keeping libc++ correct. This patch re-enables two
warnings: -Wconstant-evaluated and -Wdeprecated-copy.

In future, all warnings disabled for the test suite should require
an attached bug. The bug should state the plan for re-enabling that
warning, or a strong case why it should remain disabled.
2019-12-12 21:09:08 -05:00
Dan Albert 19fd9039ca Fix _LIBCPP_HAS_ definitions for Android.
Summary:
Android added quick_exit()/at_quick_exit() in API level 21,
aligned_alloc() in API level 28, and timespec_get() in API level 29,
but has the other C11 features at all API levels (since they're basically
just coming from clang directly).

_LIBCPP_HAS_QUICK_EXIT and _LIBCPP_HAS_TIMESPEC_GET already existed,
so we can reuse them. (And use _LIBCPP_HAS_TIMESPEC_GET in a few more
places where _LIBCPP_HAS_C11_FEATURES has been used as a proxy. This
isn't correct for Android.)

_LIBCPP_HAS_ALIGNED_ALLOC is added, to cover aligned_alloc() (obviously).

Add a missing std:: before aligned_alloc in a cstdlib test, and remove a
couple of !defined(_WIN32)s now that we're explicitly testing
TEST_HAS_ALIGNED_ALLOC rather than TEST_HAS_C11_FEATURES.

Reviewers: danalbert, EricWF, mclow.lists

Reviewed By: danalbert

Subscribers: srhines, christof, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D69929
2019-11-18 12:19:58 -08:00
Louis Dionne 13c90a5716 [libc++][P0202] Marked algorithms copy/copy_n/copy_if/copy_backward constexpr
Thanks to Michael Park for the patch.

Differential Revision: https://reviews.llvm.org/D68837
2019-11-06 12:02:41 +00:00