Commit Graph

2277 Commits

Author SHA1 Message Date
Eric Fiselier 10ac1f98fa Add files that got missed in r245512.
llvm-svn: 245513
2015-08-19 22:35:56 +00:00
Eric Fiselier 2228a8a3f2 More unique_ptr test cleanup. Fixes in <memory> to come later.
llvm-svn: 245512
2015-08-19 22:35:07 +00:00
Eric Fiselier 7cb813ffc4 [libcxx] Add "install-libcxx" target.
Summary: Currently you can't install libc++ from within the LLVM tree without installing all of LLVM. This patch adds an install rule for libc++.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Subscribers: cfe-commits

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

llvm-svn: 245470
2015-08-19 17:41:53 +00:00
Eric Fiselier 92499e455e Remove test_atomic.h header
Because <atomic> can now be used in C++03 there is no need for the test_atomic.h header.
This commit removes the header and converts all usages to use <atomic> instead.

llvm-svn: 245468
2015-08-19 17:37:34 +00:00
Alexey Samsonov 0fc7892b77 Replace __asan_set_error_exit_code() with __sanitizer_set_death_callback()
Summary: We are going to remove the former soon.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 245467
2015-08-19 17:28:01 +00:00
Eric Fiselier 749adeba3d [libcxx] Allow use of <atomic> in C++03. Try 3.
Summary:
After putting this question up on cfe-dev I have decided that it would be best to allow the use of `<atomic>` in C++03. Although static initialization is a concern the syntax required to get it is C++11 only. Meaning that C++11 constant static initialization cannot silently break in C++03, it will always cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` remain defined in C++03 even though they cannot be used because C++03 usages will cause better error messages.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP`      - Defined on clang versions which provide the C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include `<atomic>`.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually exclusive, only one should be defined. If neither is defined then `<atomic>` is not implemented and including `<atomic>` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245463
2015-08-19 17:21:46 +00:00
Dimitry Andric 251c629117 Fix warnings about pessimizing return moves for C++11 and higher
Summary:
Throughout the libc++ headers, there are a few instances where
_VSTD::move() is used to return a local variable.  Howard commented in
r189039 that these were there "for non-obvious reasons such as to help
things limp along in C++03 language mode".

However, when compiling these headers with warnings on, and in C++11 or
higher mode (like we do in FreeBSD), they cause the following complaints
about pessimizing moves:

    In file included from tests.cpp:26:
    In file included from tests.hpp:29:
    /usr/include/c++/v1/map:1368:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
        return _VSTD::move(__h);  // explicitly moved for C++03
               ^
    /usr/include/c++/v1/__config:368:15: note: expanded from macro '_VSTD'
    #define _VSTD std::_LIBCPP_NAMESPACE
                  ^

Attempt to fix this by adding a _LIBCPP_EXPLICIT_MOVE() macro to
__config, which gets defined to _VSTD::move for pre-C++11, and to
nothing for C++11 and later.

I am not completely satisfied with the macro name (I also considered
_LIBCPP_COMPAT_MOVE and some other variants), so suggestions are
welcome. :)

Reviewers: mclow.lists, howard.hinnant, EricWF

Subscribers: arthur.j.odwyer, cfe-commits

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

llvm-svn: 245421
2015-08-19 06:43:33 +00:00
Eric Fiselier 9c039962ca Use TestAtomic instead of std::atomic so the test can run in C++03
llvm-svn: 245415
2015-08-19 05:00:36 +00:00
Eric Fiselier 1df02ee1f9 Mark std::packaged_task tests as unsupported in C++03.
std::packaged_task requires variadic templates and is #ifdef out in C++03.
This patch silences the tests in C++03. This patch also rewrites the .fail.cpp tests so that they use clang verify.

llvm-svn: 245413
2015-08-19 04:10:15 +00:00
Eric Fiselier 21851d2b45 Remove commented out TODOs. They defined unneeded methods.
llvm-svn: 245411
2015-08-19 03:48:08 +00:00
Eric Fiselier 9a5e62bf75 Fix use of static_assert macro with nested commas
llvm-svn: 245410
2015-08-19 03:38:41 +00:00
Eric Fiselier 10967a6ea6 [libcxx] Add Atomic test helper and fix TSAN failures.
Summary:
This patch attempts to fix the last 3 TSAN failures on the libc++ bot (http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-tsan/builds/143). This patch also adds a `Atomic` test type that can be used where `<atomic>` cannot.

`wait.exception.pass.cpp` and `wait_for.exception.pass.cpp` were failing because the test replaced `std::terminate` with `std::exit`. `std::exit` would asynchronously run the TLS and static destructors and this would cause a race condition. See PR22606 and D8802 for more details. 

This is fixed by using `_Exit` to prevent cleanup.

`notify_all_at_thread_exit.pass.cpp` exercises the same race condition but for different reasons. I fixed this test by manually joining the thread before beginning program termination.

Reviewers: EricWF, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245389
2015-08-18 23:29:59 +00:00
Eric Fiselier e8fd164569 Move atomic_support.h and config_elast.h into src/include
llvm-svn: 245354
2015-08-18 21:08:54 +00:00
Marshall Clow 29f11b381f Broke C++03 compatibility in 245330. Fix that.
llvm-svn: 245336
2015-08-18 19:51:37 +00:00
Eric Fiselier 0d28f78401 [libcxx] Fix PR23589: std::function doesn't recognize null pointer to varargs function.
Summary:
This patch fixes __not_null's detection of nullptr by breaking it down into 4 cases.

1. `__not_null(Tp const&)`: Default case. Tp is not null.
2. `__not_null(Tp* __ptr);` Case for pointers to functions.
3. `__not_null(_Ret _Class::* __ptr);` Case for pointers to members.
4. `__not_null(function<Tp> const&);`: Cases for other std::functions.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245335
2015-08-18 19:41:51 +00:00
Eric Fiselier 4504cf2c8d [libc++] Fix PR22606 - Leak pthread_key with static storage duration to ensure all of thread-local destructors are called.
Summary:
See https://llvm.org/bugs/show_bug.cgi?id=22606 for more discussion.

Most of the changes in this patch are file reorganization to help ensure assumptions about how __thread_specific_pointer is used hold. The assumptions are:

* `__thread_specific_ptr<Tp>` is only created with a `__thread_struct` pointer.
* `__thread_specific_ptr<Tp>` can only be constructed inside the `__thread_local_data()` function.

I'll remove the comments before committing. They are there for clarity during review.

Reviewers: earthdok, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245334
2015-08-18 19:40:38 +00:00
Eric Fiselier 556f9340f7 [libcxx] Disable -Wnon-virtual-dtor warning in <locale>
Summary:
Normally people won't see warnings in libc++ headers, but if they compile with "-Wsystem-headers -Wnon-virtual-dtor" they will likely see issues in <locale>.

