Commit Graph

2006 Commits

Author SHA1 Message Date
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
Eric Fiselier e782178e9c [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

llvm-svn: 233711
2015-03-31 16:54:19 +00:00
Eric Fiselier 78fdf2d0f5 [libcxx] Add code coverage configuration to CMake and LIT.
Summary:
This patch adds configuration to CMake and LIT for running the libc++ test-suite to generate code coverage.

To use code coverage use following instructions.

* Find the clang resource dir using `$CXX -print-search-dirs`. Let <library-dir> be the first library search directory.
* `cmake <regular-options> -DLIBCXX_GENERATE_COVERAGE=ON -DLIBCXX_COVERAGE_LIBRARY=<library-dir>/lib/<platform>/libclang_rt.profile.a <source>`
* `make cxx`
* `make check-libcxx`
* `make generate-libcxx-coverage`


The reason I want this patch upstreamed is so I can setup a bot that generates code coverage and posts in online for every revision. 



Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

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

llvm-svn: 233669
2015-03-31 04:15:45 +00:00
Eric Fiselier 19036fe19b Allow enabling CCache through an env variable. This helps enable/disable the option on buildbots.
llvm-svn: 233659
2015-03-31 01:41:32 +00:00
Marshall Clow 4c30259879 Make the new tests better; make sure that we're testing the case where no reallocation has to happen
llvm-svn: 233641
2015-03-30 23:26:16 +00:00
Marshall Clow 21471e0906 While testing Erik's code coverage scripts, I found a hole in the test suite - vector::assign where a reallocation was not required had no tests. Add some
llvm-svn: 233557
2015-03-30 16:07:11 +00:00
Eric Fiselier da6c0fb630 [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

llvm-svn: 233552
2015-03-30 15:22:20 +00:00
Eric Fiselier e035c7c1c0 Only enable special apple link flags for libc++abi (or none)
llvm-svn: 233368
2015-03-27 09:00:45 +00:00
Eric Fiselier 2f135df8f9 Fix PR23041. Use lock_shared() as opposed to lock() in shared_lock test.
llvm-svn: 233367
2015-03-27 07:07:51 +00:00
Eric Fiselier e6bcc4252e cleanup comments in sym_check
llvm-svn: 233364
2015-03-27 06:04:37 +00:00
Eric Fiselier 79ebff7bcf Add readelf support to abi_check. Prefer readelf over nm
llvm-svn: 233360
2015-03-27 05:44:59 +00:00
Eric Fiselier 09b80854e8 Add tests for library version of is_convertible
llvm-svn: 233285
2015-03-26 16:45:21 +00:00
Ed Schouten f4ac884f2b 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

llvm-svn: 233275
2015-03-26 14:35:46 +00:00
Ed Schouten 4d5142937f Remove the state_types array.
If we want to add support for making std::cin and std::cout optional, it
is impractical to have all of the mbstate_t objects in one array. This
would mean that if std::cin and std::cout are omitted, the state_types
array is only used partially.

Solve this by using separate global variables. These are placed right
next to the iostream object and the buffer, meaning we can easily #ifdef
them away.

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

llvm-svn: 233274
2015-03-26 14:33:46 +00:00
Ed Schouten 407bd03e6d Don't let time_put test use implementation dependent constructs.
The time_put test doesn't seem to work on Linux and CloudABI. For Linux
we already have an XFAIL. Closer inspection seems to reveal that this
test does not pass for a couple of reasons.

First of all, the tm_yday field is set to an invalid value. The
strftime() function doesn't behave consistently across platforms in case
the values in the tm structure are incoherent. Fix up this field to have
the value 121, which corresponds with tm_mday, tm_mon and tm_year. This
of course affects the output of time_put for some modifiers, so update
the tests accordingly.

Second, some of the tests actually use modifiers that are only present
on BSD derived systems. They are not part of the C standard/POSIX.
Simply remove them.

Finally, some of the tests actually use invalid modifiers, causing a
malformed format string to be passed to strftime(). Remove these tests
as well.

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

llvm-svn: 233262
2015-03-26 08:38:00 +00:00
Marshall Clow c5a996f111 Fix incorrect error handling of call to mbrtowc. This is PR#13759. Leaving the bug open because (1) I'm not sure that we're correct here, only better than before, and (2) no tests
llvm-svn: 233012
2015-03-23 20:07:17 +00:00
Eric Fiselier ec6c06610f Remove unneeded redeclaration of reference_wrapper.
llvm-svn: 232887
2015-03-21 06:05:45 +00:00
Eric Fiselier 1f1980d9ca Improve automatic detection of filetype for sym_check
llvm-svn: 232858
2015-03-20 23:07:38 +00:00
Eric Fiselier 5829578bb0 Fix use of incorrect package name in sym_check
llvm-svn: 232856
2015-03-20 22:13:37 +00:00
Eric Fiselier 9bf753cf07 Add symbol checking script to libc++ to help manage exported symbols.
Summary:
Add symbol checking scripts for extracting a list of symbols from shared libraries and for comparing symbol lists for differences.



Reviewers: mclow.lists, danalbert, EricWF

Reviewed By: EricWF

Subscribers: majnemer, emaste, cfe-commits

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

llvm-svn: 232855
2015-03-20 22:09:29 +00:00
Eric Fiselier d4e0263e0a 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

llvm-svn: 232764
2015-03-19 21:11:02 +00:00
Eric Fiselier 237b6ed9e4 [libcxx] Unify LIBCXX_<ABI-Name>_INCLUDE_PATHS to be LIBCXX_CXX_ABI_INCLUDE_PATHS
Summary:
Clean up all the different possible CMake options for specifying the ABI include paths into one CMake option named `LIBCXX_CXX_ABI_INCLUDE_PATHS`. 
The documentation has been updated to reflect this change.

For the next week I have added explicit errors if any of the old flags is used. These errors inform users of the change and the new option to use.

Before committing the change I will announce this change on cfe-dev.

Reviewers: danalbert, mclow.lists

Reviewed By: danalbert, mclow.lists

Subscribers: jroelofs, cbergstrom, cfe-commits

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

llvm-svn: 232762
2015-03-19 20:59:45 +00:00
Marshall Clow 8fa8e5fc74 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.
llvm-svn: 232733
2015-03-19 17:05:59 +00:00
Sylvestre Ledru 2a5c0e8ec2 Add support for kfreebsd. Thanks to Jan Henke
Reported on the Debian BTS:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780106

llvm-svn: 232714
2015-03-19 09:03:58 +00:00
Eric Fiselier 61bff61926 Fix use after free and calls to operator comma in debug mode
llvm-svn: 232703
2015-03-19 03:20:02 +00:00
Eric Fiselier 6d370568c3 [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

llvm-svn: 232686
2015-03-18 22:56:50 +00:00
Eric Fiselier b2c276e448 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.

llvm-svn: 232641
2015-03-18 15:24:18 +00:00
Eric Fiselier 5e1c9ae34f Fix DYNLD_LIBRARY_PATH to include the ABI path if specified
llvm-svn: 232527
2015-03-17 19:37:26 +00:00
Jonathan Roelofs f0d7c16d68 Fix failed test command repro printing for *.pass.cpp tests
Before we were printing out the compile command twice, which isn't that useful.

Thanks EricWF for the report!

llvm-svn: 232526
2015-03-17 19:32:24 +00:00
Ed Schouten d2647eaae6 Clean up iostream creation in preparation for conditionalizing streams.
Interleave the code for narrow and wide character streams. This makes it
more obvious that the two pieces of code are identical. Furthermore, it
makes it easier to conditionally compile support for certain streams, as
less #ifdef blocks are needed.

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

llvm-svn: 232516
2015-03-17 18:40:58 +00:00
Eric Fiselier ea10d2477a [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

llvm-svn: 232515
2015-03-17 18:28:14 +00:00
Marshall Clow 2d832d2429 Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change.
llvm-svn: 232493
2015-03-17 15:30:22 +00:00
Eric Fiselier 57f00f2f9c [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

llvm-svn: 232492
2015-03-17 15:08:03 +00:00
Ed Schouten 152b637682 Don't attempt to validate the output of %p.
In one of the ostream tests we attempt to validate whether the output of
%p is correct. This is actually outside the scope of libc++, for the
%reason that the format of %p is implementation defined. Change the test
%to validate that the output of %p is non-empty and is different when
%given two unequal addresses.

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

llvm-svn: 232390
2015-03-16 17:56:04 +00:00
Marshall Clow b7361983d1 Fix a problem when calling throw_with_nested with a class marked 'final'. Thanks to STL @ Microsoft for the bug report.
llvm-svn: 232384
2015-03-16 15:10:28 +00:00
Ed Schouten f424990d37 Don't hardcode the Czech locale name.
We already have a definition for the Czech locale name in
platform_support.h. Use this one instead.

While there, respect the common format of the tests. For most other
tests it's the case that test_iterators.h is placed right underneath the
other #includes (without an empty line). platform_support.h is included
after an empty line.

llvm-svn: 232383
2015-03-16 15:09:15 +00:00
Ed Schouten 74bbf7c7ee 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.

llvm-svn: 232379
2015-03-16 14:27:44 +00:00
Ed Schouten bd250daee0 Don't hardcode the locale name string.
The rest of the test uses the #defines for the locale names properly. In
this single spot we do hardcode the string. This causes this test to
fail on CloudABI, where this locale is called en_US.UTF-8@UTC.

llvm-svn: 232365
2015-03-16 09:44:37 +00:00
Ed Schouten 69722ab7c1 Remove unneeded initialisation of fenv_t and fexcept_t.
Though common, there is no requirement that fenv_t and fexcept_t are
structure and integer types, respectively. fexcept_t is a structure on
CloudABI.

llvm-svn: 232329
2015-03-15 18:36:31 +00:00
Jonathan Roelofs f11625d131 Fix build break on Solaris introduced by r231940
Solaris apparently doesn't have iswblank_l.


Thanks to C Bergstrom for the report!

llvm-svn: 232172
2015-03-13 15:09:42 +00:00
Renato Golin 2481cea17c Update copyright year to 2015.
llvm-svn: 232094
2015-03-12 20:13:11 +00:00
Ed Schouten 637a6862d6 Also enable the default rune table on CloudABI.
CloudABI does not expose a table on its own.

llvm-svn: 232050
2015-03-12 15:48:06 +00:00
Ed Schouten 97fdea618e 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!)

llvm-svn: 232049
2015-03-12 15:44:39 +00:00
Jonathan Roelofs 29f342c6b5 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

llvm-svn: 231940
2015-03-11 17:00:28 +00:00
Ed Schouten 12e0126596 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

llvm-svn: 231937
2015-03-11 16:39:36 +00:00
Dan Albert 900086de88 Move Android to the builtin rune table.
llvm-svn: 231897
2015-03-11 00:51:06 +00:00
Dan Albert 6846b2661d Copy data files to the remote runner.
Summary:
The data files for any given test will be in the same directory as the
source with a file name that matches *.dat. To make these available to
tests running remotely (such as over adb or ssh), copy them into the
test's remote working directory.

Note that we will perform more copies than we actually need. The data
files in the directory may only be used by one of the tests, but will
be copied for all tests in the same directory.

This patch also moves the remote test binary into the working
directory (previously it was only invoked from the working directory
rather than existing in it).

Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 231864
2015-03-10 22:31:49 +00:00
Eric Fiselier 4b7533a1dd Use generic feature name for sanitizers that replace new and delete
llvm-svn: 231841
2015-03-10 20:46:04 +00:00
Dan Albert ec571f2060 Factor out RemoteExecutor from SSHExecutor.
Summary:
A lot of the pieces of SSHExecutor can be shared with my AdbExecutor
(https://android-review.googlesource.com/#/c/138807/).

Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

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

llvm-svn: 231815
2015-03-10 18:43:16 +00:00
Ed Schouten 911040f19e 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.

llvm-svn: 231780
2015-03-10 09:35:22 +00:00
Ed Schouten 510b6ab07c 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).

llvm-svn: 231777
2015-03-10 09:26:38 +00:00
Ed Schouten cda27e8197 Don't include <sys/sysctl.h> on CloudABI.
As CloudABI does not provide sysctl(), this header is not present. Make
thread.cpp build correctly (and pass all tests) by not including the header.

llvm-svn: 231768
2015-03-10 08:01:10 +00:00
Ed Schouten c19393c758 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

llvm-svn: 231767
2015-03-10 07:57:43 +00:00
Ed Schouten 17f5dbef9b 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

llvm-svn: 231764
2015-03-10 07:46:06 +00:00
Eric Fiselier 21d7ffa233 [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

llvm-svn: 231729
2015-03-10 00:25:20 +00:00
Dimitry Andric a3175bab88 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

llvm-svn: 231705
2015-03-09 21:39:02 +00:00
Eric Fiselier 764d030840 Move test to use correct suffix
llvm-svn: 231704
2015-03-09 21:30:48 +00:00
Eric Fiselier 66e41b66ad Add TrackedValue to test/support. Thanks to Louis Dionne
llvm-svn: 231674
2015-03-09 18:02:16 +00:00
Marshall Clow f4903afd93 Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the bug because there's more work to do here
llvm-svn: 231672
2015-03-09 17:08:51 +00:00
Ed Schouten 1d2c052e9f Add CloudABI locale names to platform_support.h.
On CloudABI we should append the timezone name to the end of the locale
(e.g., nl_NL.UTF-8@Europe/Amsterdam). By fixing the locale names we can
already let a lot of locale related tests pass.

llvm-svn: 231649
2015-03-09 12:04:16 +00:00
Dan Albert eafe55200c Oops. This arg is passed, just ignored.
We should probably be using this argument to find the data files for
the tests, but that isn't implemented yet.

llvm-svn: 231498
2015-03-06 18:51:25 +00:00
Dan Albert ebfe1fe059 Fix the PrefixExecutor.
The PrefixExecutor wasn't passing the exe_path down the chain, so the
command was overriding that, the work_dir was being passed as the
command, and so on.

I've cleaned up a few pylint issues while I was here.

llvm-svn: 231496
2015-03-06 18:35:45 +00:00
Eric Fiselier e105ea84a2 Remove unneeded python import
llvm-svn: 231453
2015-03-06 06:22:22 +00:00
Eric Fiselier 26aaa6872d Run ShTests when the executor is an instance of LocalExecutor
llvm-svn: 231404
2015-03-05 20:27:01 +00:00
Marshall Clow 10b33a2662 Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883
llvm-svn: 231375
2015-03-05 16:07:37 +00:00
Marshall Clow b844b1a0ff Move the <dynarray> tests out of the std/ hierarchy, since it's not really part of the standard any more.
llvm-svn: 231311
2015-03-04 23:09:15 +00:00
Marshall Clow 7945c8a1bb Nbjoerg suggested a better name for the macro for the default rune table: _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
llvm-svn: 231255
2015-03-04 16:50:02 +00:00
Marshall Clow 66599d8ea8 Create a default rune table for libc++. Initial setting - never enabled. The expectation is that some targets (Android, cough) will enable it. Note that this is an implementation detail, not an interface change.
llvm-svn: 231252
2015-03-04 16:10:14 +00:00
Eric Fiselier b3be398c67 Allow declaration of map and multimap iterator with incomplete mapped type. Patch from eugenis
llvm-svn: 231119
2015-03-03 20:10:01 +00:00
Marshall Clow af670e4b37 Add better tests for ctype<char>::classic_table
llvm-svn: 231077
2015-03-03 16:15:26 +00:00
Eric Fiselier 0357171f1c [libcxx] Add support for linking libc++ against a static ABI library.
Summary:
This patch add the CMake option `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` which, when enabled, will link libc++ against the static version of the ABI library.


Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: compnerd, cfe-commits

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

llvm-svn: 231076
2015-03-03 15:59:51 +00:00
Saleem Abdulrasool 66d4c6e78c cmath: account for MSVCRT 12.0 changes
MSVCRT 12.0 introduces better compatibility for C99. This includes a number of
math routines that were previously undefined. Use the crtversion.h header to
detect the version of MSVCRT being targeted and avoid re-declaring the
variables.

Since copysign has been introduced in MSVCRT, importing the definition via using
makes it difficult to provide overloads (due to minor differences between
throw () and noexcept. Avoid defining the overloads on newer MSVCRT
targets.

llvm-svn: 230867
2015-02-28 20:18:39 +00:00