Commit Graph

103 Commits

Author SHA1 Message Date
Eric Fiselier
506f9d5bd3 Cleanup [list.modifiers] tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 03:46:32 +00:00
Eric Fiselier
ff58059a86 Suppress stupid and incorrect MSVC warning. patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273350 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 01:02:08 +00:00
Eric Fiselier
374a33d1b9 Allow the libc++ build/source paths to contain symlinks.
The filesystem tests were expecting the paths to the build/source directories
did not contain any symlinks. This patch resolves those symlinks before running
the test suite.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 21:54:23 +00:00
Jonathan Coe
ee49613ff4 Implement std::experimental::propagate_const from LFTS v2
Summary:
An implementation of std::experimental::propagate_const from Library Fundamentals Technical Specification v2.

No tests are provided for disallowed types like fancy pointers or function pointers as no code was written to handle these.

Reviewers: EricWF, mclow.lists

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273122 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-19 19:34:13 +00:00
Eric Fiselier
29c26b91df Fix SleepFor(...) helper when a monotonic clock is not available.
Single threaded builds often don't provide a monotonic clock, so we can't
always provide a monotonic SleepFor(...) implementation. Hopefully this
won't cause the builds to hang.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 18:32:26 +00:00
Eric Fiselier
87a1065747 Use monotonic clock in synthetic SleepFor test helper
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 17:51:11 +00:00
Eric Fiselier
880e38b206 Fix 3 bugs in filesystem tests and implementation.
This patch fixes the following bugs, all of which were discovered while
testing a 32 bit build on a 64 bit machine.

* path.itr/iterator.pass.cpp has undefined behavior.
  'path::iterator' stashes the value of the element inside the iterator.
  This violates the BiDirIterator requirements but is allowed for path::iterator.
  However this means that using reverse_iterator<path::iterator> has undefined
  behavior because it assumes that 'Iter tmp = it; return *tmp' will not create
  a dangling reference. However it does, and this caused this particular test
  to fail.

* path.native.obs/string_alloc.pass.cpp tested the SSO with a long string.
  On 32 bit builds std::wstring only has the SSO for strings of size 2. The
  test was using a string of size 4.

* fs.op.space/space.pass.cpp had overflows while calculating the expected values.
  The fix here is to convert the statvfs data members to std::uintmax_t before
  multiplying them. The internal implementation already does this but the tests
  needed to do it as well.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 04:10:23 +00:00
Eric Fiselier
40d9e09d89 Get filesystem tests passing for single-threaded configurations.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:44:26 +00:00
Eric Fiselier
6e9a694dce Add Filesystem TS -- Complete
Add the completed std::experimental::filesystem implementation and tests.
The implementation supports C++11 or newer.

The TS is built as part of 'libc++experimental.a'. Users of the TS need to
manually link this library. Building and testing the TS can be disabled using
the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'.

Currently 'libc++experimental.a' is not installed by default. To turn on the
installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 19:46:40 +00:00
Eric Fiselier
629aa5670a [libcxx] [test] In test/support/test_allocator.h, fix construct() to avoid moving immovable types.
Summary:
In test/support/test_allocator.h, fix construct() to avoid moving immovable types.

This improves the allocator's conformance, and fixes compiler errors with MSVC's STL. The scenario is when the allocator is asked to construct an object of type X that's immovable (deleted copy/move ctors), but implicitly constructible from an argument type A. When perfectly forwarded, X can be (explicitly) constructed from A, and everything is fine. That's std::allocator's behavior, and the Standard's default when a user allocator's construct() doesn't exist. The previous implementation of construct() here mishandled this scenario. Passing A to this construct() would implicitly construct an X temporary, bound to (non-templated) T&&. Then construct() would attempt to move-construct X from that X temporary, but X is immovable, boom.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15 01:53:32 +00:00
Eric Fiselier
d24c465bea Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable.
Patch from STL@microsoft.com. Thanks STL!


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 21:31:42 +00:00
Eric Fiselier
bfdae2062a Fix warnings in tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@272629 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 03:21:49 +00:00
Eric Fiselier
84acb1ec3f Remove trailing whitespace in test suite. Approved by Marshall Clow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 21:35:39 +00:00
Eric Fiselier
2aad5d548c Fix bug in test allocator that incorrectly computed the allocation size
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-30 01:31:04 +00:00
Eric Fiselier
dcb35ad8ae Add missing include to test_iterators.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271074 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 23:43:29 +00:00
Eric Fiselier
3cc263dda1 Remove C++11 feature macros in tests. Use TEST_STD_VER instead.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@269669 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 17:05:14 +00:00
Eric Fiselier
257fd699fd Add <experimental/memory_resource>
Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268829 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-07 01:04:55 +00:00
Eric Fiselier
0cf277c710 Don't use std::__clz in 'test/support/hexfloat.h'.
std::__clz is a libc++ specific function so it can't be used in the test suite.
This patch implements a dumb "count leading zeros" implementation within
hexfloat itself.