In the libc++ implementation `time_get' has a private base class, `__time_get_c_storage`, with virtual methods but a non-virtual destructor. 
`time_get` itself can safely be used as a polymorphic base class because it inherits a virtual destructor from `locale::facet`. To placate the compiler we change `__time_get_c_storage`'s destructor from public to protected, ensuring that it will never be deleted polymorphically.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 245333
2015-08-18 19:39:35 +00:00
Marshall Clow 1378a5aec3 implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations
llvm-svn: 245330
2015-08-18 18:57:00 +00:00
Marshall Clow 05ddbffbf3 Make regex and any assert when they should throw an exception _but_ the user has decreed 'no exceptions'. This matches the behavior of string and vector
llvm-svn: 245239
2015-08-17 21:14:16 +00:00
Eric Fiselier 62d526bd81 Fix CMake error whet llvm-config reports a non-existent source directory.
llvm-svn: 244717
2015-08-12 06:36:19 +00:00
Joerg Sonnenberger 08142fa6c7 Protect template argument from user interference.
llvm-svn: 244462
2015-08-10 16:58:04 +00:00
Marshall Clow 5d74bd1045 Update some links so that they don't point at the (private) WG21 Wiki
llvm-svn: 244047
2015-08-05 14:36:42 +00:00
Tanya Lattner 29f6af3657 Update references to lists.llvm.org
llvm-svn: 244003
2015-08-05 03:59:14 +00:00
Marshall Clow 2d265aee08 Change char_traits<char16_t>::eof() to return 0xFFFF instead of 0xDFFF. Fixes PR#24342
llvm-svn: 243937
2015-08-04 01:38:34 +00:00
Eric Fiselier 16bd6cbdf0 Remove -Werror when using check_cxx_compiler_flag because it was causing compiler-rt breakages.
llvm-svn: 243784
2015-07-31 21:09:38 +00:00
Eric Fiselier 5e6aa9bdeb Print message when configuring for standalone build.
llvm-svn: 243737
2015-07-31 06:08:32 +00:00
Eric Fiselier 32ad52170c Fix failing unique_ptr tests.
When I was refactoring the unique_ptr.single.ctor tests I added a test
deleter, 'NCDeleter', to deleter.h. Other tests that include deleter.h
redefine the NCDeleter type causing test failures.

llvm-svn: 243733
2015-07-31 04:34:25 +00:00
Eric Fiselier a0832b5743 Start cleanup of unique_ptr tests.
One of the last sections of tests that still fail in C++03 are the unique_ptr
tests. This patch begins cleaning up the tests and fixing C++03 failures.

The main changes of this patch:
  - The "Deleter" type in "deleter.h" tried to be "move-only" in C++03. However
    the move simulation no longer works (see "__rv"). "Deleter" is now copy
    constructible in C++03. However copying "Deleter" will "move" the test value
    instead of copying it.

  - Reduce the unique.ptr.single.ctor tests files from ~25 to 4. There is no
    reason the tests were split through so many files.

llvm-svn: 243730
2015-07-31 02:43:52 +00:00
Eric Fiselier 5265a3ed71 Mark any as done and comment out extra methods until speaking to Marshall
llvm-svn: 243729
2015-07-31 02:29:11 +00:00
Eric Fiselier 3461dbc0a7 [libcxx] Add <experimental/any> v2.
Summary:
This patch adds the second revision of <experimental/any>. 
I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any



Reviewers: danalbert, jroelofs, K-ballo, mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 243728
2015-07-31 02:24:58 +00:00
Eric Fiselier 66d86b7cad Add -Wno-error by default to work around failing compiler-rt builds
llvm-svn: 243725
2015-07-31 01:25:01 +00:00
Eric Fiselier 10ed6c361c Reapply working parts of CMake cleanup.
This patch adds the working parts of r243503. The difference with this patch
is that it doesn't include the HandleLLVMOptions.cmake file.

llvm-svn: 243698
2015-07-30 22:30:34 +00:00
Marshall Clow a6438ca12a Fix PR#24267. use numeric_limits::max instead of ~0 for 'all ones', since that might give wrong answers on a 1's complement machine.
llvm-svn: 243674
2015-07-30 18:26:34 +00:00
Marshall Clow 40631133b4 Change some #ifdefs to #if - thanks to Dexon for thge catch.
llvm-svn: 243641
2015-07-30 13:56:00 +00:00
Eric Fiselier b98aa4359a Revert recent CMake changes again due to failing compiler-rt builds
llvm-svn: 243593
2015-07-29 23:46:55 +00:00
Eric Fiselier 5f6d160b5b Attempt to fix build issues introduced by
r243574

llvm-svn: 243591
2015-07-29 23:23:18 +00:00
Nick Lewycky dd2eb13ac4 Fix typo in unused variable name.
llvm-svn: 243586
2015-07-29 22:38:23 +00:00
Eric Fiselier ff16b9ac90 Recommit r243503 "[libcxx] Cleanup CMake configuration and integrate with LLVM"
This change was reverted in r243550 because it broke clang-format builds
(see PR24306).

This patch recommits a fixed version of the original.

llvm-svn: 243574
2015-07-29 21:07:28 +00:00
Hans Wennborg 1e33bbecb9 Revert r243503 "[libcxx] Cleanup CMake configuration and integrate with LLVM"
This caused clang-format to stop linking on Mac; see PR24306.

llvm-svn: 243550
2015-07-29 18:32:21 +00:00
Marshall Clow adfdae18c8 Fix a self-move bug in inplace_merge. Thanks to Ted and Dexon for the report and the suggested fix.
llvm-svn: 243530
2015-07-29 16:25:45 +00:00
Eric Fiselier 7eb30deff1 [libcxx] Cleanup CMake configuration and integrate with LLVM
Summary:
This patch contains the following changes:

1. Require that libc++ can find a LLVM source directory. This is done the same way as `libc++abi` currently does.
2. Cleanup ugly configuration code in CMakeLists.txt by using `add_flags`, `add_flags_if`, and `add_flags_if_supported` macros.

The goals for this patch are:

1. Help libc++ be more consistent with how LLVM handles CMake options (see PR23670 PR23671).
2. Make it easier to use sanitizers using the `LLVM_USE_SANITIZER` option.
3. Make libc++'s CMakeLists.txt file easier to understand and change.
4. Move towards allowing libc++ to create Sphinx documentation (see http://efcs.ca/libcxx-docs). 
5. Move towards allowing  libc++ to use other LLVM utilities such as `not` and `FileCheck`.

  

Reviewers: mclow.lists, jroelofs, danalbert

Subscribers: cfe-commits

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

llvm-svn: 243503
2015-07-29 00:03:51 +00:00
Eric Fiselier 99a47ef90e Remove sanitizer XFAILs on a test.
llvm-svn: 243499
2015-07-28 23:27:03 +00:00
Marshall Clow bcbc37d8a1 Consolidate a bunch of #ifdef _LIBCPP_NO_EXCEPTIONS .. #endif blocks into a single template function. NFC
llvm-svn: 243415
2015-07-28 13:30:47 +00:00
Eric Fiselier 10e51f84d4 Mark async tests as UNSUPPORTED in C++03 because it requires variadics
llvm-svn: 243393
2015-07-28 07:49:15 +00:00
Eric Fiselier abd52cad84 Fix a handful of tests that fail in C++03
llvm-svn: 243392
2015-07-28 07:31:50 +00:00
Eric Fiselier e62bda70aa Cleanup C++03 __invoke for Bullets 3 and 4.
The key changes in this patch are:

1. Remove the zero-argument overload in mem_fn. A member function must always
   be invoked with at least one argument, the class instance. The zero-argument
   operator()() in mem_fn would cause mem_fn to fail to compile when because
   the call to '__invoke(pm)' is not well formed.

2. Prevent evaluation of '__apply_cv<Tp, Ret>' when 'Ret' is a function type.
   'Ret' is a function type whenever 'Ret Tp::*' is a pointer to member function.
   Attempting to add cv and ref qualifiers to a function type can cause a hard
   compile error.

3. Remove the dummy overload __invoke(Rp Tp::*). It was present to help work
   around #1. It will be replaced with a different '__invoke' overload that
   represents a bad call to invoke.

After applying this patch the test func.wrap.func.inv/invoke.pass.cpp now
passes.

llvm-svn: 243370
2015-07-28 02:15:53 +00:00
Eric Fiselier fda20d94e7 Get C++03 __invoke working for bullet 5 of INVOKE.
This patch does a couple of things to get __invoke working for free-functions
and call objects.

1. Turn all uses of declval<Tp>() into declval<Tp&>(). The C++03 __invoke only
   supports lvalues but it will be used when the compiler supports rvalue
   references but not variadic templates. This change makes sure we don't
   generate an rvalue.

2. Call objects for bullet 5 are now passed by reference and not value. Copying
   the functor is incorrect. It will fail to compile for non-copyable functors
   and it will discard cv-qualifiers on the call object, possibly leading to the
   wrong function being called. I suspect that the reason the call object
   was originally taken by value was to support temporary call objects.
   However __invoke is only used internally and it is never given a temporary.

llvm-svn: 243368
2015-07-28 01:52:08 +00:00
Eric Fiselier 522b1d14ef Checking more __invoke tests.
Before I start trying to fix __invoke in C++03 it needs better test coverage.
This patch adds a large amount of tests for __invoke.

llvm-svn: 243366
2015-07-28 01:25:36 +00:00
Marshall Clow 983d178108 Detect and throw on a class of bad regexes that we mistakenly accepted before. Thanks to Trevor Smigiel for the report
llvm-svn: 243030
2015-07-23 18:27:51 +00:00
Justin Bogner 2ea8daaee1 Mark this test as XFAIL with older compilers, since they hit PR18097
llvm-svn: 242967
2015-07-22 23:32:57 +00:00
Eric Fiselier 00f512ebdf Merge C++03 and C++11 implementations of mem_fn and __mem_fn.
The implementation of mem_fn doesn't actually require any  C++11 support.
For some reason there were 17 overloads for mem_fn in C++03 when only one
is needed. This patch removes the extra overloads and uses the same implementation
of mem_fn in C++03 and C++11.

__mem_fn does require variadics to implement the call operator. Instead of
having two entirely different implementations of the __mem_fn struct, this patch
uses the same __mem_fn struct but provides different call operators when
variadics are not available.

The only thing left in <__functional_03> is the C++03 implementation of
std::function.

llvm-svn: 242959
2015-07-22 22:43:27 +00:00
Eric Fiselier 48cf128785 Remove almost everything in <__functional_base_03>
This patch removes a large amount of duplicate code found in both
<__functional_base> and <__functional_base_03>. The only code that remains
in <__functional_base_03> is the C++03 implementation of __invoke and
__invoke_return.

llvm-svn: 242951
2015-07-22 22:23:49 +00:00
Eric Fiselier e345173146 Remove more commented out code. That is what version control is for.
llvm-svn: 242872
2015-07-22 04:37:12 +00:00
Eric Fiselier e5407178d6 Cleanup <__functional_03>
<__functional_03> provides the C++03 definitions for std::memfun and
std::function. However the interaction between <functional> and <__functional_03>
is ugly and duplicates code needlessly. This patch cleans up how the two
headers work together.

The major changes are:

- Provide placeholders, is_bind_expression and is_placeholder in <functional>
  for both C++03 and C++11.

- Provide bad_function_call, function fwd decl,
  __maybe_derive_from_unary_function and __maybe_derive_from_binary_function
  in <functional> for both C++03 and C++11.

- Move the <__functional_03> include to the bottom of <functional>. This makes
  it easier to see how <__functional_03> interacts with <functional>

- Remove a commented out implementation of bind in C++03. It's never going
  to get implemented.

- Mark almost all std::bind tests as unsupported in C++03. std::is_placeholder
  works in C++03 and C++11. std::is_bind_expression is provided in C++03 but
  always returns false.

llvm-svn: 242870
2015-07-22 04:14:38 +00:00
Eric Fiselier b50f8f9ee7 Fix initializer list order in <regex> to be correct
llvm-svn: 242864
2015-07-22 01:29:41 +00:00
Eric Fiselier d1bac4ce57 [libcxx] Add support for sanitizers on OS X.
Summary: This patch adds special configuration logic to find the compiler_rt libraries required by sanitizers on OS X. The supported sanitizers are Address and Undefined.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 242858
2015-07-22 00:33:36 +00:00
Marshall Clow 20ceef6f65 Update the status of the TS'es
llvm-svn: 242788
2015-07-21 14:29:31 +00:00
Marshall Clow 1aa4567712 Mark new tests as unsupported before C++11
llvm-svn: 242695
2015-07-20 19:27:47 +00:00
Marshall Clow 205c333c99 Implement the default searcher for std::experimental::search.
llvm-svn: 242682
2015-07-20 16:39:28 +00:00
Marshall Clow 81416e492e Implement the plugin-based version of std::search. There are no searchers yet; those are coming soon.
llvm-svn: 242679
2015-07-20 15:40:27 +00:00
Eric Fiselier ca345e0032 Fix warnings in unordered_map
llvm-svn: 242634
2015-07-19 03:16:47 +00:00
Eric Fiselier 3e572598d3 Fix warnings in forwardlist
llvm-svn: 242633
2015-07-19 00:38:37 +00:00
Eric Fiselier c45b673d5d Fix warnings in deque tests
llvm-svn: 242632
2015-07-19 00:31:54 +00:00
Eric Fiselier 80fe6bd142 Commit file missing from r242629
llvm-svn: 242630
2015-07-19 00:11:50 +00:00
Eric Fiselier 2decfad7c5 Fix warnings in array and assoc containers
llvm-svn: 242629
2015-07-18 23:56:04 +00:00
Eric Fiselier 818139da59 Remove unused typedefs in random and regex
llvm-svn: 242628
2015-07-18 22:57:14 +00:00
Eric Fiselier 203f687971 Cleanup warnings in test/std/depr
llvm-svn: 242627
2015-07-18 22:51:51 +00:00
Eric Fiselier 19fa337610 Fix warnings in test/std/algorithms
llvm-svn: 242626
2015-07-18 21:53:16 +00:00
Eric Fiselier b67e689f02 Fix unused variable warnings in atomic tests
llvm-svn: 242625
2015-07-18 21:40:37 +00:00
Eric Fiselier 5fd308971d Fix warnings in test/std/language.support
llvm-svn: 242624
2015-07-18 21:17:16 +00:00
Eric Fiselier 87a82490fc Enable and fix warnings during the build.
Although CMake adds warning flags, they are ignored in the libc++ headers
because the headers '#pragma system header' themselves.

This patch disables the system header pragma when building libc++ and fixes
the warnings that arose.

The warnings fixed were:
1. <memory> - anonymous structs are a GNU extension
2. <functional> - anonymous structs are a GNU extension.
3. <__hash_table> - Embedded preprocessor directives have undefined behavior.
4. <string> - Definition is missing noexcept from declaration.
5. <__std_stream> - Unused variable.

llvm-svn: 242623
2015-07-18 20:40:46 +00:00
Marshall Clow dd2b7a0a0e Fix up typos in a couple of tests; due to agressive short-circuiting, they never failed on clang or gcc, but MSVC whined. Patch by Andrew Parker.
llvm-svn: 242618
2015-07-18 18:24:15 +00:00
Eric Fiselier 980eda3fc2 Add missing instrumentation in vector::insert - Patch from Anna Zaks
This patch was reviewed as D10859. http://reviews.llvm.org/D10859

llvm-svn: 242617
2015-07-18 18:22:12 +00:00
Eric Fiselier 083abfb3f6 [libcxx] Get is_*_destructible tests passing in C++03.
Summary: This patch adds proper guards to the is_destructible tests depending on the standard version so that they pass in c++03.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 242612
2015-07-18 16:43:58 +00:00
Eric Fiselier 88558e22b0 Cleanup tests that fail in C++1z and with Clang 3.8
llvm-svn: 242581
2015-07-17 22:27:43 +00:00
Marshall Clow 34389c8d78 Bump libc++ version # to 3.8
llvm-svn: 242541
2015-07-17 16:36:44 +00:00
Marshall Clow 9c9b0ec554 Include what we use, instead of letting them get pulled in implictly. This makes the tests work on VS. Thanks to STL for the report
llvm-svn: 242454
2015-07-16 22:13:26 +00:00
Marshall Clow f6a14fb4e2 Set the libc++ version # to 3.7. Will bump to 3.8 soon
llvm-svn: 242421
2015-07-16 17:22:24 +00:00
Marshall Clow 05fc0f25d6 Make sure that __libcpp_compressed_pair_imp default-constructs its' members, rather than value-initializing them. Fixes PR#24137
llvm-svn: 242377
2015-07-16 03:05:06 +00:00
Marshall Clow 5cbce174d9 Mark two tests as failing on clang 3.8 (they failed on 3.7, too)
llvm-svn: 242375
2015-07-16 02:44:33 +00:00
Eric Fiselier 16270a0b09 Remove non-ascii characters
llvm-svn: 242197
2015-07-14 20:45:48 +00:00
Eric Fiselier 5be45129a4 Implement n4169 - Add invoke function template
llvm-svn: 242195
2015-07-14 20:16:15 +00:00
Marshall Clow f69606b117 Mark LWG2308 as complete; fix link. No code change necessary.
llvm-svn: 242189
2015-07-14 20:07:45 +00:00
Eric Fiselier 092c475e25 Fix PR24114 - std::atomic for non-Clang is not a literal type
Add _LIBCPP_CONSTEXPR to the implementation of __gcc_atomic_t.

llvm-svn: 242172
2015-07-14 17:50:27 +00:00
Marshall Clow 71ff7c3f0f Move bits from N4258. Mark vector's move-constructor unconditionally noexcept in C++1z
llvm-svn: 242148
2015-07-14 14:46:32 +00:00
Marshall Clow e3fbe1433b Implement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates.
llvm-svn: 242056
2015-07-13 20:04:56 +00:00
Eric Fiselier 2d15f15f28 [libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo
Implemented LWG2420 bits for bind<void>

Review: http://reviews.llvm.org/D10997
llvm-svn: 241967
2015-07-10 23:29:18 +00:00
Eric Fiselier e825d8b736 Use __is_identifier to detect __decltype and not the clang version.
llvm-svn: 241939
2015-07-10 20:26:38 +00:00
Eric Fiselier be4e0eb1c2 Fix error string in test suite
llvm-svn: 241757
2015-07-08 23:10:20 +00:00
Marshall Clow bc4c89a977 The rest of N4279 and LWG#2464 - for unordered_map
llvm-svn: 241555
2015-07-07 05:45:35 +00:00
Marshall Clow 8aaf517db7 Implement N4279 and LWG#2664 for <map>. Reviewed as http://reviews.llvm.org/D10669
llvm-svn: 241539
2015-07-07 03:37:33 +00:00
Eric Fiselier 1faf289e27 [libcxx] Add atomic_support.h header to src that handles needed atomic operations.
Summary:
In some places in libc++ we need to use the `__atomic_*` builtins. This patch adds a header that provides access to those builtins in a uniform way from within the dylib source.

If the compiler building the dylib does not support these builtins then a warning is issued.

Only relaxed loads are needed within the headers. A singe function to do these relaxed loads has been added to `<memory>`.

This patch applies the new atomic builtins to `__shared_count` and `call_once`.

Reviewers: mclow.lists

Subscribers: majnemer, jroelofs, cfe-commits

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

llvm-svn: 241532
2015-07-07 00:27:16 +00:00
Eric Fiselier 4cd59b3f49 Automatically detect and use clang verify in failure tests.
Automatically enable clang verify whenever the '-verify-ignore-unexpected' flag
is supported.
Failure tests are run using verify if they contain one or more "expected-*"
diagnostics tags. Otherwise they are run normally.

llvm-svn: 241492
2015-07-06 19:56:45 +00:00
Marshall Clow 3505fba35a Mark LWG#2420 as complete. Eric did this in r228705.
llvm-svn: 241491
2015-07-06 19:36:44 +00:00
Ed Schouten 2a80cab90e Make locale code compile on CloudABI.
After r241454 landed, libc++'s locale code compiles on CloudABI, with
the exception of the following two bits:

- CloudABI doesn't have setlocale(), as the C library does not keep
  track of any global state. The global locale is always set to "C".
  Disable the call to setlocale() on this system.
- Similarly, mbtowc_l() is also not present, as it is also not
  thread-safe. As CloudABI does not support state-dependent encodings,
  simply disable that part of the logic.

The locale code now compiles out of the box on CloudABI.

Differential Revision:	http://reviews.llvm.org/D10729
Reviewed by:	jroelofs

llvm-svn: 241455
2015-07-06 15:39:36 +00:00
Ed Schouten 2a7ab629e5 Cleanup: prefer _LIBCPP_GET_C_LOCALE over __cloc().
The __cloc() function is only present in case the environment does not
provide a way to refer to the C locale using a compile-time constant
expression. _LIBCPP_GET_C_LOCALE seems to be defined unconditionally.

This improves compilation of the locale code on CloudABI.

Differential Revision:	http://reviews.llvm.org/D10690
Reviewed by:	jroelofs

llvm-svn: 241454
2015-07-06 15:37:40 +00:00
Marshall Clow f43a42d53e Noticed that std::allocator<const T> was missing the definition for is_always_equal. Fixed this, and added a test for it.
llvm-svn: 241190
2015-07-01 21:23:40 +00:00
Marshall Clow b138ae7cac Mark N4508, LWG#2407, and LWG#2470 as complete. I don't see that 2470 requires any changes to the library.
llvm-svn: 241111
2015-06-30 20:06:00 +00:00
Marshall Clow e3ab564e4d K-ballo pointed out that I missed one of the specializations of packaged_task when I committed r241068. Thanks for the catch.
llvm-svn: 241095
2015-06-30 18:28:35 +00:00
Marshall Clow 5b03e1ada8 Forgot the support include file in r241091
llvm-svn: 241092
2015-06-30 18:16:12 +00:00
Marshall Clow f8457a0735 Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map>
llvm-svn: 241091
2015-06-30 18:15:41 +00:00
Marshall Clow 660dcd9168 Implement LWG#2407: 'packaged_task(allocator_arg_t, const Allocator&, F&&) should neither be constrained nor explicit'
llvm-svn: 241068
2015-06-30 14:16:49 +00:00
Marshall Clow f69ae47128 Implement N4508: shared_mutex. Reviewed as http://reviews.llvm.org/D10480
llvm-svn: 241067
2015-06-30 14:04:14 +00:00
Marshall Clow c9c86ca0a2 Mark LWG#2266 as complete. This is a tightening up the wording; no code changes required.
llvm-svn: 241064
2015-06-30 13:32:08 +00:00
Marshall Clow a70d27f080 Mark LWG#2439 as complete. This is a tightening up the wording; no code changes required.
llvm-svn: 241013
2015-06-29 22:27:30 +00:00
Ed Schouten e0cf3b9a3c Make support for thread-unsafe C functions optional.
One of the aspects of CloudABI is that it aims to help you write code
that is thread-safe out of the box. This is very important if you want
to write libraries that are easy to reuse. For CloudABI we decided to
not provide the thread-unsafe functions. So far this is working out
pretty well, as thread-unsafety issues are detected really early on.

The following patch adds a knob to libc++,
_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS, that can be set to disable
thread-unsafe functions that can easily be avoided in practice. The
following functions are not thread-safe:

- <clocale>: locale handles should be preferred over setlocale().
- <cstdlib>: mbrlen(), mbrtowc() and wcrtomb() should be preferred over
  their non-restartable counterparts.
- <ctime>: asctime(), ctime(), gmtime() and localtime() are not
  thread-safe. The first two are also deprecated by POSIX.

Differential Revision:	http://reviews.llvm.org/D8703
Reviewed by:	marshall

llvm-svn: 240527
2015-06-24 08:44:38 +00:00
Marshall Clow 052085e6e0 Mark a couple of features as 'in progress'
llvm-svn: 240456
2015-06-23 20:48:55 +00:00
Marshall Clow 4daa9f1e10 When building libc++, we use '"' as a delimiter instead of '<' when including libc++ header files. This is so that the dylib gets built with our headers; rather than the system-installed ones. We do this in most places already, just fixing a couple of inconsistent uses.
llvm-svn: 240412
2015-06-23 14:45:02 +00:00
Marshall Clow 99f5fc937f Make seeking on an ostream that has eofbit set work correctly. Fixes PR#21361
llvm-svn: 240286
2015-06-22 15:01:21 +00:00
Marshall Clow 5b0f04a589 Fix illegal chars that snuck into <memory>
llvm-svn: 240163
2015-06-19 19:32:06 +00:00
Marshall Clow 79336aa3a4 Fix ASAN bot; missing bookkeeping in r240136.
llvm-svn: 240139
2015-06-19 17:13:59 +00:00
Marshall Clow 55112defb0 Fix PR#18843. Thanks to Howard for the fix
llvm-svn: 240136
2015-06-19 15:54:13 +00:00
Jonathan Roelofs 6dec6d896f Delete dead code. NFCI
llvm-svn: 239974
2015-06-17 23:31:45 +00:00
Eric Fiselier b11df184ad Fix std::function allocator constructors in C++03.
The C++03 version of function tried to default construct the allocator
in the uses allocator constructors when no allocation was performed. These
constructors would fail to compile when used with allocators that had no
default constructor.

llvm-svn: 239708
2015-06-14 23:30:09 +00:00
Eric Fiselier d9ad0cbd70 Cleanup result_of tests and fix issues with the C++03 result_of.
The two main fixes this patch contains are:
- use __identity_t instead of common_type. common_type was used as an
  identity metafunction but the decay resulted in incorrect results.
- Pointers to free functions were not counted as functions. Remove the pointer
  before checking if a type is a function.

llvm-svn: 239668
2015-06-13 08:25:24 +00:00
Eric Fiselier ed81d1c1f2 Remove warnings about old CMake options
llvm-svn: 239667
2015-06-13 07:31:55 +00:00
Eric Fiselier de3f2b396c Fix PR12999 - unordered_set::insert calls operator new when no insert occurs
Summary:
when `unordered_set::insert(value_type&&)` was called it would be treated like `unordered_set::emplace(Args&&)` and it would allocate and construct a node before trying to insert it.
This caused unnecessary allocations when the value was already in the set. This patch adds an overload to `__hash_table::__insert_unique` that specifically handles `value_type&&` more link `value_type const &`. 

This patch also adds a single unified insert function for values into  `__hash_table` called `__insert_unique_value` that handles the cases for `__insert_unique(value_type&&)` and `__insert_unique(value_type const &)`. 

This patch fixes PR12999: http://llvm.org/bugs/show_bug.cgi?id=12999.




Reviewers: mclow.lists, titus, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 239666
2015-06-13 07:18:32 +00:00
Eric Fiselier ee187e247b [libcxx] Fix detection of __is_final.
Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239664
2015-06-13 07:08:02 +00:00
Eric Fiselier f817754627 [libcxx] Use __decltype instead of __typeof__
Summary:
Both clang and GCC provide C++11 decltype semantics as __decltype in c++03 mode. We should use this instead of __typeof__ when availble. 

GCC added __decltype in 4.6.0, and AFAIK clang provided __decltype ever since 3.3. Unfortunately `__has_builtin(__decltype)` doesn't work for clang so we need to check the compiler version instead.


Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239662
2015-06-13 06:27:17 +00:00
Eric Fiselier fd1f5e66c1 Make __void_t unary and always provide it.
llvm-svn: 239655
2015-06-13 02:36:07 +00:00
Eric Fiselier 793f59e767 LWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.
This patch fixes LWG issue 2422 by removing the DECAY_COPY from call once.
The review can be found here: http://reviews.llvm.org/D10191

llvm-svn: 239654
2015-06-13 02:23:00 +00:00
Eric Fiselier 678ad2f9da Enable __is_trivially* intrinsics for GCC 5.1
Until GCC 5.1 the __is_trivially* intrinsics were not provided. Enable use of
the builtins for GCC 5.1.

Also enable Reference qualified member functions for GCC 4.9 and greater.

This patch also defines _GNUC_VER to 0 when __GNUC__ is not defined because
libc++ assumes _GNUC_VER is always defined.

llvm-svn: 239653
2015-06-13 02:18:44 +00:00
Eric Fiselier 8aba6a6db4 Refactor is_member_function_pointer to use is_function and not __member_function_traits.
Replacing the dependancy on __member_function_traits with is_function allows
is_member_function_pointer to work more often. In particular it allows it to
work when we don't have variadic templates but the function has an arity > 3.

llvm-svn: 239649
2015-06-13 00:33:13 +00:00
Eric Fiselier 776cc6e48f Prevent dependancy on libatomic when using GCC to provide <atomic>.
The __atomic_is_lock_free(...) function sometimes requires linkage to libatomic
if it cannot be evaluated at compile time. Remove __c11_atomic_is_lock_free
and use __atomic_is_lock_free(sizeof(Tp)) directly so that it can be evaluated
at compile time.

llvm-svn: 239648
2015-06-13 00:23:07 +00:00
Eric Fiselier b3ec43d78a Fix PR23293 - Do not unlock shared state before notifying consumers.
Within the shared state methods do not unlock the lock guards manually. This
could cause a race condition where the shared state is destroyed before the
method is complete.

llvm-svn: 239577
2015-06-12 00:41:34 +00:00
Marshall Clow 767c45719f Change #ifdefs in test to UNSUPPORTED. No functionality change in the tests
llvm-svn: 239562
2015-06-11 21:47:39 +00:00
Marshall Clow b41e76bb0b Fix PR#23767. Add tests for iterator invalidation for deque::erase/pop_front/pop_back
llvm-svn: 239196
2015-06-05 22:34:19 +00:00
Joerg Sonnenberger 28444b3074 Avoid C-style cast.
llvm-svn: 239160
2015-06-05 15:54:26 +00:00
Marshall Clow 979550f221 While applying N4258, I forgot about LWG#2455, which modified the modifications. Correct those - h/t: Howard
llvm-svn: 239004
2015-06-04 02:05:41 +00:00
Marshall Clow a8ae392718 More N4258 changes. This time vector's constructors
llvm-svn: 238990
2015-06-04 00:10:20 +00:00
Marshall Clow cbf166a2b9 More of N4258 implementation. Mark all of our test_allocators as noexcept constructible. Make the constructors for basic_string noexcept all the time (under C++14). Update tests to reflect the new world order. More to come.
llvm-svn: 238957
2015-06-03 19:56:43 +00:00
Marshall Clow 2abfcd5606 Add 'is_always_equal' tests for scoped_allocator. Found that I had typed '||' where I meant '&&' in the code; fixed that, too
llvm-svn: 238931
2015-06-03 16:15:55 +00:00
Marshall Clow 3ca2099fdf Revert changes inadvertantly committed
llvm-svn: 238880
2015-06-02 22:26:29 +00:00
Marshall Clow ef96861df9 Move uncaught_exeption() definition inside the #ifdef block like uncaught_exceptions()
llvm-svn: 238879
2015-06-02 22:25:23 +00:00
Marshall Clow 8880c20892 Fix breakage that I introduced in r238848
llvm-svn: 238870
2015-06-02 21:40:58 +00:00
Marshall Clow 31a4731370 Implement the first part of N4258 - allocator_traits<X>::is_always_equal. Also fixes PR#23723
llvm-svn: 238848
2015-06-02 16:34:03 +00:00
Marshall Clow 89102f0fa9 Implement uncaught_exceptions() using the newly added hooks in libc++abi, when available
llvm-svn: 238846
2015-06-02 15:33:38 +00:00
Marshall Clow 5b31205211 Fix some places where we could call memmove(null,xxx,0) - which is UB
llvm-svn: 238831
2015-06-02 13:52:16 +00:00
Marshall Clow e623074210 In the case where we are copying/moving zero elements, do less work
llvm-svn: 238828
2015-06-02 13:04:18 +00:00
Eric Fiselier 03d5dd2825 Add missing return statements in C++03 std::function
llvm-svn: 238803
2015-06-02 01:31:33 +00:00
Eric Fiselier a84544ac7a Add TODO items and remove use of 'noexcept' in C++03 test.
llvm-svn: 238802
2015-06-02 01:25:34 +00:00
Marshall Clow b74d15e507 Remove debugging code
llvm-svn: 238674
2015-05-31 14:01:54 +00:00
Marshall Clow 87601bef58 Don't try to memcpy zero bytes; sometimes the source pointer is NULL, and that's UB. Thanks to Nuno Lopes for the catch.
llvm-svn: 238666
2015-05-31 03:13:31 +00:00
Eric Fiselier 5ae9b64a09 Add TODO note about switching to __decltype
llvm-svn: 238631
2015-05-29 23:21:03 +00:00
Marshall Clow a7fb9a041d Fix PR#23647 - make_shared<volatile bool> - second try
llvm-svn: 238370
2015-05-27 22:44:47 +00:00
Marshall Clow 188b98b505 Revert 238354 while I figure out what broke in weak_ptr
llvm-svn: 238355
2015-05-27 20:36:14 +00:00
Marshall Clow 263a0f7681 Fix PR#23647 - make_shared<volatile bool>
llvm-svn: 238354
2015-05-27 20:15:33 +00:00
Marshall Clow 4669541d15 Add N4259 to the list of papers from Lenexa. Update links to point at public repos.
llvm-svn: 238340
2015-05-27 17:19:40 +00:00
Eric Fiselier 0961f6cc21 Get thread sleep_for test passing in C++03
llvm-svn: 238273
2015-05-27 01:09:51 +00:00
Eric Fiselier ad60a9a516 Mark __convert_to_integral test as XFAIL in c++03
llvm-svn: 238271
2015-05-27 01:02:51 +00:00
Eric Fiselier 3a8fa93ae0 Cleanup move/forward tests and remove references to __rv.
llvm-svn: 238270
2015-05-27 00:51:08 +00:00
Eric Fiselier 6871bcb122 Add test macros header to remove dependance on __config macros.
llvm-svn: 238267
2015-05-27 00:28:30 +00:00
Marshall Clow cd6f7f9d80 Fix broken test I just added
llvm-svn: 238234
2015-05-26 19:17:09 +00:00
Marshall Clow c5c29006dc Add tests to ensure that string/vector/array have contiguous iterators - which they did. Mark N4284 as complete
llvm-svn: 238233
2015-05-26 18:57:27 +00:00
Marshall Clow 3ac2b08cbd Mark N4366 as complete. libc++ has done this since 2012
llvm-svn: 238207
2015-05-26 14:58:05 +00:00
Eric Fiselier 80964e7f65 Add TODO items
llvm-svn: 237988
2015-05-22 02:23:22 +00:00
Marshall Clow 5cd6a89d35 Start a to-do list for libc++
llvm-svn: 237813
2015-05-20 17:39:54 +00:00
Eric Fiselier 1f294fd934 Fix building and testing libc++ with GCC.
The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a
bug when building libc++ with GCC. Because GCC does not support __has_include
we need to explicitly tell it that we are building against libc++abi via the
preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`.

