Commit Graph

1951 Commits

Author SHA1 Message Date
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