Commit Graph

6567 Commits

Author SHA1 Message Date
Louis Dionne 1ffc299628 [libc++] Ensure the CI scripts can find Ninja
Ninja isn't necessarily installed on macOS out of the box, so make sure
we use the SDK Ninja instead of relying on one being available on the
system.
2020-08-13 11:11:10 -04:00
Louis Dionne 2916dd5669 [libc++][test] Fix another -Wstring-concatenation warning 2020-08-13 09:51:20 -04:00
Louis Dionne c58f1fe2ae [libc++][test] Fix -Wstring-concatenation warnings 2020-08-13 08:51:15 -04:00
Louis Dionne da0592e4c8 [libc++] Use CMake interface targets to setup benchmark flags
This also fixes an issue where the benchmarks were being built with C++14
instead of C++17, as they should be.
2020-08-13 08:38:02 -04:00
Erik Pilkington cc6d9f59fd [libcxx][test] Fix a -Wstring-concatenation warning in fuzzer_test.h
This was causing failures on green dragon:
http://lab.llvm.org:8080/green/job/libc++%20and%20libc++abi%20trunk/780/
2020-08-12 16:55:08 -04:00
Louis Dionne 8d4860aa9e [libc++] Remove workarounds for missing rvalue references
We don't support GCC in C++03 mode, and Clang provides rvalue references
even in C++03 mode. So there's effectively no supported compiler that
doesn't support rvalue references.

Differential Revision: https://reviews.llvm.org/D84943
2020-08-12 12:02:28 -04:00
Michael Park c6f51377e1
[libcxx/variant] Add a few benchmarks for `std::visit`.
This patch adds a few `std::visit` benchmarks as a starting point.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D85419
2020-08-11 15:48:56 -07:00
Dávid Bolvanský 48887c4e81 [libcxx-fuzzing] Fixed bug found by -Wstring-concatenation 2020-08-08 22:44:14 +02:00
Evgenii Stepanov 189ba3db86 Fix CFI issues in <future>
This change fixes errors reported by Control Flow Integrity (CFI) checking when using `std::packaged_task`.  The errors mostly stem from casting the underlying storage (`__buf_`) to `__base*`, even if it is uninitialized.  The solution is to wrap `__base*` access to `__buf_` behind a getter marked with _LIBCPP_NO_CFI.

Differential Revision: https://reviews.llvm.org/D82627
2020-08-06 12:05:22 -07:00
zoecarver 8697d6cfa8 [libcxx] Add compatible with constraint tests for some shared_ptr constructors.
Add shared_ptr tests where the element type and pointer type aren't 'convertible' but are 'compatible'.

Responding to a comment from D81414.

Differential Revision: https://reviews.llvm.org/D81532
2020-08-01 12:06:31 -07:00
Louis Dionne 19bc9ea480 [libc++] Avoid including <Block.h> from <functional>
Block.h is a pretty common name, which can lead to nasty collisions with
user provided headers. Since we're only getting a few simple declarations
from the header, it's better to declare them manually than to include the
header.

rdar://66384326

Differential Revision: https://reviews.llvm.org/D85035
2020-07-31 14:22:28 -04:00
Louis Dionne d275da17e4 [libc++] Fix eager generator expression in DefineLinkerScript
As explained in https://gitlab.kitware.com/cmake/cmake/-/issues/21045,
both branches of an $<IF> generator expression are evaluated eagerly
by CMake. As a result, if the non-selected branch contains an invalid
generator expression (such as getting the OUTPUT_NAME property of a
non-existent target), a hard error will occur.

This failed builds using the cxxrt ABI library, which doesn't create
a CMake target currently.
2020-07-31 11:20:19 -04:00
Louis Dionne 0a00a7d577 [libc++] Use generator expression in Linker script generation
This is an alternative to the workaround in 34a3b24a90.

Differential Revision: https://reviews.llvm.org/D68880
2020-07-30 11:59:29 -04:00
Louis Dionne 9be1bdc240 [libc++] Add XFAIL for <float.h> and <cfloat> tests on older Clangs 2020-07-30 09:26:55 -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 82b6dec0ed [libc++] Remove c++98 from the possible Standards of the test suite
Clang treats C++98 and C++03 as the same anyway, so it's no use having
two different settings for the same standard.
2020-07-29 14:18:37 -04:00
Louis Dionne b5e896c049 [libc++][pstl] Remove c++98 from UNSUPPORTED annotations
c++98 isn't used by the test suite anymore, only c++03 is.
2020-07-29 14:17:32 -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
Alex Richardson 19e472fd84 [libcxx][lit] Fix running testsuite with python2.7 after 9020d28688
Python 2.7 fails with TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
if you pass None as the prefix argument to NamedTemporaryFile.