The changes in include/ratio are to work around CWG defect
1712 (constexpr variable template declarations). GCC 4.8 and before has not
adopted the resolution to this defect.

The changes in include/exception work around an issue where is_final is used
without it being defined in type_traits.

llvm-svn: 237767
2015-05-20 03:15:01 +00:00
Eric Fiselier 513ae1854d Fix race condition in thread test.
llvm-svn: 237745
2015-05-19 23:41:04 +00:00
Eric Fiselier 4bcd428117 Address @danalberts comments on r237700
llvm-svn: 237740
2015-05-19 23:10:32 +00:00
Eric Fiselier 3de417f408 Fix uninitialized values and bad enum conversions found by UBSAN.
llvm-svn: 237738
2015-05-19 23:03:57 +00:00
Eric Fiselier 35cb2b28ca Rename internal trait that used non-reserved name.
llvm-svn: 237737
2015-05-19 22:27:18 +00:00
Eric Fiselier deb3033cd2 Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.
llvm-svn: 237700
2015-05-19 15:15:53 +00:00
Marshall Clow a00932bddb Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded operator&
llvm-svn: 237699
2015-05-19 15:01:48 +00:00
Eric Fiselier ab8b1ced0a mark new/delete tests as XFAIL more carefully
llvm-svn: 237664
2015-05-19 03:41:22 +00:00
Eric Fiselier c1a44c4a53 [libcxx] Rework sized delete.
Summary:
This patch does 2 main things:
1. Enable sized delete if the feature test macro `__cpp_sized_deallocation` is enabled.
2. Rework and cleanup all of the sized delete tests.

