Commit Graph

1079 Commits

Author SHA1 Message Date
Marshall Clow
ebc31694e8 Remove debugging code
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238674 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 14:01:54 +00:00
Marshall Clow
bf0460e0a0 Don't try to memcpy zero bytes; sometimes the source pointer is NULL, and that's UB. Thanks to Nuno Lopes for the catch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238666 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-31 03:13:31 +00:00
Marshall Clow
60784f62de Fix PR#23647 - make_shared<volatile bool> - second try
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238370 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 22:44:47 +00:00
Marshall Clow
fc3a3ffc69 Revert 238354 while I figure out what broke in weak_ptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 20:36:14 +00:00
Marshall Clow
83f8153b22 Fix PR#23647 - make_shared<volatile bool>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238354 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 20:15:33 +00:00
Eric Fiselier
bae11add65 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 03:15:01 +00:00
Eric Fiselier
5486fac53c Rename internal trait that used non-reserved name.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237737 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 22:27:18 +00:00
Marshall Clow
5dce73dd6e Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded operator&
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237699 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 15:01:48 +00:00
Eric Fiselier
f4c97290fc [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-19 02:03:22 +00:00
Marshall Clow
e62560a9b6 Add support for N4389 - std::bool_constant
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237636 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 23:21:06 +00:00
Marshall Clow
c42668278d Fix for LWG Issue 2458: N3778 and new library deallocation signatures.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237592 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-18 17:48:45 +00:00
Evgeniy Stepanov
56a8c6438a 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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 16:55:41 +00:00
Marshall Clow
0ad232a882 Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:59:45 +00:00
Marshall Clow
928735abf1 Fix for LWG Issue 2369: constexpr max(initializer_list) vs max_element
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:53:31 +00:00
Marshall Clow
488025c316 Fix for LWG Issue 2059: C++0x ambiguity problem with map::erase
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:35:00 +00:00
Marshall Clow
dbaf7a0d31 Fix for LWG2454: Add raw_storage_iterator::base() member
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-10 13:14:08 +00:00
Marshall Clow
cd13782c22 Replace two naked references of 'std::' with the macro '_VSTD::'. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 12:11:22 +00:00
Marshall Clow
71ed9f00d2 Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235607 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-23 16:45:08 +00:00
Eric Fiselier
c254b36c29 Remove constexpr support for std::apply because it introduces regressions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-19 15:32:52 +00:00
Marshall Clow
e9d030687d A few bits of N2994 didn't get fully implemented a long time ago. Thanks to STL@microsoft.com for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@235134 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 21:36:54 +00:00
Marshall Clow
3a4964aef3 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@234886 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14 13:53:53 +00:00
Marshall Clow
66302c650b 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@234296 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 05:21:38 +00:00
Eric Fiselier
1d55ecf513 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 21:02:06 +00:00
Eric Fiselier
088ed9fe94 [libcxx] Optimize vectors uninitialized construction of trivial types from an iterator range.
Summary:
In certain cases vector can use memcpy to construct a range of elements at the back of the vector. We currently don't do this resulting in terrible code gen in non-optimized mode and a
very large slowdown compared to libstdc++. 

This patch adds a `__construct_forward_range(Allocator, Iter, Iter, _Ptr&)` and `__construct_forward_range(Allocator, Tp*, Tp*, Tp*&)` functions to `allocator_traits` which act similarly to the existing `__construct_forward(...)` functions.

This patch also changes vectors `__construct_at_end(Iter, Iter)` to be `__construct_at_end(Iter, Iter, SizeType)` where SizeType is the size of the range. `__construct_at_end(Iter, Iter, SizeType)` now calls `allocator_traits<Tp>::__construct_forward_range(...)`. 

This patch is based off the design of `__swap_out_circular_buffer(...)` which uses `allocator_traits<Tp>::__construct_forward(...)`.

On my machine this code performs 4x better than the current implementation when tested against `std::vector<int>`. 



Reviewers: howard.hinnant, titus, kcc, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 16:54:19 +00:00
Eric Fiselier
4bd15469a9 [libcxx] Fix PR22771 - Support access control SFINAE in the library version of is_convertible.
Summary:
Currently the conversion check does not take place in a context where access control SFINAE is applied. This patch changes the context of the test expression so that SFINAE occurs if access control does not permit the conversion.

Related bug: https://llvm.org/bugs/show_bug.cgi?id=22771

Reviewers: mclow.lists, rsmith, dim

Reviewed By: dim

Subscribers: dim, rodrigc, emaste, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233552 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-30 15:22:20 +00:00
Ed Schouten
abd06b4c9b Make the presence of stdin and stdout optional.
The idea behind Nuxi CloudABI is that it is targeted at (but not limited to)
running networked services in a sandboxed environment. The model behind stdin,
stdout and stderr is strongly focused on interactive tools in a command shell.
CloudABI does not support the notion of stdin and stdout, as 'standard
input/output' does not apply to services. The concept of stderr does makes
sense though, as services do need some mechanism to log error messages in a
uniform way.

This patch extends libc++ in such a way that std::cin and std::cout and the
associated <cstdio>/<cwchar> functions can be disabled through the flags
_LIBCPP_HAS_NO_STDIN and _LIBCPP_HAS_NO_STDOUT, respectively. At the same time
it attempts to clean up src/iostream.cpp a bit. Instead of using a single array
of mbstate_t objects and hardcoding the array indices, it creates separate
objects that declared next to the iostream objects and their buffers. The code
is also restructured by interleaving the construction and setup of c* and wc*
objects. That way it is more obvious that this is done identically.

The c* and wc* objects already have separate unit tests. Make use of this fact
by adding XFAILs in case libcpp-has-no-std* is set. That way the tests work in
both directions. If stdin or stdout is disabled, these tests will therefore
test for the absence of c* and wc*.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26 14:35:46 +00:00
Eric Fiselier
b58f517af7 Remove unneeded redeclaration of reference_wrapper.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232887 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-21 06:05:45 +00:00
Eric Fiselier
ffbfbcda66 Create macro to allow testing of is_convertible without the compiler builtin.
Summary: This patch also fixes one test case that failed in the library version of is_convertible.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 21:11:02 +00:00
Marshall Clow
64befb5bc5 Add code to honor the match_not_bol and match_not_eol regex flats. Fixes PR#22651. Thanks to Jim Porter for the report and suggested fix.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232733 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 17:05:59 +00:00
Sylvestre Ledru
2d24d89e9b Add support for kfreebsd. Thanks to Jan Henke
Reported on the Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780106



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232714 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 09:03:58 +00:00
Eric Fiselier
537876b98e Fix use after free and calls to operator comma in debug mode
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232703 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 03:20:02 +00:00
Eric Fiselier
71aa376ede [libc++] Fix PR22922 - Allocator support for std::function does not know how to rebind.
Summary:
This patch changes std::function to use allocator_traits to rebind the allocator instead of allocator itself.

It also changes most of the tests to use `bare_allocator` where possible instead of `test_allocator`.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232686 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-18 22:56:50 +00:00
Eric Fiselier
0b6f8ed1c7 Provide std::abs(<floating-point>) in <cmath> on Solaris.
1) <cstdlib> header should define std::abs([int|long|long long])
functions. They use "using ::abs" to import these functions (which are
declared in <stdlib.h>) into std namespace.
2) <cmath> header should define std::abs([float|double|long double])
function. If we try define new functions in std namespace, then it
will cause compile error in <cstdlib> because "using ::abs" will try
import not only [int|long|long long] functions, but also
[float|double|long double] which are defined in <math.h> header on
solaris.