Reviewed By: ldionne, bjope, #libc

Differential Revision: https://reviews.llvm.org/D84595
2020-07-27 10:15:18 +01:00
Louis Dionne 918ba93367 [libc++] Build the dylib with -faligned-allocation
This avoids issues when building the dylib for deployment targets that
don't support aligned allocation, where Clang normally triggers an
error to warn users their code would break at runtime when back-deployed.
Since we're building the dylib itself, which contains the aligned
allocation functions, we don't want to trigger that error.

Differential Revision: https://reviews.llvm.org/D84418
2020-07-23 14:04:00 -04:00
Mikhail Maltsev 2b89c34784 [libcxx] Adjust trivial_abi tests for C++03 and C++11 testing
This change replaces std::make_unique with manual construction of
std::unique_ptr to make the tests compatible with C++11
(std::make_unique is a C++14 feature).

libc++ supports std::unique_ptr and std::shared_ptr even in C++03 but
with some limitations: unique_ptr_array.pass.cpp and
shared_ptr_arg.pass.cpp fail to compile in C++03 mode and need to be
disabled.

Differential Revision: https://reviews.llvm.org/D84394
2020-07-23 14:20:49 +01:00
Alex Richardson 9020d28688 [libcxx][lit] Fix incorrect lambda capture in hasLocale checks
The lambda being used to check whether locales are supported was always
passing the value of alts from the last loop iteration due to the way that
python lambda captures work. Fix this by using a default argument capture.

To help debug future similar issues I also added a prefix to the config
test binary indicating which locale is being tested.
I originally found this issue when implementing a new executor that simply
collects test binaries in a given directory and was surprised to see many
additional executables other than the expected test binaries. I therefore
added the locale prefix to the test binaries and noticed that they were all
checking for cs_CZ.ISO8859-2.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84040
2020-07-23 11:19:18 +01:00
Logan Smith 77e0e9e17d Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.

Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 17:50:19 -07:00
Logan Smith 97a0f80c46 Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
This reverts commit 388c9fb1af.
2020-07-22 15:07:01 -07:00
Logan Smith 388c9fb1af Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.
Using add_compile_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
2020-07-22 14:19:34 -07:00
Louis Dionne 9798b2311f [libc++] Make sure we only consider _GNUC_VER_NEW when the compiler is GCC
When the compiler is Clang, _GNUC_VER_NEW is 0, which messes up the logic.
2020-07-22 16:08:19 -04:00
Louis Dionne e9748a7255 [libc++] Workaround broken support for C++17 in GCC 5 2020-07-22 15:38:58 -04:00
Louis Dionne e58660750e [libc++] Build the dylib with C++17 to allow aligned new/delete
This allows simplifying the implementation of barriers.

This is a re-commit of 1ac403bd14, which had to be reverted in
64a9c944fc because the minimum CMake version wasn't high enough.
Now that we've upgraded, we can do this.

Differential Revision: https://reviews.llvm.org/D75243
2020-07-22 14:47:29 -04:00
Louis Dionne afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Hans Wennborg 3eec657825 Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8.
This reverts commit 81d68ad27b.
This reverts commit a361aa5249.
This reverts commit fa42b7cf29.
This reverts commit 955f87f947.
This reverts commit 8b16e45f66.
This reverts commit 308a127a38.
This reverts commit 274b6b0c7a.
This reverts commit 1c7037a2a5.
2020-07-22 20:23:58 +02:00
Alex Richardson e59778a66a [libcxx] Fix default argument for merge_archives.py -L flag
If we use the default of None, we get a python exception in
find_and_diagnose_missing() instead of printing a sensible error message.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84342
2020-07-22 18:32:34 +01:00
Alex Richardson 3980e8956b [libcxx][lit] Simplify parsing of trailing executor arguments
Adding a positional argparse.ONE_OR_MORE arguments will correctly remove
the "--" separator after --env and parse only the command. This also has
the advantage that misspelled flags raise an argparse error rather than
silently being added to the command to be executed.

I discovered this while adding a new commandline option to ssh.py to allow
passing additional arguments to the scp/ssh commands since this is required
for our CHERI CI where we need to pass `-F <custom_config_file>` to each
ssh/scp command to set various arguments such as the localhost port, usage
of controlmaster, etc. to speed up connections to our emulated QEMU systems.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D84096
2020-07-21 09:03:45 +01:00
Vy Nguyen f5e49bd9de Disable trivial weak_ptr test on ARM because it is not expected to work.
Summary:
weak_ptr has two pointers (more than the 4 bytes limit), so it will not be returned in registers on ARM, even if it is trivial.
The test, therefore, will fail on ARM.