Test Plan:
The sized delete replacement tests are now split into 4 files:
1. sized_delete11.pass.cpp: Ensure overriding sized delete in C++11 has no effect.
2. sized_delete14.pass.cpp: Test overriding sized delete in C++14 and ensure it is called. This test fails on clang and GCC < 5.1. 
3. size_delete_calls_unsized_delete_.pass.cpp: Test that the default sized delete calls unsized delete.
4. sized_delete_fsizeddeallocation.pass.cpp: Test overriding sized delete when -fsized-deallocation is passed. This test should pass on clang and GCC >= 5.1

I have also removed a lot of cruft from the old tests. They no longer replace the new handler and tests that it is called for bad allocations.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 237662
2015-05-19 02:03:22 +00:00
Marshall Clow 5ca52716cb Mark N4510 as complete; we already do this
llvm-svn: 237638
2015-05-18 23:25:09 +00:00
Marshall Clow cd6615fd71 Add support for N4389 - std::bool_constant
llvm-svn: 237636
2015-05-18 23:21:06 +00:00
Marshall Clow c9f1124120 Update C++1z status; mark issues 2059,2369,2415,2454 and 2458 as 'complete'. I have committed patches for all of them
llvm-svn: 237606
2015-05-18 19:52:49 +00:00
Marshall Clow 170ccd290d Update C++1z status; mark all the issues that require no library change as 'complete'
llvm-svn: 237604
2015-05-18 19:50:05 +00:00
Marshall Clow 98dbf02e19 Update C++1z status with issues and papers from Lenexa
llvm-svn: 237596
2015-05-18 19:01:11 +00:00
Marshall Clow 0e166e5a9a Fix for LWG Issue 2458: N3778 and new library deallocation signatures.
llvm-svn: 237592
2015-05-18 17:48:45 +00:00
Logan Chien 3b6e51a73f libcxx: Enhance lit test command in verbose mode.
Print both the compiler command and linker command so that it will be
easier for developers to reproduce the failed test cases.