This patch also fixes UB since the output of `__builtin_clz(0)` is undefined
according to the GCC docs.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03 02:04:26 +00:00
Eric Fiselier
1e5a4a4a71 Fix or move various non-standard tests.
This patch does the following:

* Remove <__config> includes from some container tests.
* Guards uses of std::launch::any in async tests because it's an extension.
* Move "test/std/extensions" to "test/libcxx/extensions"
* Moves various non-standard tests including those in "sequences/vector",
  "std/localization" and "utilities/meta".


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267981 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 04:07:45 +00:00
Eric Fiselier
7aa3806b8c Fix possible test breakage for MinGW
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267968 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 01:22:16 +00:00
Eric Fiselier
59f8126f68 Fix get_temp_file_name() to compile on Windows. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267963 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 00:51:24 +00:00
Eric Fiselier
b6e757ed1d Add a return value for nasty_mutex::operator&. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267961 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 00:45:46 +00:00
Eric Fiselier
375e2f669c Guard libc++ specific c.__invariants() tests in LIBCPP_ASSERT macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267947 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 22:28:23 +00:00
Eric Fiselier
bda804ea25 Remove names of unreferenced parameters. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267852 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 03:17:56 +00:00
Eric Fiselier
4596c29195 Guard Clang and GCC specific pragmas. Patch from STL@microsoft.com
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267836 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28 01:49:03 +00:00
Eric Fiselier
5ccbc48774 Fix some non-standard parts of our test suite. Reported by STL
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22 10:33:56 +00:00
Eric Fiselier
dc414cd8ca Teach map/unordered_map how to optimize 'emplace(Key, T)'.
In cases where emplace is called with two arguments and the first one
matches the key_type we can Key to check for duplicates before allocating.

This patch expands on work done by dexonsmith@apple.com.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266498 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 00:23:12 +00:00
Eric Fiselier
83c9dc1714 Extract key to avoid preemptive mallocs in insert/emplace in associative containers
Summary: This patch applies Duncan's work on __hash_table to __tree.

Reviewers: mclow.lists, dexonsmith

Subscribers: dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-15 23:27:27 +00:00
Eric Fiselier
21f3b4ca42 Update container_test_types.h and cleanup the related tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@264985 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 02:13:14 +00:00
Marshall Clow
d124b5b45d Missed this file in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-14 23:07:58 +00:00
Eric Fiselier
410ed303ba Fix LWG issue 2469 - Use piecewise construction in unordered_map::operator[].
unordered_map's allocator may only be used to construct objects of 'value_type',
or in this case 'pair<const Key, Value>'. In order to respect this requirement
in operator[], which requires default constructing the 'mapped_type', we have
to use pair's piecewise constructor with '(tuple<Kep>, tuple<>)'.

Unfortunately we still need to provide a fallback implementation for C++03
since we don't have <tuple>. Even worse this fallback is the last remaining
user of '__hash_map_node_destructor' and '__construct_node_with_key'.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260601 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 21:45:53 +00:00
Eric Fiselier
ab4148260e Revert r260514 because it has a bogus commit message.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 18:21:18 +00:00
Eric Fiselier
907ec4059e separate nested >>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 12:51:19 +00:00
Eric Fiselier
ba41d7e1ff Teach __hash_table how to handle unordered_map's __hash_value_type.
This patch is fairly large and contains a number of changes. The main change
is teaching '__hash_table' how to handle '__hash_value_type'. Unfortunately
this change is a rampant layering violation, but it's required to make
unordered_map conforming without re-writing all of __hash_table.
After this change 'unordered_map' can delegate to '__hash_table' in almost all cases.

