Commit Graph

2606 Commits

Author SHA1 Message Date
Ben Craig b9599b1b23 [libcxx] Allow explicit pthread opt-in
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
2016-05-25 17:40:09 +00:00
Ben Craig 57b8b1f75f Reorganize locale extension fallbacks. NFCI
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
2016-05-20 12:58:41 +00:00
Eric Fiselier 53df829bd1 Cleanup superfluous std:: qualifiers in <type_traits>
llvm-svn: 269998
2016-05-18 23:09:24 +00:00
Eric Fiselier ae7619a8a3 Optimize declval for compile times. Patch from Eric Niebler.
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
2016-05-18 22:23:46 +00:00
Marshall Clow 2dd562e3d9 Mark LWG2583 as complete. I did this a while ago, and forgot to update the table.
llvm-svn: 269973
2016-05-18 19:31:01 +00:00
Marshall Clow 3379baeb99 Change the control flow in atomic_compare_exchange_strong to avoid a potential deadlock.
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
2016-05-18 17:50:13 +00:00
Eric Fiselier 6a05b007ff Test hijacking ADL for operator& in the stream iterator constructors.
llvm-svn: 269838
2016-05-17 21:01:20 +00:00
Eric Fiselier 7b65137677 Add test for r269789
llvm-svn: 269812
2016-05-17 19:52:32 +00:00
Marshall Clow bc6a7df072 Implement LWG2576: istream_iterator and ostream_iterator should use std::addressof
llvm-svn: 269789
2016-05-17 17:44:40 +00:00
Marshall Clow 6c3fa193bf Add some checking so that the TEST_HAS_XXX macros match up with the _LIBCPP_NO_HAS_XXX macros. No functional change
llvm-svn: 269773
2016-05-17 14:58:09 +00:00
Marshall Clow 4328c2bac8 Implement P0030R1: Introduce a 3-Argument Overload to std::hypot
llvm-svn: 269772
2016-05-17 14:52:19 +00:00
Eric Fiselier 46a256a3eb Remove C++11 feature macros in tests. Use TEST_STD_VER instead.
llvm-svn: 269669
2016-05-16 17:05:14 +00:00
Marshall Clow 779ddd134d Add a test for uniqueptr having either NULL and nullptr
llvm-svn: 269665
2016-05-16 16:57:15 +00:00
Marshall Clow 0e1c6c7ed1 Add a couple of _LIBCPP_ASSERT calls. No functional change.
llvm-svn: 269663
2016-05-16 16:55:32 +00:00
Asiri Rathnayake 28383a4e03 Disable LIBCXX_ENABLE_ABI_LINKER_SCRIPT for static library builds.
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
2016-05-14 23:58:11 +00:00
Marshall Clow 1168ca925c Apply D20014 - fix a missing return in a test. Fixes PR#27720
llvm-svn: 269298
2016-05-12 14:31:35 +00:00
Eric Fiselier a5e201fd55 [libcxx] Prefer C++14 over C++11 when building libc++experimental.
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
2016-05-10 16:17:43 +00:00
Eric Fiselier 31dd2b1c88 Generate code coverage for experimental libraries
llvm-svn: 268887
2016-05-08 23:08:50 +00:00
Eric Fiselier b06c012243 Enable Pthread threading API on Solaris. Fix PR27677
llvm-svn: 268860
2016-05-07 17:05:46 +00:00
Eric Fiselier 2266a8d473 Fix memory_resource build for _LIBCPP_HAS_NO_THREADS
llvm-svn: 268850
2016-05-07 05:37:31 +00:00
Eric Fiselier 8dbe074baf Update TS implementation status page
llvm-svn: 268844
2016-05-07 03:24:31 +00:00
Eric Fiselier 4524d6e739 Change allocator<T>::allocate to throw length_error, not bad_alloc
llvm-svn: 268842
2016-05-07 03:12:24 +00:00
Eric Fiselier 522a7f9535 Add experimental container alias templates for PMRs
llvm-svn: 268841
2016-05-07 03:09:55 +00:00
Eric Fiselier 946c9b4920 Fix one more usage of _LIBCPP_HAS_NO_EXCEPTIONS
llvm-svn: 268839
2016-05-07 02:33:25 +00:00
Eric Fiselier 27acf7585d Fix typo it _LIBCPP_NO_EXCEPTIONS macro
llvm-svn: 268838
2016-05-07 02:30:21 +00:00
Eric Fiselier 15551efd43 Add <experimental/memory_resource>
Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20007

