The existing pthread detection code in __config is pretty good for
common operating systems. It doesn't allow cmake-time choices to be
made for uncommon operating systems though.
This change adds the LIBCXX_HAS_PTHREAD_API cmake flag, which turns
into the _LIBCPP_HAS_THREAD_API_PTHREAD preprocessor define. This is
a name change from the old _LIBCPP_THREAD_API_PTHREAD. The lit tests
want __config_site.in variables to have a _LIBCPP_HAS prefix.
http://reviews.llvm.org/D20573
llvm-svn: 270735
The various _l locale extension functions originate from very
different places. Some come from POSIX, some are BSD extensions,
and some are shared BSD and GLIBC extensions. This patch tries to
group the local extension reimplementations by source. This should
make it easier to make libcxx work with POSIX compliant C libraries
that lack these extensions.
The fallback locale functions are also useful on their own for other
lightweight platforms. Putting these fallback implementations in
support/xlocale should enable code sharing.
I have no access to a newlib system or an android system to build
and test with. I _do_ have access to a system without any of the _l
locale extensions though, and I was able to ensure that the new
__posix_l_fallback.h and __strtonum_fallback.h didn't have any massive
problems.
http://reviews.llvm.org/D17416
llvm-svn: 270213
This patch implements the C++11 version of declval without requiring a template
instantiation.
See PR27798 for more information. https://llvm.org/bugs/show_bug.cgi?id=27798
llvm-svn: 269991
When you assign a shared_ptr, the deleter gets called and assigned. In this routine, the assignment happens inside a critical section, which could (potentially) lead to a deadlock, if the deleter did something wonky. Now we swap the old value with an (empty) temporary shared_ptr, and then let the temporary delete the old value when it goes out of scope (after the lock has been released). This should fix PR#27724. Thanks to Hans Boehm for the bug report and the suggested fix.
llvm-svn: 269965
This option is geared towards shared library builds and causes static
library builds to fail if not explicitly disabled.
This patch fixes PR27706: https://llvm.org/bugs/show_bug.cgi?id=27706
Thanks rgoodfel@isi.edu for the catch.
llvm-svn: 269585
Summary:
Currently libc++experimental builds with C++11. This patch changes that to C++14 when supported by the compiler. Although nothing currently requires C++14 the upcoming <experimental/memory_resource> implementation would benefit from it. [1]
Note that libc++.so continues to build with C++11 and is unaffected by this change.
[1] <experimental/memory_resource> provides global resources which must exist for the entire lifetime of the program. In order to ensure that a global resource can be used during program termination there destructors must never be invoked. The only way to do this, while also allowing "constant initialization", is to use a C++14 union.
Reviewers: mclow.lists
Subscribers: pete, cfe-commits
Differential Revision: http://reviews.llvm.org/D19992
llvm-svn: 269070
This patch extracts out all the pthread dependencies of libcxx into the
new header __threading_support. The motivation is to make it easy to
re-target libcxx into platforms that do not support pthread.
Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781
Applied with tweaks - D19412
Change-Id: I301111f0075de93dd8129416e06babc195aa936b
llvm-svn: 268734
Summary:
Out-of-line symbols for <experimental/...> headers are not ABI or API stable and cannot live in the 'libc++.dylib'. Currently they have nowhere to live. I would like to add a new library target `libc++experimental.a` to fix this.
Previously I had suggested different libraries for different TS's (`libc++filesystem.a`, 'libc++LFTS.a`, ect). I no longer think this is the right approach.
Instead `c++experimental` will hold *all* TS implementations as a single monolithic library. I see two main benefits to this:
1. Users only have to know about and manually link one library.
2. It makes it easy to implement TS's with one or two out-of-line symbols. (Ex. PMRs)
`c++experimental` provides NO ABI compatibility. Symbols can freely be added/removed/changed without concern for ABI stability.
I will add documentation for this after landing this patch (but before adding anything to it).
`c++experimental` only builds as a static library. By default CMake will build/test this library but will *NOT* install it.
This patch adds the CMake and LIT logic needed to build/test the new library. Once this lands I plan on using it to implement parts of `<experimental/memory_resource>`.
Reviewers: mclow.lists
Subscribers: cfe-commits, theraven, krememek, dexonsmith, bcraig, beanz, danalbert
Differential Revision: http://reviews.llvm.org/D19856
llvm-svn: 268443
This patch fixes a bunch of bugs in the fallback implementation of
is_convertible, which is used by GCC. Removing the "__is_convertible"
specializations for array/function types we fallback on the SFINAE test,
which is more correct.
See https://llvm.org/bugs/show_bug.cgi?id=27538
llvm-svn: 268359
Summary:
Replace non-Standard "atomic_flag f(false);" with Standard "atomic_flag f;" in clear tests.
Although the value of 'f' is unspecified it shouldn't matter because these tests always call `f.test_and_set()` without checking the result, so the initial state shouldn't matter.
The test init03.pass.cpp is explicitly testing this non-Standard extension; It has been moved into the `test/libcxx` directory.
Reviewers: mclow.lists, STL_MSFT
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D19758
llvm-svn: 268355
std::__clz is a libc++ specific function so it can't be used in the test suite.
This patch implements a dumb "count leading zeros" implementation within
hexfloat itself.
This patch also fixes UB since the output of `__builtin_clz(0)` is undefined
according to the GCC docs.
llvm-svn: 268354
This change doesn't impact the behavior of the install-libcxx target which installs whichever libcxx components you build, it just adds a separate target to just install the headers.
llvm-svn: 268124