Patch by C Bergstrom.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-18 15:24:18 +00:00
Eric Fiselier
13858ee056 [libcxx] Add <experimental/tuple> header for LFTS.
Summary:
This patch adds the `<experimental/tuple>` header (almost) as specified in the latest draft of the library fundamentals TS.

The main changes in this patch are:

1. Added variable template `tuple_size_v`
2. Added function `apply(Func &&, Tuple &&)`.
3. Changed `__invoke` to be `_LIBCPP_CONSTEXPR_AFTER_CXX11`.

The `apply(...)` implementation uses `__invoke` to invoke the given function. `__invoke` already provides the required functionality. Using `__invoke` also allows `apply` to be used on pointers to member function/objects as an extension. In order to facilitate this `__invoke` has to be marked `constexpr`. 



Test Plan:
Each new feature was tested. 

The test cases for `tuple_size_v` are as follows:
1. tuple_size_v.pass.cpp
  - Check `tuple_size_v` on cv qualified tuples, pairs and arrays.
2. tuple_size_v.fail.cpp
  - Test on reference type.
3. tuple_size_v_2.fail.cpp
  - Test on non-tuple
4. tuple_size_v_3.fail.cpp
  - Test on pointer type.

The test cases for tuple.apply are as follows:

1. arg_type.pass.cpp
   - Ensure that ref/pointer/cv qualified types are properly passed.