llvm-svn: 268829
2016-05-07 01:04:55 +00:00
Eric Fiselier 57175711eb Tweak --param=no_default_flags=true to still add -Ilibcxx/test/support
llvm-svn: 268801
2016-05-06 21:35:06 +00:00
Asiri Rathnayake c7e4239fab Refactor pthread usage of libcxx.
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
2016-05-06 14:06:29 +00:00
Eric Fiselier 7946c3f0e2 Fix errors in documentation
llvm-svn: 268709
2016-05-06 04:49:30 +00:00
Eric Fiselier 41fe4bacf5 Fix sphinx build. This is a temporary solution.
llvm-svn: 268614
2016-05-05 08:12:25 +00:00
Eric Fiselier d742bcc9f6 Try and fix sphinx build
llvm-svn: 268613
2016-05-05 06:30:05 +00:00
Eric Fiselier 4a9578aefe Removing some trailing whitespace
llvm-svn: 268543
2016-05-04 20:29:19 +00:00
Marshall Clow 96051a4efc Fixed some spelling errors in assert messages. No functional change. Thanks to giffunip@yahoo.com for the report.
llvm-svn: 268510
2016-05-04 15:35:50 +00:00
Eric Fiselier 43e3a64270 Update version numbers in docs
llvm-svn: 268459
2016-05-03 22:50:33 +00:00
Eric Fiselier 539cd6758b Add documentation for new experimental library
llvm-svn: 268456
2016-05-03 22:32:08 +00:00
Eric Fiselier ad89e3855c Make check-libcxx dependant on libc++experimental if present.
llvm-svn: 268451
2016-05-03 21:58:07 +00:00
Eric Fiselier 27cb2f1225 Create new library 'libc++experimental.a' for packaging TS symbols.
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
2016-05-03 21:30:18 +00:00
Chris Bieneman b05112452f [CMake] Fix a copy-paste error
Based on post commit feedback from Eric Fiselier.

llvm-svn: 268401
2016-05-03 16:54:20 +00:00
Eric Fiselier 59e9748cb5 Fix dependencies on install-libcxx CMake target
llvm-svn: 268363
2016-05-03 05:34:38 +00:00
Eric Fiselier 95b632d4b9 Fix PR27538. Remove __is_convertible specializations for array and function types.
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
2016-05-03 04:26:02 +00:00
Eric Fiselier 15a297212f [libcxx] [test] Replace non-Standard "atomic_flag f(false);" with Standard "atomic_flag f;"
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
2016-05-03 02:12:26 +00:00
Eric Fiselier 43a10eb637 Don't use std::__clz in 'test/support/hexfloat.h'.
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
2016-05-03 02:04:26 +00:00
Eric Fiselier 4df2666da1 Guard use of <unistd.h> in test.
llvm-svn: 268346
2016-05-03 00:36:57 +00:00
Eric Fiselier 76af416afc Cleanup warnings and remove use of __builtin_va_list in depr.c.headers
llvm-svn: 268294
2016-05-02 20:08:16 +00:00
Eric Fiselier c090b04045 Initialize local doubles to NaN. Patch from STL@microsoft.com
llvm-svn: 268285
2016-05-02 19:20:16 +00:00
Eric Fiselier fb42f4c44a Void cast runtime-unused variables. Patch from STL@microsoft.com
llvm-svn: 268284
2016-05-02 19:15:48 +00:00
Eric Fiselier 53ca3c93db Replace one more occurrence of non-standard std:launch::any. Patch from STL@microsoft.com
llvm-svn: 268153
2016-04-30 02:30:18 +00:00
Chris Bieneman 4497e3a1e6 [CMake] Create a separate install target for libcxx headers
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
2016-04-29 22:17:15 +00:00
Eric Fiselier 3ed9f6ebde Fix PR21428 for long. Buffer was one byte too small in octal formatting case. Rename previously added test
llvm-svn: 268009
2016-04-29 07:23:20 +00:00
Eric Fiselier cc06271d12 Move extern C include test into test/libcxx
llvm-svn: 267983
2016-04-29 04:19:48 +00:00