llvm-svn: 237530
2015-05-17 00:24:11 +00:00
Marshall Clow fd30fb22c2 Fix test that was failing on C++03 b/c it was using initializer lists
llvm-svn: 237527
2015-05-16 17:10:49 +00:00
Logan Chien a8e1a28939 Fix build when libunwind is disabled.
The previous commit breaks the builds when libc++abi is not built with
libunwind becuase the default value for LIBCXXABI_USE_LLVM_UNWINDER is
OFF, which is not pythonized.

This CL fix the problem by calling pythonize_bool().

llvm-svn: 237519
2015-05-16 13:10:39 +00:00
Logan Chien 891fd46a0a libcxx: Fix ARM libc++/abi and libunwind buildbot.
The test cases were crashing due to the mixed usage of the unwinding
functions from both libunwind and libgcc_s.  The unwind functions are
mixed because the "llvm_unwinder" entry is not available in the
lit.site.cfg for libc++.  As a result, "-lgcc_s" is picked instead of
"-lunwind".  The extra option to lit --param=link_flags="-lunwind" won't
help either.

This CL fix the problem by adding llvm_unwinder to lit.site.cfg.in.

llvm-svn: 237518
2015-05-16 12:44:31 +00:00
Ed Schouten 4f0f708bf1 Use clock_gettime()'s CLOCK_REALTIME instead of gettimeofday().
The system_clock::now() function currently uses gettimeofday(). The
problem with gettimeofday() is that it is an obsolete XSI function,
hence unavailable on CloudABI. See:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/gettimeofday.html

