This is a followup to 35bc5276ca. It fixes the dependent libs usage
in libcxx and libcxxabi to link pthread and rt libraries only if CMake
detects them, rather than based on explicit platform blacklist.
Differential Revision: https://reviews.llvm.org/D70888
Android API level 21 and above have all these functions available, so we
don't need to include our fallback definitions.
Differential Revision: https://reviews.llvm.org/D69983
This apparently breaks weird use cases where the build directory is on
a separate drive. Someone reported that failure to me privately.
I can't remember of a reason for collating the two arguments in the
first place, so I don't think this should break anything.
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
Summary:
Rewrite the in-tree build to be a clearer tl;dr like we have for the
out-of-tree build.
Reviewers: EricWF, mclow.lists, ldionne
Reviewed By: ldionne
Subscribers: dexonsmith, christof, ldionne, enh, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D69917
With the upcoming introduction of iterator concepts in ranges,
the meaning of "__is_contiguous_iterator" changes drastically.
Currently we intend it to mean "does it have this iterator category",
but it could now also mean "does it meet the requirements of this
concept", and these can be different.
These traits are currently unused because we don't implement ranges.
However, their addition is part of ongoing work to allow libc++
to optimize on user-provided contiguous iterators.
This function has the same behavior as the now-standand std::to_address.
Re-using the name makes the behavior more clear, and in the future it
will allow us to correctly get the raw pointer for user provided pointer
types.
We effectively never want to export that function, which is an
implementation detail of libc++. This was previously tried in
603715c66b and then reverted in 8335dd314f because it caused
linker warnings. These linker warnings should go away now that we
use internal_linkage instead of always_inline to implement per-TU
insulation.
This change would have warned about the bug found in D62451.
No unit tests since the exception should never throw.
Differential Revision: https://reviews.llvm.org/D62452
Same idea as the current algorithm, that is, add (half of the difference between a and b) to a.
But we use a different technique for computing the difference: we compute b - a into a pair of integers that are named "sign_bit" and "diff". We have to use a pair because subtracting two 32-bit integers produces a 33-bit result.
Computing half of that is a simple matter of shifting diff right by 1, and adding sign_bit shifted left by 31. llvm knows how to do that with one instruction: shld.
The only tricky part is that if the difference is odd and negative, then shifting it by one isn't the same as dividing it by two - shifting a negative one produces a negative one, for example. So there's one more adjustment: if the sign bit and the low bit of diff are one, we add one.
For a demonstration of the codegen difference, see https://godbolt.org/z/7ar3K9 , which also has a built-in test.
Differential Revision: https://reviews.llvm.org/D69459
Use the builtin CMake support for specifying the proper flags for the targets to
build at a certain C++ standard. This avoids unnecessary checks in CMake,
speeding up the configure phase as well as simplifies the logic overall.
PR13592 was caused by a problem in how to compiler implemented the
__is_convertible_to intrinsic. That problem, reported as PR13591,
was fixed back in 2012. We don't support such old versions of Clang
anyway, so we don't need the library workaround that had been added
to solve PR13592 (while waiting for the compiler fix).
Summary:
When the ABI namespace isn't a reserved identifier, we were issuing a
warning, but this should have been an error since the beginning. This
commit enforces that the ABI namespace is a reserved identifier, and
changes the ABI namespace used by LibFuzzer.
Reviewers: phosek, EricWF
Subscribers: mgorny, christof, jkorous, dexonsmith, #sanitizers, libcxx-commits, llvm-commits
Tags: #sanitizers, #libc, #llvm
Differential Revision: https://reviews.llvm.org/D69408
When running libc++ tests on a remote machine via SSH, we can encounter
a 'Permission denied' error.
Fix this with plain old 'chmod +x <executable>'.
Thanks to Sergej Jaskiewicz for the patch.
Differential Revision: https://reviews.llvm.org/D69170
Summary: This patch removes `shared_ptr::make_shared` as it is not part of the standard. This patch also adds __create_with_cntrl_block, which is a help function that can be used in std::allocate_shared and std::make_shared. This is the third patch (out of 4) from D66178.
Reviewers: EricWF, mclow.lists, ldionne
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68805
llvm-svn: 375504
Summary:
In D67316 we added `_LIBCPP_C_HAS_NO_GETS` to signal that the C library
does not provide `gets()`, and added a test for FreeBSD 13 or higher,
using the compiler-defined `__FreeBSD__` macro.
Unfortunately this did not work that well for FreeBSD's own CI process,
since the gcc compilers used for some architectures define `__FreeBSD__`
to match the build host, not the target.
Instead, we should use the `__FreeBSD_version` macro from the userland
header `<osreldate.h>`, which is more fine-grained. See also
<https://reviews.freebsd.org/D22034>.
Reviewers: EricWF, mclow.lists, emaste, ldionne
Reviewed By: emaste, ldionne
Subscribers: dexonsmith, bsdjhb, krytarowski, christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D69174
llvm-svn: 375340
Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings.
Reviewers: mclow.lists, EricWF
Subscribers: christof, ldionne, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D68879
llvm-svn: 375307