An upcoming change in Clang will flag _Atomic as being a C11 extension.
To avoid generating this warning in libc++, this commit marks the only
use of _Atomic with the __extension__ extension, which suppresses such
warnings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370796 91177308-0d34-0410-b5e6-96231b3b80d8
This patch fixes some typos and other small errors in
directory_iterator.cpp that prevented this file from being compiled for
Win32.
Patch by Stefan Schmidt <thrimbor.github@gmail.com>!
Differential Revision: https://reviews.llvm.org/D66986
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370599 91177308-0d34-0410-b5e6-96231b3b80d8
Summary: Also add a test suite.
Reviewers: EricWF
Subscribers: christof, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65609
Run a pep8 formatter.
Run pep8 formatter.
Convert to PEP8, address other comments from code review.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370551 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
`std::vector<T>` is free choose between using copy or move operations when it needs to resize. The standard only candidates that the correct exception safety guarantees are provided. When exceptions are disabled these guarantees are trivially satisfied. Meaning vector is free to optimize it's implementation by moving instead of copying.
This patch makes `std::vector` unconditionally move elements when exceptions are disabled.
This optimization is conforming according to the current standard wording.
There are concerns that moving in `-fno-noexceptions`mode will be a surprise to users. For example, a user may be surprised to find their code is slower with exceptions enabled than it is disabled. I'm sympathetic to this surprised, but I don't think it should block this optimization.
Reviewers: mclow.lists, ldionne, rsmith
Reviewed By: ldionne
Subscribers: zoecarver, christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D62228
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370502 91177308-0d34-0410-b5e6-96231b3b80d8
Since we build the library with -fvisibility=hidden, the shared object
wouldn't contain __vector_base_common<true>::__throw_length_error()
and __vector_base_common<true>::__throw_out_of_range(), leading to
link errors. This only happened on GCC for some reason.
https://llvm.org/PR43140
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370240 91177308-0d34-0410-b5e6-96231b3b80d8
This was reported as part of a bug report that ended up being a
duplicate for r340609, but I'm adding the test case since it's
ever so slightly different from what we had before.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@370109 91177308-0d34-0410-b5e6-96231b3b80d8
Popen.communicate() method in Python 2 returns a pair of strings, and in
Python 3 it returns a pair of byte-like objects unless universal_newlines
is set to True. This led to an error when using Python 3. With this patch,
merge_archives.py works fine with Python 3.
Thanks to Sergej Jaskiewicz for the patch.
Differential Revision: https://reviews.llvm.org/D66649
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369764 91177308-0d34-0410-b5e6-96231b3b80d8
The build should generally be quiet if there are no errors,
and this script has been around long enough that we can remove
the log output. If we ever need to debug something with this script,
we can put back the logging then.
Differential Revision: https://reviews.llvm.org/D66594
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369757 91177308-0d34-0410-b5e6-96231b3b80d8
In r369429, I hoisted a floating point computation to a variable in order
to remove a warning. However, it turns out this doesn't play well with
floating point arithmetic. This commit reverts r369429 and instead casts
the result of the floating point computation to remove the warning.
Whether hoisting the computaiton to a variable should give the same
result can be investigated independently.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369693 91177308-0d34-0410-b5e6-96231b3b80d8
On systems where sizeof(long) == sizeof(int)
the current tests failed. This commit updates
those tests to work on all systems.
std::abs has specific long specializations
which can be used instead.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369437 91177308-0d34-0410-b5e6-96231b3b80d8
By stashing the computation of `E::max() - E::min()` in a variable, we
avoid the warning introduced in r367497. Note that we use `auto` to
avoid having to deduce the type of the computation, which is not a
problem since Clang provides `auto` as an extension even in C++03 (and
we disable warnings related to using C++11 extensions in the test suite).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369429 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
The resolution of LWG 3199 makes sure that input-streaming into an empty bitset
does not set the failbit on the input stream.
Reviewers: mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D65105
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369422 91177308-0d34-0410-b5e6-96231b3b80d8
On some systems char is unsigned.
If that is the case, we will now
test signed char twice in std::abs.
NFC. Fixes the build bots.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369413 91177308-0d34-0410-b5e6-96231b3b80d8
In r368882, I enabled those tests for all AppleClang's above version 9.
However, it turns out that the feature is only supported starting with
AppleClang 10.0.1, not AppleClang 10.0.0. This commit fixes that hole.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369409 91177308-0d34-0410-b5e6-96231b3b80d8
If the compiler is (for example) AppleClang 10.0.1, we would previously
populate the following lit features:
apple-clang
apple-clang-10
apple-clang-10.0
This patch additionally populates a feature called 'apple-clang-10.0.1',
which allows more precise enabling/disabling of tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@369406 91177308-0d34-0410-b5e6-96231b3b80d8
Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is
insufficient. I suspect the corresponding LLVM Clang is broken too,
but we don't seem to have testers using that Clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368911 91177308-0d34-0410-b5e6-96231b3b80d8
In r292833, we started defining _LIBCPP_CLANG_VER to 0 for Apple Clang.
The result is that AppleClang is detected as being a very old version
of LLVM Clang (version 0), which is obviously incorrect.
I believe this was added so that we don't have to check whether
_LIBCPP_CLANG_VER is defined prior to comparing it with a number
(which can trigger a warning). This commit also fixes the two
places that use the macro correspondingly.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368880 91177308-0d34-0410-b5e6-96231b3b80d8
The operator""y and operator""d will eventually be supported by
AppleClang, but no released version supports them at the moment.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368749 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
This avoids symbols being accidentally exported from the dylib when they
shouldn't. The next step is to use a pragma to apply hidden visibility
to all declarations (unless otherwise specified), which will allow us
to drop the per-declaration hidden visibility attributes we currently
have.
This also has the nice side effect of making sure the dylib exports the
same symbols regardless of the optimization level.
PR38138
Reviewers: EricWF, mclow.lists
Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D62868
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368703 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
D64914 added support for applying [[nodiscard]] to constructors. This
commit uses that capability to flag incorrect uses of std::lock_guard
where one forgets to actually create a variable for the lock_guard.
rdar://45790820
Reviewers: mclow.lists, EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits, Quuxplusone, lebedev.ri
Tags: #libc
Differential Revision: https://reviews.llvm.org/D65900
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368664 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
We were using implicit deduction guides instead of explicit ones,
however the implicit ones don't do work anymore when changing the
constructors.
This commit adds the actual guides specified in the Standard to make
libc++ (1) closer to the Standard and (2) more resistent to changes
in std::tuple's constructors.
Reviewers: Quuxplusone
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D65225
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@368599 91177308-0d34-0410-b5e6-96231b3b80d8