Reviewers: #libc!

Subscribers: kristof.beyls, danielkiss, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D84200
2020-07-20 17:02:49 -04:00
Logan Smith 8b16e45f66 Enable -Wsuggest-override in the LLVM build
This patch adds Clang's new (and GCC's old) -Wsuggest-override to the warning flags for the LLVM build. The warning is a stronger form of -Winconsistent-missing-override which warns _everywhere_ that override is missing, not just in places where it's inconsistent within a class.

Some directories in the monorepo need the warning disabled for compatibility's, or sanity's, sake; in particular, libcxx/libcxxabi, and any code implementing or interoperating with googletest, googlemock, or google benchmark (which do not themselves use override). This patch adds -Wno-suggest-override to the relevant CMakeLists.txt's to accomplish this.

Differential Revision: https://reviews.llvm.org/D84126
2020-07-20 12:32:47 -07:00
Vy Nguyen be2267ba34 [libcxx] Skip tests on GCC
Summary: These don't work with GCC

Reviewers: jyknight, #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D84183
2020-07-20 12:53:51 -04:00
Vy Nguyen 76887bc4c1 Reland [libcxx]Put clang::trivial_abi on smart pointers
Reviewed By: ldionne,EricWF

    Tags: #libcxx

    Differential Revision: https://reviews.llvm.org/D82490
2020-07-20 11:54:34 -04:00
serge-sans-paille 515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Louis Dionne 2659663ee3 [libc++] Remove shortcut Lit features for Apple backdeployment
Some time ago, I introduced shortcut features like dylib-has-no-shared_mutex
to encode whether the deployment target supported shared_mutex (say). This
made the test suite annotations cleaner.

However, the problem with building Lit features on top of other Lit
features is that it's easier for them to become stale, especially when
they are generated programmatically. Furthermore, it makes the bar for
defining configurations from scratch higher, since more features have
to be defined. Instead, I think it's better to put the XFAILs in the
tests directly, which allows cleaning them up with a simple grep.
2020-07-16 15:39:08 -04:00
Louis Dionne 9785f7b196 [libc++] Improve how we report the testing configuration 2020-07-16 15:10:17 -04:00
Louis Dionne ff0d4367bf [runtimes] Move the enable_rtti Lit parameter to the DSL 2020-07-16 12:56:00 -04:00
Louis Dionne 0f03626fbf [runtimes][NFC] Remove unused or unnecessary CMake variables 2020-07-16 10:47:08 -04:00
Hans Wennborg 7ab7b979d2 Bump the trunk major version to 12
and clear the release notes.
2020-07-15 12:05:05 +02:00
Louis Dionne eaca1e4e54 [libc++] Automatically detect whether RTTI is enabled
Instead of detecting it automatically but also allowing for the setting
to be specified explicitly, always detect whether exceptions are enabled
based on whether -fno-rtti (or equivalent) is used. It's less confusing
to have a single way of tweaking that knob.

This change follows the lead of 71d88cebfb.
2020-07-14 16:51:37 -04:00
Sterling Augustine 77ee4b4c9b Desugar class type for iterator lookup.
Summary:
Without this, printing sets and maps hidden behind
using declarations fail.

Reviewers: #libc!

Subscribers: libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D83732
2020-07-14 11:37:03 -07:00
Louis Dionne e1ca7a6522 [libc++] Fix building the benchmarks after introducing a target for cxx-headers
The libc++ headers were included twice, which broke the #include_next
logic.
2020-07-14 11:50:12 -04:00
Louis Dionne efa40eb194 [libc++] Use a proper CMake target to represent libc++ headers
Instead of having complex logic around how to include the libc++ headers
and __config_site, handle that by defining cxx-headers as an INTERFACE
library and linking against it. After this patch, linking against cxx-headers
is sufficient to get the right __config_site include and include paths
for libc++.

Differential Revision: https://reviews.llvm.org/D82702
2020-07-14 09:52:58 -04:00
Louis Dionne 2d3b8cc83f [libc++] Implement P0551
Make sure we satisfy the requirements added by P0551, and add tests to
enforce that.
2020-07-13 13:42:26 -04:00
Louis Dionne 389b67b809 [libc++] Get rid of the %{libcxx_src_root} substitution
This reduces the set of substitutions required to run the test suite.
2020-07-09 15:17:47 -04:00
Louis Dionne cfb3675410 [libc++] The enable_experimental Lit feature should be False by default
This preserves existing behavior before f5f58f1f73.
2020-07-09 14:21:24 -04:00