The major changes found in this patch are:

  * Teach __hash_table to differentiate between the true container value type
    and the node value type by introducing the "__container_value_type" and
    "__node_value_type" typedefs. In the case of unordered_map '__container_value_type'
    is 'pair<const Key, Value>' and '__node_value_type' is '__hash_value_type'.
    
  * Switch almost all overloads in '__hash_table' previously taking 'value_type'
    (AKA '__node_value_type) to take  '__container_value_type' instead. Previously
    'pair<K, V>' would be implicitly converted to '__hash_value_type<K, V>' because
    of the function signature.
    
  * Add '__get_key', '__get_value', '__get_ptr', and '__move' static functions to
    '__key_value_types'. These functions allow '__hash_table' to unwrap
    '__node_value_type' objects into '__container_value_type' and its sub-parts.

  * Pass  '__hash_value_type::__value_'  to 'a.construct(p, ...)' instead of
    '__hash_value_type' itself. The C++14 standard requires that 'a.construct()'
    and 'a.destroy()' are only ever instantiated for the containers value type.

  * Remove '__hash_value_type's constructors and destructors. We should never
    construct an instance of this type.
    (TODO this is UB but we already do it in plenty of places).
  
  * Add a generic "try-emplace" function to '__hash_table' called
    '__emplace_unique_key_args(Key const&, Args...)'.

  
The following changes were done as cleanup:

  * Introduce the '_LIBCPP_CXX03_LANG' macro to be used in place of
    '_LIBCPP_HAS_NO_VARIADICS' or '_LIBCPP_HAS_NO_RVALUE_REFERENCE'.
    
  * Cleanup C++11 only overloads that assume an incomplete C++11 implementation.
    For example this patch removes the __construct_node overloads that do
    manual pack expansion.
    
  * Forward 'unordered_map::emplace' to '__hash_table' and remove dead code
    resulting from the change. This includes almost all
    'unordered_map::__construct_node' overloads.


The following changes are planed for future revisions:

  * Fix LWG issue #2469 by delegating 'unordered_map::operator[]' to use
    '__emplace_unique_key_args'.
    
  * Rewrite 'unordered_map::try_emplace' in terms of '__emplace_unique_key_args'.
  
  * Optimize '__emplace_unique' to call '__emplace_unique_key_args' when possible.
    This prevent unneeded allocations when inserting duplicate entries.


The additional follow up work needed after this patch:

  * Respect the lifetime rules for '__hash_value_type' by actually constructing it.
  * Make '__insert_multi' act similar to '__insert_unique' for objects of type
    'T&' and 'T const &&' with 'T = __container_value_type'.
  
  

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260514 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 12:25:27 +00:00
Eric Fiselier
2960ae20e2 Teach __hash_table how to handle unordered_map's __hash_value_type.
This patch is fairly large and contains a number of changes. The main change
is teaching '__hash_table' how to handle '__hash_value_type'. Unfortunately
this change is a rampant layering violation, but it's required to make
unordered_map conforming without re-writing all of __hash_table.
After this change 'unordered_map' can delegate to '__hash_table' in almost all cases.

The major changes found in this patch are:

  * Teach __hash_table to differentiate between the true container value type
    and the node value type by introducing the "__container_value_type" and
    "__node_value_type" typedefs. In the case of unordered_map '__container_value_type'
    is 'pair<const Key, Value>' and '__node_value_type' is '__hash_value_type'.
    
  * Switch almost all overloads in '__hash_table' previously taking 'value_type'
    (AKA '__node_value_type) to take  '__container_value_type' instead. Previously
    'pair<K, V>' would be implicitly converted to '__hash_value_type<K, V>' because
    of the function signature.
    
  * Add '__get_key', '__get_value', '__get_ptr', and '__move' static functions to
    '__key_value_types'. These functions allow '__hash_table' to unwrap
    '__node_value_type' objects into '__container_value_type' and its sub-parts.

  * Pass  '__hash_value_type::__value_'  to 'a.construct(p, ...)' instead of
    '__hash_value_type' itself. The C++14 standard requires that 'a.construct()'
    and 'a.destroy()' are only ever instantiated for the containers value type.

  * Remove '__hash_value_type's constructors and destructors. We should never
    construct an instance of this type.
    (TODO this is UB but we already do it in plenty of places).
  
  * Add a generic "try-emplace" function to '__hash_table' called
    '__emplace_unique_key_args(Key const&, Args...)'.

  
The following changes were done as cleanup:

  * Introduce the '_LIBCPP_CXX03_LANG' macro to be used in place of
    '_LIBCPP_HAS_NO_VARIADICS' or '_LIBCPP_HAS_NO_RVALUE_REFERENCE'.
    
  * Cleanup C++11 only overloads that assume an incomplete C++11 implementation.
    For example this patch removes the __construct_node overloads that do
    manual pack expansion.
    
  * Forward 'unordered_map::emplace' to '__hash_table' and remove dead code
    resulting from the change. This includes almost all
    'unordered_map::__construct_node' overloads.


The following changes are planed for future revisions:

  * Fix LWG issue #2469 by delegating 'unordered_map::operator[]' to use
    '__emplace_unique_key_args'.
    
  * Rewrite 'unordered_map::try_emplace' in terms of '__emplace_unique_key_args'.
  
  * Optimize '__emplace_unique' to call '__emplace_unique_key_args' when possible.
    This prevent unneeded allocations when inserting duplicate entries.


The additional follow up work needed after this patch:

  * Respect the lifetime rules for '__hash_value_type' by actually constructing it.
  * Make '__insert_multi' act similar to '__insert_unique' for objects of type
    'T&' and 'T const &&' with 'T = __container_value_type'.
  
  

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-11 11:59:44 +00:00
Marshall Clow
b8f31a1c14 Got the test backwards in r258279. Fixed that and de-tabbed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258281 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 03:37:46 +00:00
Marshall Clow
85d4c2a93f Fix up the tests I added for string exceptions to be skipped when exceptions are disabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 03:19:15 +00:00
Eric Fiselier
fa1e5db3bc Add missing license headers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258196 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 21:52:04 +00:00
Marshall Clow
df9db31c27 Fix PR#25973 : 'basic_string::assign(InputIt, InputIt) doesn't provide the strong exception safety guarantee'. This turned out to be a pervasive problem in <string>, which required a fair amount of rework. Add in an optimization for when iterators provide noexcept increment/comparison/assignment/dereference (which covers many of the iterators in libc++). Reviewed as http://reviews.llvm.org/D15862
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@257682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13 21:54:34 +00:00
Marshall Clow
17a797c97d Remove some test scaffolding that I added and then didn't need. No functional change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@256861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05 19:44:58 +00:00
Marshall Clow
3426a86039 First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@256859 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05 19:32:41 +00:00
Eric Fiselier
76d2446cf4 Use __make_integer_seq builtin for std::make_integer_sequence. Patch by K-ballo.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@255162 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-09 22:03:06 +00:00
Marshall Clow
5142fe4401 Our test allocators support move/copy construction; they should support move/copy assignment as well
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249458 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 20:30:56 +00:00
Eric Fiselier
d95ca09be4 Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248993 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 08:34:37 +00:00
Eric Fiselier
237206bfda Suppress array initialization warnings in std::experimental::apply tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248987 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 07:05:38 +00:00
Eric Fiselier
5ec04a92d2 Fix bug in test_allocator<void> that used the wrong value to represent object state
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 05:00:25 +00:00
Eric Fiselier
85b6661a44 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245468 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:37:34 +00:00
Eric Fiselier
00f4a49b0b [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:21:46 +00:00
Eric Fiselier
286e0a491b [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245389 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 23:29:59 +00:00
Eric Fiselier
7175a07921 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243728 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 02:24:58 +00:00