Change this code to use clock_gettime() with CLOCK_REALTIME instead,
which is more consistent, as clock_gettime() is already used for
steady_clock.

A previous version of this change actually attempted to change
system_clock::duration, but I reverted this part as it breaks the
existing ABI.

Differential Revision:	http://reviews.llvm.org/D8253
Approved by:	jroelofs

llvm-svn: 237390
2015-05-14 20:54:18 +00:00
Evgeniy Stepanov 732e2681c7 Implement std::experimental::sample.
Following specification in "C++ Extensions for Library Fundamentals":
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4480.html#alg.random.sample

llvm-svn: 237264
2015-05-13 16:55:41 +00:00
Eric Fiselier 9243c762bb Document a known build issue on OS X 10.8 and later.
llvm-svn: 237205
2015-05-12 22:55:30 +00:00
Marshall Clow c34f847b80 Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptr
llvm-svn: 236953
2015-05-10 13:59:45 +00:00
Marshall Clow 0b0671ae36 Fix for LWG Issue 2369: constexpr max(initializer_list) vs max_element
llvm-svn: 236952
2015-05-10 13:53:31 +00:00
Marshall Clow ec39296875 Fix for LWG Issue 2059: C++0x ambiguity problem with map::erase
llvm-svn: 236950
2015-05-10 13:35:00 +00:00
Marshall Clow cd26846fc5 Remove some debugging printout lines. No functionality change.
llvm-svn: 236949
2015-05-10 13:26:57 +00:00
Marshall Clow 783b372a58 Fix for LWG2454: Add raw_storage_iterator::base() member
llvm-svn: 236948
2015-05-10 13:14:08 +00:00
Jonathan Roelofs 1992834a29 Fix typo in www. NFC
llvm-svn: 236902
2015-05-08 21:11:49 +00:00
Marshall Clow 2764799450 Replace two naked references of 'std::' with the macro '_VSTD::'. No functionality change.
llvm-svn: 236593
2015-05-06 12:11:22 +00:00
Marshall Clow de55932c0d Found a Urbana paper that has library bits
llvm-svn: 236356
2015-05-01 22:14:35 +00:00
Richard Trieu 1c545baf96 Fix -Wpessimizing-move warning by remove the call to std::move.
llvm-svn: 236265
2015-04-30 21:47:28 +00:00
Marshall Clow 8f34134ce9 Mark LWG#2387 as complete. No code changes needed
llvm-svn: 236236
2015-04-30 15:19:44 +00:00
Marshall Clow 903a5dd112 Removed 'complete' from 2408; updated status
llvm-svn: 236025
2015-04-28 19:35:36 +00:00
Marshall Clow 5e1441bce4 Fix some preprocessor directives that were generating warnings in the test suite.
llvm-svn: 235999
2015-04-28 16:52:30 +00:00
Marshall Clow 0846f54b0e Update C++17 status; mark issues 2170, 2377, and 2408 as complete. We already do these; no code changes necessary.
llvm-svn: 235992
2015-04-28 14:26:29 +00:00
Marshall Clow ccf5b32d21 Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio
llvm-svn: 235607
2015-04-23 16:45:08 +00:00
Eric Fiselier 445d718807 Remove constexpr support for std::apply because it introduces regressions.
llvm-svn: 235274
2015-04-19 15:32:52 +00:00
Marshall Clow 60d5e0e027 A few bits of N2994 didn't get fully implemented a long time ago. Thanks to STL@microsoft.com for the bug report
llvm-svn: 235134
2015-04-16 21:36:54 +00:00
Marshall Clow daa4d45c0a Qualify an internal call in is_assignable to prevent ADL lookup, which would 'complete' an type definition unnecessarily. Thanks to Richard Smith for the report.
llvm-svn: 234886
2015-04-14 13:53:53 +00:00
Marshall Clow 1f508014df In many places, there was an #ifdef/#else block that selected one of two implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented.
llvm-svn: 234296
2015-04-07 05:21:38 +00:00
Eric Fiselier 9a37bc91d2 Fix race conditions in test class used throughout the std::thread tests.
The test class 'G' reads and writes to the same static variables in its
constructor, destructor and call operator. When threads are
constructed using `std::thread t((G()))` there is a race condition between the
destruction of the temporary and the execution of `G::operator()()`.