2. constexpr_types.pass.cpp
   - Ensure constexpr evaluation of apply is possible for `tuple` and `pair`.
3. extended_types.pass.cpp
   - Test apply on function types permitted by extension.
4. large_arity.pass.cpp
   - Test that apply can evaluated on tuples and arrays with large sizes.
5. ref_qualifiers.pass.cpp
   - Test that apply respects ref qualified functions.
6. return_type.pass.cpp
   - Test that apply returns the proper type.
7. types.pass.cpp
   - Test apply on function types as required by LFTS.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232515 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 18:28:14 +00:00
Marshall Clow
4d23cc6f55 Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 15:30:22 +00:00
Eric Fiselier
8e706d2c3e [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block.
Summary:
There is no reason to guard `tuple_size`, `tuple_element` and `get<I>(...)` for pair and array inside of `<__tuple>` so that they are only available when we have variadic templates.
This requires there be redundant declarations and definitions. It also makes it easy to get things wrong.

For example the following code should compile (and does in c++11).
```
#define _LIBCPP_HAS_NO_VARIADICS
#include <array>

int main()
{
  static_assert((std::tuple_size<std::array<int, 10> volatile>::value == 10), "");
}
```

This patch lifts the non-variadic parts of `tuple_size`, `tuple_types`, and `get<I>(...)` to the top of `<__tuple>` where they don't require variadic templates. This patch also removes `<__tuple_03>` because there is no longer a need for it.


Reviewers: danalbert, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 15:08:03 +00:00
Marshall Clow
aa8a52c934 Fix a problem when calling throw_with_nested with a class marked 'final'. Thanks to STL @ Microsoft for the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232384 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-16 15:10:28 +00:00
Ed Schouten
84b6c1f402 Make *abs() and *div() work on CloudABI.
According to POSIX, *abs() and *div() are allowed to be macros (in
addition to being functions). Make sure we undefine these, so that
std::*abs() and std::*div() work as expected.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232379 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-16 14:27:44 +00:00
Ed Schouten
95e5c0a0e7 Also enable the default rune table on CloudABI.
CloudABI does not expose a table on its own.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232050 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12 15:48:06 +00:00
Ed Schouten
b33ae5ba7d Add option to disable access to the global filesystem namespace.
Systems like FreeBSD's Capsicum and Nuxi CloudABI apply the concept of
capability-based security on the way processes can interact with the
filesystem API. It is no longer possible to interact with the VFS
through calls like open(), unlink(), rename(), etc. Instead, processes
are only allowed to interact with files and directories to which they
have been granted access. The *at() functions can be used for this
purpose.

This change adds a new config switch called
_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE. If set, all functionality
that requires the global filesystem namespace will be disabled. More
concretely:

- fstream's open() function will be removed.
- cstdio will no longer pull in fopen(), rename(), etc.
- The test suite's get_temp_file_name() will be removed. This will cause
  all tests that use the global filesystem namespace to break, but will
  at least make all the other tests run (as get_temp_file_name will not
  build anyway).

It is important to mention that this change will make fstream rather
useless on those systems for now. Still, I'd rather not have fstream
disabled entirely, as it is of course possible to come up with an
extension for fstream that would allow access to local filesystem
namespaces (e.g., by adding an openat() member function).

Differential revision:	http://reviews.llvm.org/D8194
Reviewed by:		jroelofs (thanks!)


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232049 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12 15:44:39 +00:00
Jonathan Roelofs
6fb33ea8fb Fix ctype_byname<wchar_t>::do_is() mask checking.... again
This basically reverts the revert in r216508, and fixes a few more cases while
I'm at it. Reading my commit message on that commit again, I think it's bupkis.

http://reviews.llvm.org/D8237


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-11 17:00:28 +00:00
Ed Schouten
0251f0fd11 Disable cat*() on CloudABI. Also make tiny cleanups.
On a new platform that I am working on
(https://github.com/NuxiNL/cloudlibc) I am not implementing the
cat{open,close,gets}() API, just like Android, Newlib, etc.

Instead of adding yet another operating system name to the #ifs,
introduce _LIBCPP_HAS_CATOPEN in include/__config. Also adjust the code
to only pull in nl_types.h when _LIBCPP_HAS_CATOPEN is set. We only
needed this header for the cat*() API.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-11 16:39:36 +00:00
Dan Albert
6272ae58fe Move Android to the builtin rune table.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231897 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-11 00:51:06 +00:00
Ed Schouten
681abae7dc Also use LC_C_LOCALE on CloudABI.
Before I discovered that NetBSD provides a permanent handle to the C
locale called LC_C_LOCALE, I also added support for this to CloudABI
under the name LC_POSIX_LOCALE. I've renamed it to LC_C_LOCALE to
improve compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231780 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:35:22 +00:00
Ed Schouten
4c42c4e688 Enable _LIBCPP_LOCALE__L_EXTENSIONS on CloudABI.
CloudABI provides the _l() functions that are part of POSIX.1-2008, but
also the extensions that are available on systems like OS X and *BSD
(scanf_l, printf_l, etc).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 09:26:38 +00:00
Ed Schouten
e5a356a891 Print log/error messages on stderr, not stdout
There are a couple of places where libc++ prints log/error messages to
stdout on its own. This may of course interfere with the output
generated with applications. Log/error messages should be directed to
stderr instead.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 07:57:43 +00:00
Ed Schouten
63e70b67eb Add support for arc4random() to random_device.
Nuxi CloudABI (https://github.com/NuxiNL/cloudlibc) does not allow
processes to access the global filesystem namespace. This breaks
random_device, as it attempts to use /dev/{u,}random. This change adds
support for arc4random(), which is present on CloudABI.

In my opinion it would also make sense to use arc4random() on other
operating systems, such as *BSD and Mac OS X, but I'd rather leave that
to the maintainers of the respective platforms. Switching to
arc4random() does change the ABI.

This change also attempts to make some cleanups to the code. It adds a
single #define for every random interface, instead of testing against
operating systems explicitly.

As discussed, also validate the token argument to be equal to
"/dev/urandom" on all systems that only provide pseudo-random numbers.
This should cause little to no breakage, as "/dev/urandom" is also the
default argument value.

Reviewed by: jfb
Differential Revision: http://reviews.llvm.org/D8134


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231764 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 07:46:06 +00:00
Eric Fiselier
9f4f2215b7 [libcxx] Fix __RAII_IncreaseAnnotator for increases >= 1
Summary: Fix suggested by @mclow.lists on D8109. Store the size of the un-poisoned vector upon construction instead of calculating it later.

Reviewers: titus, mclow.lists, kcc, EricWF

Reviewed By: EricWF

Subscribers: mclow.lists, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231729 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 00:25:20 +00:00
Dimitry Andric
131219802f Fix another -Wunused-local-typedef warning in include/__tree.
The _Pp typedef in __tree<_Tp, _Compare, _Allocator>::__count_multi()
isn't used anywhere, so adding _LIBCPP_UNUSED is unecessary.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231705 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-09 21:39:02 +00:00
Marshall Clow
d07fcd66b9 Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the bug because there's more work to do here
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231672 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-09 17:08:51 +00:00