The fix is to simply create the input before creating the thread.

llvm-svn: 233946
2015-04-02 21:12:17 +00:00
Eric Fiselier 4453d2185c [libcxx] Fix bug in shared_timed_mutex that could cause a program to hang.
Summary:
The summary of the bug, provided by Stephan T. Lavavej:

In shared_timed_mutex::try_lock_until() (line 195 in 3.6.0), you need to deliver a notification.  The scenario is:
 
* There are N threads holding the shared lock.
* One thread calls try_lock_until() to attempt to acquire the exclusive lock.  It sets the "I want to write" bool/bit, then waits for the N readers to drain away.
* K more threads attempt to acquire the shared lock, but they notice that someone said "I want to write", so they block on a condition_variable.
* At least one of the N readers is stubborn and doesn't release the shared lock.
* The wannabe-writer times out, gives up, and unsets the "I want to write" bool/bit.
 
At this point, a notification (it needs to be notify_all) must be delivered to the condition_variable that the K wannabe-readers are waiting on.  Otherwise, they can block forever without waking up.



Reviewers: mclow.lists, jyasskin

Reviewed By: jyasskin

Subscribers: jyasskin, cfe-commits

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

llvm-svn: 233944
2015-04-02 21:02:06 +00:00
Eric Fiselier ba7c3ff32f Remove statement with no effect inside tests.
llvm-svn: 233816
2015-04-01 15:49:02 +00:00