Commit Graph

4246 Commits

Author SHA1 Message Date
Marshall Clow 4a911c867f In several places in std::allocator<const T> (and one in shared_ptr, we were casting a 'const T*' to a 'void *' - implicitly casting away the const. Add const_cast to make that explicit. No functional change.
llvm-svn: 305397
2017-06-14 16:54:43 +00:00
James Y Knight b6567b18c7 PR32476: __nop_locale_mgmt.h not needed with newlib 2.5+
Newlib 2.5 added the locale management functions, so it should not
include __nop_local_mgmt.h. This change adds proper guard around that
include statement.

For newlib 2.4, some releases contain these functions and some don't,
and they all have the same version numbers. This patch will work
properly with the initial "2.4.0" release which does not include these
functions and require __nop_local_mgmt.h.

This has been tested against newlib 2.2 and 2.5, and also sanity
checks against other different version numbers.

Patch by Martin J. O'Riordan and Walter Lee

Differential Revision: https://reviews.llvm.org/D32146

llvm-svn: 305394
2017-06-14 16:40:03 +00:00
Michael Park 26d98348dc Mark `__is_inplace_*` tests as UNSUPPORTED in <= C++14.
llvm-svn: 305373
2017-06-14 07:12:55 +00:00
Michael Park 9cac9ad9d4 Add an `__is_inplace_index` metafunction.
Summary: This is used to constrain `variant`'s converting constructor correctly.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF, mclow.lists

Differential Revision: https://reviews.llvm.org/D34111

llvm-svn: 305370
2017-06-14 05:51:18 +00:00
Marshall Clow f4ea23d3a5 Implement the non-parallel versions of reduce and transform_reduce for C++17
llvm-svn: 305365
2017-06-14 04:48:45 +00:00
Marshall Clow b707e7f391 Fix bug 33389 - __is_transparent check requires too much
llvm-svn: 305292
2017-06-13 14:34:58 +00:00
Marshall Clow ba2b6c6fae Add a test with an empty input range - should do nothing
llvm-svn: 305268
2017-06-13 02:28:40 +00:00
Marshall Clow 59494f2303 Mark the recent variant test as UNSUPPORTED for C++ before 17
llvm-svn: 305198
2017-06-12 16:33:41 +00:00
Marshall Clow 0c69d6e9bb Make tuple_element static_assert in pair if the index is out of range. Also, add a message to variant_alternative<> in the similar case (it already asserted). Add tests for this
llvm-svn: 305196
2017-06-12 16:13:17 +00:00
Marshall Clow 6db379a2c8 [array.tuple]/1 says that instantiating tuple_element<N, array<T, M>> is ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that we failed
llvm-svn: 305191
2017-06-12 14:41:37 +00:00
Marshall Clow e948ba1cd1 Implement the non-parallel versions of exclusive_scan and transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038.
llvm-svn: 305136
2017-06-10 02:22:13 +00:00
Stephan T. Lavavej ba8754ab09 [libcxx] [test] Update locale names for Windows.
locale.codecvt.byname/ctor_char.pass.cpp:
This test used to use "en_US" as a plain string instead of using platform_support.
Need to fix this because MS STL expects "en-US" instead.

platform_support.h:
These are the legacy Windows locale names. Should use IETF tags instead.
I've also added en_US, since a test was using that as a locale string as well.

msvc_stdlib_force_include.hpp:
Remove _MSVC_STL_VER. The libraries will directly define _MSVC_STL_VERSION in the future.

Fixes D29351.

llvm-svn: 305000
2017-06-08 18:22:03 +00:00
Stephan T. Lavavej 2bd63dae21 [libcxx] [test] Remove a Clang/C2 workaround.
Clang/LLVM doesn't need this workaround.

Fixes D33955.

llvm-svn: 304999
2017-06-08 18:21:59 +00:00
Eric Fiselier 183d83b5b9 XFAIL tuple deduction guide test on GCC
llvm-svn: 304969
2017-06-08 08:03:35 +00:00
Eric Fiselier baaee20690 Add tests for class template deduction on std::tuple.
llvm-svn: 304967
2017-06-08 07:18:17 +00:00
Eric Fiselier 1ef13310b8 Revert r304955 - Fix class template deduction for scoped_lock.
Richard decided to fix these cases in Clang, even though they are
representative of a larger problem for more complex
cases.

llvm-svn: 304966
2017-06-08 07:18:15 +00:00
Eric Fiselier 955290d21f Fix class template deduction for scoped_lock.
r304862 changed how CTD handles deducing a non-primary class template
using a non-dependent constructor of the primary template. This change
requires libc++ to provide explicit deduction guides to make scoped_lock
work again.

llvm-svn: 304955
2017-06-08 00:38:56 +00:00
Eric Fiselier 8551d0e319 Fix compile error with Bionic's PTHREAD_MUTEX_INITIALIZER
On Bionic PTHREAD_MUTEX_INITIALIZER contains the expression "<enum-type> & <integer-type>",
which causes ADL to perform name lookup for operator&. During this lookup Clang decides
that it requires the default member initializer for std::mutex while defining the DMI
for std::mutex::__m_.

If I'm not mistaken this is caused by the explicit noexcept declaration on the defaulted
constructor.

This patch removes the explicit noexcept and instead allows the compiler to declare
the default constructor implicitly noexcept. It also adds a static_assert to ensure
that happens.

Unfortunatly because it's not easy to change the value of _LIBCPP_MUTEX_INITIALIZER
for a single test there is no good way to test this patch.

The Clang behavior causing the trouble here was introduced in r287713, which first
appears in the 4.0 release.

llvm-svn: 304942
2017-06-07 20:47:42 +00:00
Michael Park aeb2c881ce Mark LWG 2904 as complete.
llvm-svn: 304893
2017-06-07 10:27:17 +00:00
Michael Park a8b057483b Implement LWG 2904.
Summary:
- Removed the move-constructibe requirement from copy-assignable.
- Updated `__assign_alt` such that we direct initialize if
  `_Tp` can be `nothrow`-constructible from `_Arg`, or `_Tp`'s
  move construction can throw. Otherwise, construct a temporary and move it.
- Updated the tests to remove the pre-LWG2904 path.

Depends on D32671.

Reviewers: EricWF, CaseyCarter

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D33965

llvm-svn: 304891
2017-06-07 10:22:43 +00:00
Eric Fiselier bc8383e76c Fix test with exceptions disabled
llvm-svn: 304883
2017-06-07 09:06:05 +00:00
Casey Carter 708a21bd5f [test] Test changes to accommodate LWG 2904 "Make variant move-assignment more exception safe"
Also: Move constexpr / triviality extension tests into the std tree and make them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION.

https://reviews.llvm.org/D32671

llvm-svn: 304847
2017-06-07 00:06:04 +00:00
Casey Carter dd7c68bc78 add missing constexpr to optional::value_or
[Credit to cpplearner]

Differential Revision: https://reviews.llvm.org/D27850

llvm-svn: 304813
2017-06-06 18:47:26 +00:00
Stephan T. Lavavej a651f73a79 [libcxx] [test] Add _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to msvc_stdlib_force_include.hpp.
This macro will instruct MSVC's STL to not warn about features that are deprecated in C++17,
as libcxx tests those features and uses them elsewhere.

llvm-svn: 304765
2017-06-06 02:46:12 +00:00
Casey Carter c8342f2eef [test] Remove workaround for C1XX empty parameter pack bug
Was VSO#109062. This bug was filed *4 years ago*. I submitted a workaround to enable the scoped_allocator_adaptor tests to pass. Bug fixed a week and a half later. This was either a waste of my time, or I've discovered that libc++ has magical bugfix-inducing powers. My money's on the latter.

llvm-svn: 304730
2017-06-05 19:59:17 +00:00
Marshall Clow 1798ec5241 Fix the recently introduced test to work on C++03
llvm-svn: 304629
2017-06-03 01:21:29 +00:00
Marshall Clow 87af646034 Fix some undefined behavior in __hash_table. Thanks to vsk for the report and the patch. Reviewed as https://reviews.llvm.org/D33588.
llvm-svn: 304617
2017-06-03 00:08:32 +00:00
Vedant Kumar 8f5f93a4a8 Mark two coroutine tests as unsupported under ubsan, again
This reverts commit r304580, making bool_await_suspend.pass.cpp and
generator.pass.cpp unsupported on ubsan again. The host compiler is
based on r304329, which has the change from PR33271 (r304277). However,
this was not enough to address the issue.

Bot Failure:
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan/builds/628

Unknown type!
UNREACHABLE executed at /home/eric/full-llvm/llvm/lib/IR/ValueTypes.cpp:287!
llvm::EVT::getEVT(llvm::Type*, bool) (/usr/local/bin/clang-5.0+0x17e7a07)
llvm::TargetLoweringBase::getValueType(llvm::DataLayout const&, llvm::Type*, bool) const (/usr/local/bin/clang-5.0+0x852c4a)
llvm::ComputeValueVTs(llvm::TargetLowering const&, llvm::DataLayout const&, llvm::Type*, llvm::SmallVectorImpl<llvm::EVT>&, llvm::SmallVectorImpl<unsigned long>*, unsigned long) (/usr/local/bin/clang-5.0+0x141b6e9)
 llvm::SelectionDAGBuilder::visitTargetIntrinsic(llvm::CallInst const&, unsigned int) (/usr/local/bin/clang-5.0+0x237b1ca)

clang-5.0: /home/eric/full-llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1236: virtual void llvm::DwarfDebug::endFunctionImpl(const llvm::MachineFunction *): Assertion `LScopes.getAbstractScopesList().size() == NumAbstractScopes && "ensureAbstractVariableIsCreated inserted abstract scopes"' failed.
__assert_fail_base /build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
(/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (/usr/local/bin/clang-5.0+0x223f86b)
llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (/usr/local/bin/clang-5.0+0x227a5a1)
llvm::AsmPrinter::EmitFunctionBody() (/usr/local/bin/clang-5.0+0x222522f)

llvm-svn: 304591
2017-06-02 20:06:49 +00:00
Vedant Kumar 07a493e263 Revert "Mark two coroutine tests as unsupported under ubsan"
This reverts commit r304462, thereby re-enabling two tests under ubsan.
We expect these tests to pass now that PR33271 is fixed.

llvm-svn: 304580
2017-06-02 18:30:16 +00:00
Casey Carter 75f2f4c9c1 [test] Allow non-libc++ coroutine_handle::done to strengthen noexcept
llvm-svn: 304487
2017-06-01 22:40:16 +00:00
Vedant Kumar 962aa247de Mark two coroutine tests as unsupported under ubsan
They appear to crash inside of SelectionDAG on some Linux bots, when
ubsan is enabled.

https://bugs.llvm.org/show_bug.cgi?id=33271

llvm-svn: 304462
2017-06-01 20:00:40 +00:00
Vedant Kumar 3a424a857f Remove ubsan XFAILS in two tests
These two tests are ubsan-clean now:
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/3553/

llvm-svn: 304450
2017-06-01 18:48:27 +00:00
Eric Fiselier f8d76e6185 Fix name used in -verify diagnostic to match trunk
llvm-svn: 304384
2017-06-01 02:31:01 +00:00
Eric Fiselier 9ffacf3d16 Fix more unreserved names
llvm-svn: 304383
2017-06-01 02:29:37 +00:00
Eric Fiselier def3c375e0 Rename unreserved names in tuple
llvm-svn: 304382
2017-06-01 02:14:21 +00:00
Eric Fiselier 9bcd8e500e Upgrade Clang version used by appveyor
llvm-svn: 304377
2017-06-01 01:00:59 +00:00
Eric Fiselier baa9198585 Define -DNOMINMAX when running the tests on Windows
llvm-svn: 304372
2017-05-31 23:27:25 +00:00
Eric Fiselier 1c3b0afbbe Fix silly mistakes in recent changes made to coroutine test
llvm-svn: 304364
2017-05-31 22:20:42 +00:00
Eric Fiselier 1ec026252b Fix Libc++ build with MinGW64
Summary: This patch corrects the build errors I encountered when building on MinGW64.

Reviewers: mati865, rnk, compnerd, smeenai, bcraig

Reviewed By: mati865, smeenai

Subscribers: martell, chapuni, cfe-commits

Differential Revision: https://reviews.llvm.org/D33082

llvm-svn: 304360
2017-05-31 22:14:05 +00:00
Eric Fiselier a016efb1dc [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on Windows
Summary:
This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning.
This patch changes libc++ to use `#pragma push_macro`  to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header.

Reviewers: mclow.lists, bcraig, compnerd, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, krytarowski

Differential Revision: https://reviews.llvm.org/D33080

llvm-svn: 304357
2017-05-31 22:07:49 +00:00
Eric Fiselier f9645c3a92 Guard against more macros in tchar.h
llvm-svn: 304352
2017-05-31 21:39:54 +00:00
Eric Fiselier 4f429cecd9 Transform the libc++ coroutine shell tests into normal .pass.cpp tests.
The shell test versions didn't get all of the flags normal tests
do, specifically warning flags. This patch makes them .pass.cpp tests,
and uses a lit.local.cfg to add -fcoroutines-ts and to make them
UNSUPPORTED when that flag isn't available.

llvm-svn: 304351
2017-05-31 21:34:43 +00:00
Eric Fiselier 89918caaa7 Remove uses of _UI because Windows is evil and tchar.h #define's it
llvm-svn: 304348
2017-05-31 21:20:18 +00:00
Casey Carter 0927291471 [test] s/uexpectedly/unexpectedly/
llvm-svn: 304236
2017-05-30 20:12:55 +00:00
Eric Fiselier a607ba6134 Add missing 'requires coroutines' to module map
llvm-svn: 304180
2017-05-29 23:17:28 +00:00
Eric Fiselier 6e88ac2b6c Fix <experimental/coroutine> in C++03
llvm-svn: 304173
2017-05-29 19:46:16 +00:00
Eric Fiselier 3fd0228ead [coroutines] Make coroutine_handle<T>::from_address ill-formed for everything but void*.
from_address requires that the provided pointer refer to the suspended coroutine,
which doesn't have a type, or at least not one knowable by the user. Therefore
every use of `from_address` with a typed pointer is almost certainly a bug.

This behavior is a part of the TS specification, but hopefully it will be
in the future.

llvm-svn: 304172
2017-05-29 19:24:25 +00:00
Eric Fiselier bae0a1d43c Fix coroutine test failures caused by API misusages.
More tests to come. I think that from_address overload should be deleted
or ill-formed, except for the 'void*' one; The user cannot possibly
have a typed pointer to the coroutine state.

llvm-svn: 304131
2017-05-29 06:42:01 +00:00
Eric Fiselier 207d13cf84 Fix multiple bugs in coroutine tests.
llvm-svn: 304124
2017-05-29 05:00:24 +00:00
Eric Fiselier 09fcc2ce9b Correct XFAIL's in coroutine tests to only list ubsan
llvm-svn: 304106
2017-05-28 20:56:16 +00:00
Eric Fiselier 15ee787ac2 Fix use of uninitialized memory
llvm-svn: 304105
2017-05-28 20:49:13 +00:00
Eric Fiselier f8b10f99c9 XFAIL tests which trigger coroutine debug info crash in Clang
llvm-svn: 304104
2017-05-28 20:49:11 +00:00
Eric Fiselier 8f7952c190 Add hack to allow test to run w/o C++17 copy elision
llvm-svn: 304103
2017-05-28 20:30:18 +00:00
Eric Fiselier 4aaf69749b Remove XFAIL's for recently fixed bug
llvm-svn: 304102
2017-05-28 20:25:41 +00:00
Eric Fiselier c34a497b40 [coroutines] Add end-to-end tests within libc++
This patch adds end-to-end/breathing tests for coroutines
into libc++. The tests aren't specifically to test libc++ requirements
but instead are intented to ensure coroutines are working fine in general.

Although libc++ isn't exactly the most correct place for these tests
to live, there is one major advantage. The libc++ test suite is also
used by MSVC and by adding the tests here it ensures they will be
run against all currently available coroutine implementations.

llvm-svn: 304101
2017-05-28 19:38:21 +00:00
Eric Fiselier 298dbf9e89 Workaround debug info bug in Clangs coroutine implementation
llvm-svn: 303966
2017-05-26 04:09:38 +00:00
Eric Fiselier 997a391466 Get <experimental/coroutine> working in C++03.
Clang supports coroutines in all dialects; Therefore libc++ should too,
otherwise the Clang extension is unusable.

I'm not convinced extending support to C++03 is a feasible long term
plan, since as the library grows to offer things like generators it
will be come increasingly difficult to limit the implementation to C++03.

However for the time being supporting C++03 isn't a big deal.

llvm-svn: 303963
2017-05-26 03:02:54 +00:00
Eric Fiselier eb04c8cae2 Guard <experimental/coroutine> against older Clang versions.
Clang started providing -fcoroutines and defining __cpp_coroutines
way before it implemented the __builtin_coro_foo functions. This
means that simply checking if __cpp_coroutines is not a sufficient
way of detecting the actual feature.

This patch implements _LIBCPP_HAS_NO_COROUTINES which implements
a slightly more complex feature check. Specifically it requires
__cpp_coroutines >= 201703L, which only holds for Clang 5.0 built
after 2017/05/24.

llvm-svn: 303956
2017-05-26 01:52:59 +00:00
Eric Fiselier abaf967ceb Remove incorrect #ifdef guards around variant tests.
The tests were previously guarded by #if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER),
which is both incorrect (e.g. _LIBCPP_VERSION) and unneeded. Although the tests are
technically non-standard (yet) they are supported by both libc++ and MSVC's STL.

libstdc++ doesn't regularly use the test suite so I'm not concerned about guarding these
tests for them.

llvm-svn: 303953
2017-05-26 01:27:08 +00:00
Casey Carter f611d873a3 [test] Fix breakage from r303947 =(
llvm-svn: 303951
2017-05-26 01:00:56 +00:00
Casey Carter a60c9bced5 [test] make_shared<T()>(...) is, uh, libc++-specific
llvm-svn: 303947
2017-05-26 00:37:33 +00:00
Eric Fiselier ea96891fb4 Re-add <experimental/coroutine> to the module map.
The original issues were caused because <experimental/coroutine>
didn't correctly #ifdef out enough of the header, which caused incomplete
types to be used.

This patch fixes the `#if defined(__cpp_coroutines)` guard and re-adds
the headers to the module map.

It also uglifies some incorrectly non-reserved names.

llvm-svn: 303936
2017-05-25 23:39:29 +00:00
Eric Fiselier 5099ddfdf7 Correct typo: LIBCXXABI_BUILTINS_LIBRARY -> LIBCXX_BUILTINS_LIBRARY
llvm-svn: 303929
2017-05-25 22:43:42 +00:00
Martell Malone 8fd2d37b0b libcxx: fix bootstrapping for mingw-w64
Differential Revision: https://reviews.llvm.org/D33388

llvm-svn: 303928
2017-05-25 22:37:15 +00:00
Eric Fiselier 51056aef65 Update more coroutine_handle signatures to reflect N4663.
Thanks to Casey Carter for pointing out the out-of-date tests and
implementation.

llvm-svn: 303900
2017-05-25 19:04:55 +00:00
Billy Robert O'Neal III 4deabc97a1 Add asserts that the nullptr is maintained in string erase operations.
llvm-svn: 303899
2017-05-25 19:01:14 +00:00
Eric Fiselier 2944c5a3fa Update coroutine_handle<P>::promise to reflect N4663.
This patch updates the promise() member to match the current spec.
Specifically it removes the non-const overload and make the return
type of the const overload non-const.

This patch also makes the ASSERT_NOT_NOEXCEPT tests libc++ specific,
since other implementations may be free to strengthen the specification.

llvm-svn: 303895
2017-05-25 18:52:34 +00:00
Casey Carter b4f3924dd5 [test] Remove workaround for C1XX conversion-to-nullptr bug
VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for correlation.

Differential Revision: https://reviews.llvm.org/D33290

llvm-svn: 303889
2017-05-25 17:42:21 +00:00
Casey Carter 895db0a5f6 [test] Workaround C1XX bug in uses_allocator_types.hpp
VSO#109062 "Explicit template argument specification with empty template parameter pack expansion does not imply further empty pack expansion"

Differential Revision: https://reviews.llvm.org/D33214

llvm-svn: 303888
2017-05-25 17:42:17 +00:00
Erik Pilkington 76886e82e5 Fix a test that was failing in C++11 mode introduced in r303874
llvm-svn: 303878
2017-05-25 16:16:17 +00:00
Marshall Clow 91a091cc00 Mark LWG#2900 as complete - we already do this, and I checked the tests in a couple days ago (r303268 & r303824)
llvm-svn: 303876
2017-05-25 16:05:54 +00:00
Erik Pilkington 72d0d603fb Add support for shared_ptr<FunctionType>
Fixes PR27566.

Differential revision: https://reviews.llvm.org/D30837

llvm-svn: 303874
2017-05-25 15:43:31 +00:00
Marshall Clow 5b7c98e52a Last commit included some extra constexpr; remove them
llvm-svn: 303862
2017-05-25 14:20:26 +00:00
Marshall Clow 1d02996d28 Make for_each_n only avaliable on C++17
llvm-svn: 303856
2017-05-25 13:40:57 +00:00
Eric Fiselier 39b56d80a1 Remove <experimental/coroutine> from the module map for now. It doesn't work unless modules are enabled
llvm-svn: 303838
2017-05-25 05:30:05 +00:00
Eric Fiselier d791d4ea3c Disable the coroutines tests until Clang bumps __cpp_coroutines to reflect recent changes
llvm-svn: 303837
2017-05-25 05:11:40 +00:00
Eric Fiselier 3ca9185073 Add <experimental/coroutine>
This patch adds the library portions of the coroutines PDTS,
which should now be supported by Clang.

llvm-svn: 303836
2017-05-25 04:36:24 +00:00
Eric Fiselier c81c8cbe77 Fix broken links on C++1z status page
llvm-svn: 303835
2017-05-25 04:09:07 +00:00
Marshall Clow d5c65ffa8d Add non-parallel version of for_each_n (+tests) from the Parallelism TS
llvm-svn: 303833
2017-05-25 02:29:54 +00:00
Marshall Clow 29b75d6986 Add some constexpr tests for optional's move/copy ctor
llvm-svn: 303824
2017-05-25 00:22:33 +00:00
Marshall Clow c44a727ee4 Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.
llvm-svn: 303675
2017-05-23 18:55:32 +00:00
Erik Pilkington 0de31c7e53 [test] Add support for Objective-C++ tests
Differential revision: https://reviews.llvm.org/D33049

llvm-svn: 303466
2017-05-19 23:02:49 +00:00
Marshall Clow f51ee63247 Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0
llvm-svn: 303281
2017-05-17 18:51:36 +00:00
Marshall Clow c1bcd4c1f2 Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.

llvm-svn: 303268
2017-05-17 15:30:01 +00:00
Casey Carter 4de0f034cf [test] Add specific test for P0138R2, direct-list-init of fixed enums from integers, part 3/3.
Test the C++17 Core Language feature independently from other std::byte tests.

llvm-svn: 302946
2017-05-12 20:33:46 +00:00
Casey Carter 7bba58f24d [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 2/3.
This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part activates the tests for more compilers.

llvm-svn: 302945
2017-05-12 20:33:41 +00:00
Casey Carter ef475c4d71 [test] Avoid P0138R2, direct-list-init of fixed enums from integers, part 1/3.
This C++17 Core Language feature isn't necessary when testing std::byte.
It's a minor convenience, but it limits test coverage to very new compilers.

This part changes the code.

Fixes D32386.

llvm-svn: 302944
2017-05-12 20:33:32 +00:00
Eric Fiselier 3086b45a2f Fix C++03 test failures caused by static_assert emulation
llvm-svn: 302871
2017-05-12 03:53:56 +00:00
Eric Fiselier 25b9b60dd6 Cleanup test issues reported by STL @ Microsoft.
This patch cleans up a number of issues reported by STL, including:

1) Fix duplicate is_convertible test.
2) Move non-standard reference_wrapper tests under test/libcxx
3) Fix assumption that sizeof(wchar_t) == 32 in the codecvt and
   wstring_convert tests.

llvm-svn: 302870
2017-05-12 03:38:28 +00:00
Eric Fiselier 5b8ab693ab Remove non-standard basic_string_view::clear() member.
This patch removes the clear() member from <string_view>. The
modifier was removed from the TS before it ever landed in the standard.
There is no reason libc++ should be providing this method.

llvm-svn: 302869
2017-05-12 03:35:53 +00:00
Eric Fiselier 581072e1a6 Move POSIX specific test under test/libcxx subdirectory
llvm-svn: 302865
2017-05-12 02:02:09 +00:00
Eric Fiselier 873f8d2ebe Move tests for libc++ configurations into libcxx/ test subdirectory
llvm-svn: 302864
2017-05-12 01:49:32 +00:00
Eric Fiselier 5750a3fa20 Fix or move tests with non-standard assumptions
llvm-svn: 302862
2017-05-12 01:44:51 +00:00
Eric Fiselier 1bb7235026 Guard usage of libc++ regex internals inside test.
This patch attempts to make lookup_classname.pass.cpp usable against
other STL implementations by guarding the use of __regex_word. That being
said it seems likely that the test is still non-conforming due to how
libc++ handles the "w" character class.

llvm-svn: 302859
2017-05-12 01:19:01 +00:00
Eric Fiselier bb78837e4d Fix XFAIL to reflect recent fixes in GCC
llvm-svn: 302841
2017-05-11 23:04:04 +00:00
Marshall Clow 35f62e3228 Mark LWG#2782 as complete. No functionality change; we already do this. Just added a few more tests.
llvm-svn: 302802
2017-05-11 14:25:45 +00:00
Marshall Clow 7e154cdca7 Replace a nested namespace used for overload resolution with a struct. Richard Smith says that using the namespace results in an ODR violation, but I disagree. Nevertheless, the struct works just as well.
llvm-svn: 302800
2017-05-11 14:00:54 +00:00
Marshall Clow afda4a9af9 Mark LWG#2850 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests. Thanks to K-ballo for the heads up.
llvm-svn: 302799
2017-05-11 13:55:20 +00:00
Marshall Clow 9630f46dde Mark LWG#2796 as complete. No functionality change; we had tests that covered it already. Just added comments to the tests
llvm-svn: 302798
2017-05-11 13:51:09 +00:00
Michael Park 215f55f526 Fix `std::visit` for the zero variants case.
Summary:
The following code is broken:

```
    std::visit([]{});
```

Reviewers: EricWF

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D33090

llvm-svn: 302773
2017-05-11 07:17:12 +00:00
Eric Fiselier 3853a41754 Workaround -W#warnings on Windows until the correct fixes can land
llvm-svn: 302743
2017-05-10 23:29:13 +00:00
Eric Fiselier 0c6e7ae4cc Remove usages of _LIBCPP_MSVC which is never defined
llvm-svn: 302736
2017-05-10 21:40:58 +00:00
Eric Fiselier a1bc823a59 Fix MinGW build to use Pthread when the header is available.
Some MinGW configurations use WinPThread instead of the native
threading interfaces. When this happens libc++ doesn't build because
it tries to use the wrong threading API.

This patch attempts to correctly detect and enable pthreads; Selecting
them when __MINGW32__ is defined and __has_include(<pthread.h>) is true.
I'm not sure if this works correctly 100% of the time but it seemed
like the most correct approach available.

llvm-svn: 302734
2017-05-10 21:34:58 +00:00
Eric Fiselier 80f8cfb37f Don't interfere with the __builtin_foo namespace under MSVC
This patch follows up on feedback received in the review for
D32988. Specifically that libc++ should not mess with the
__builtin namespace, and that libc++ should use __popcnt to implement
__pop_count under MSVC.

llvm-svn: 302731
2017-05-10 21:30:04 +00:00
Billy Robert O'Neal III ac831d35cf Fix bad #endif in msvc_stdlib_force_include.hpp.
llvm-svn: 302728
2017-05-10 20:58:30 +00:00
Eric Fiselier 5d50aa3204 [libc++] Refactor Windows support headers.
Summary:
This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers.

The changes in this patch are:

* remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers.

* Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles.

* Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang.

I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check?

This refactor is needed to support upcoming fixes to `<locale>` on Windows.



Reviewers: bcraig, rmaprath, compnerd, EricWF

Reviewed By: EricWF

Subscribers: majnemer, cfe-commits

Differential Revision: https://reviews.llvm.org/D32988

llvm-svn: 302727
2017-05-10 20:57:45 +00:00
Eric Fiselier d75e451471 Implement LWG 2591 - Patch from K-Ballo
llvm-svn: 302724
2017-05-10 20:37:43 +00:00
Eric Fiselier ff15825401 XFAIL is_trivially_copyable test for compilers that don't implement Core 2094
llvm-svn: 302723
2017-05-10 20:19:35 +00:00
Eric Fiselier f3a74e7d28 Fix enable_shared_from_this test in C++11
llvm-svn: 302721
2017-05-10 20:09:20 +00:00
Eric Fiselier 7b08184d46 Clean up LIT failure output by not showing the entire environment
llvm-svn: 302713
2017-05-10 19:55:42 +00:00
Billy Robert O'Neal III 6957d35a9b Update is_trivially_copyable tests with CWG 2094
Clang 5.0 implements these changes here: 87cd035326
MSVC++ will implement these changes in the first toolset update to 2017.

Differential Revision: https://reviews.llvm.org/D33021

llvm-svn: 302710
2017-05-10 19:43:31 +00:00
Eric Fiselier f09df77236 [libc++] Fix PR32979 - types with a private std::enable_shared_from_this base break shared_ptr
Summary:
This patch fixes bugs.llvm.org/PR32979.

[util.smartptr.shared.const] says:
> In the constructor definitions below, enables shared_from_this with p, for a pointer p of type Y*, means
> that if Y has an unambiguous and accessible base class that is a specialization of enable_shared_from_-
> this.

This means that libc++ needs to respect the access specifier of the base class, and not attempt to construct
and enabled_shared_from_this base if it is private. However access specifiers don't affect overload resolution
so our current implementation will attempt to construct the private base. 

This patch uses SFINAE to correctly detect if the shared_ptr input has an accessible enable_shared_from_this
base class.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D33033

llvm-svn: 302709
2017-05-10 19:35:49 +00:00
Casey Carter 768a93fbeb [test] support machinery changes for EDG & C1XX /Za
This change works around a couple of bugs:

1. EDG doesn't like explicit constexpr in a derived class. This program:

  struct Base {};
  struct Derived : Base {
      constexpr Derived() = default;
  };

  triggers "error: defaulted default constructor cannot be constexpr."

2. C1XX with /Za has no idea which constructor needs to be valid for copy elision.

The change also conditionally disables parts of the msvc_stdlib_force_include.hpp header that conflict with external configuration when _LIBCXX_IN_DEVCRT is defined.

Differential Revision: https://reviews.llvm.org/D32778

llvm-svn: 302707
2017-05-10 19:10:49 +00:00
Eric Fiselier fc861f511a Attempt to speculatively unbreak Apple build bots
llvm-svn: 302627
2017-05-10 08:04:50 +00:00
Eric Fiselier 52ad6e55d9 Rename Appveyor install helper script.
I'm really lazy and the old name for the helper script
killed 2 letter tab completion for the include directory.
This patch renames it to avoid that problem and enable
lazyness.

llvm-svn: 302619
2017-05-10 02:43:02 +00:00
Eric Fiselier e9ee517930 Support using MinGW POSIX threads on Windows
llvm-svn: 302617
2017-05-10 02:36:48 +00:00
Eric Fiselier 8a64fd71b9 attempt to fix appveyor syntax error
llvm-svn: 302616
2017-05-10 02:34:56 +00:00
Eric Fiselier 9fc0ba970a Add MinGW64 builder to Appveyor.
With the amount of work happening on Windows we should
have a MinGW bot to make sure we don't regress that functionality.
Currently it doesn't build :-(

llvm-svn: 302614
2017-05-10 02:30:16 +00:00
Eric Fiselier 9311603160 Improve how LIT reports the added environment variables
llvm-svn: 302607
2017-05-10 00:23:58 +00:00
Eric Fiselier d1eff0e813 Attempt to unbreak Libc++ test configuration
llvm-svn: 302604
2017-05-10 00:05:04 +00:00
Eric Fiselier 3388f7c0cb Fix test runtime environment on Windows
llvm-svn: 302602
2017-05-09 23:57:22 +00:00
Eric Fiselier 78046e4624 Fix misspelling of environment throughout libc++
llvm-svn: 302600
2017-05-09 23:47:20 +00:00
Tom Stellard 5a741dd8a6 docs: Fix Sphinx detection with out-of-tree builds
Adapt to changes made in r302499.

llvm-svn: 302517
2017-05-09 11:18:03 +00:00
Ben Craig bb497d3895 Fix Windows tests when __config_site is present.
Previously, the force includes would complain about a missing _DEBUG symbol.
Now we dump macros before adding the force includes to the command line.
Now with proper newlines.

llvm-svn: 302497
2017-05-09 01:34:12 +00:00
Ben Craig ff63090b0e Revert "Fix Windows tests when __config_site is present."
It's 2017, and line endings are still an issue.

llvm-svn: 302496
2017-05-09 01:26:39 +00:00
Eric Fiselier 50d61da2e4 Fix GCC 7 test failures.
This patch fixes the test failures and unexpected passes that occur
when testing against GCC 7. Specifically:

* don't mark __gcd as always inline because it's a recursive function. GCC diagnoses this.
* don't XFAIL the aligned allocation tests. GCC 7 supports them but not the -faligned-allocation option.
* Work around gcc.gnu.org/PR78489 in variants constructors.

llvm-svn: 302488
2017-05-09 00:00:00 +00:00
Eric Fiselier b4ddab26bc Refactor <locale> RAII guards to aid upcoming Windows locale changes.
Previously <locale> used std::unique_ptr<remove_ptr<locale_t>, locale-mgmt-function>
as a scope guard for (A) creating new locales, and (B) setting the thread specific locale
in RAII safe manner.

However using unique_ptr has some problems, first it requires that locale_t is a pointer
type, which may not be the case (Windows will need a non-pointer locale_t type that emulates _locale_t).

The second problem is that users of the guards had to supply the locale management function to the custom
deleter at every call site. However these locale management functions don't exist natively Windows, making
a good Windows implementation of locale more difficult.

This patch creates distinct and simply RAII guards that replace unique_ptr. These guards handle calling
the correct locale management function so that callers don't have too. This simplification will
aid in upcoming Windows fixes.

llvm-svn: 302474
2017-05-08 22:02:43 +00:00
Billy Robert O'Neal III 362ea7329f Fix possible loss of data warnings on amd64
In T_size_size.pass, there is an explicit template argument to std::min to ask
for unsigned, to avoid type deduction errors. However, C1XX' warnings still
hate this use, because a 64 bit value (a size_t) is being passed to a function
accepting an unsigned (a 32 bit value).

Instead, change the tests to pass around std::size_t instances, and explicitly
narrow when constructing the string type under test. This also allows
removal of explicit template arguments to std::min.

llvm-svn: 302473
2017-05-08 21:54:53 +00:00
Billy Robert O'Neal III 8c401179a3 Resolve integer overflow warnings in GCD and LCM tests
lcm.pass.cpp:
19: Update headers to that actually used in the test.
41: test0 was triggering narrowing warnings for all callers, because the
inputs were always ints, but some of the explicit template arguments were
smaller than that. Instead, have this function accept ints and static_cast
explicitly to the types we want before calling std::lcm.
47: Replace unnecessary ternary.
55: Use foo_t instead of typename foo<>::type
111/116: intX_t were not std::qualified but only <cfoo> headers were included.
141: C1XX has a bug where it interprets 2147483648 as unsigned int. Then the
negation trips "negation of unsigned value, result still unsigned" warnings.
Perma-workaround this issue by saying INT_MIN, which better documents the
intended behavior and avoids triggering warnings on C1XX.

gcd.pass.cpp:
Same changes as lcm.pass.cpp but for GCD.

llvm-svn: 302472
2017-05-08 21:52:05 +00:00
Ben Craig 9669df28d4 Fix Windows tests when __config_site is present.
Previously, the force includes would complain about a missing _DEBUG symbol.
Now we dump macros before adding the force includes to the command line.

llvm-svn: 302421
2017-05-08 13:15:22 +00:00
Eric Fiselier c2d3f4c604 Fix Windows locale detection
llvm-svn: 302396
2017-05-08 02:09:48 +00:00
Eric Fiselier ef40748260 Fix shared_mutex dll import errors on Windows
llvm-svn: 302394
2017-05-08 01:31:50 +00:00
Eric Fiselier 3e254a6ece [libc++] Implement exception_ptr on Windows
Summary:
This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC.

The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well.

Note there are still 2 outstanding exception_ptr/nested_exception test failures.

* `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time.
* `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion.

This patch also gets most of the `<future>` tests passing as well.

Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D32927

llvm-svn: 302393
2017-05-08 01:17:50 +00:00
Eric Fiselier 6d0dff294c Fix DLL import/export on Win32 locale helpers
llvm-svn: 302391
2017-05-08 00:37:31 +00:00
Eric Fiselier c04013f5f4 Fix DLL import for __time_get_c_storage member functions.
llvm-svn: 302390
2017-05-08 00:29:32 +00:00
Eric Fiselier 10cb6ca12b Revert "Actually remove the MSVC STL when linking and testing libc++ on Windows"
This reverts commit r302387.

llvm-svn: 302389
2017-05-07 23:37:38 +00:00
Eric Fiselier ca40e602bf Actually remove the MSVC STL when linking and testing libc++ on Windows
llvm-svn: 302387
2017-05-07 23:19:14 +00:00
Eric Fiselier cedc1ec3dc Temporarly XFAIL aligned new/delete tests on Windows.
Libc++ doesn't provide its own definitions of new/delete on Windows,
instead using the versions provided by VCRuntime. However VCRuntime
does not yet implement aligned new/delete so these tests fail.

It might be possible for libc++ to provide its own definitions only
for aligned new/delete as long as MSVC doesn't provide it. However
before this can be done libc++ needs to figure out how to implement
std::get_new_handler.

llvm-svn: 302384
2017-05-07 22:10:56 +00:00
Eric Fiselier ea9dc4ae60 Fix Windows test failures caused by identical temp file names.
This patch fixes test failures that occur on Windows because
the tests attempt to generate two distinct temp file names but
get the same name both time.

The fix for this is to create the first temp file before requesting
a second temporary file name. This ensures that the second name
will be unique.

llvm-svn: 302382
2017-05-07 21:41:58 +00:00
Eric Fiselier 07c955c6ed Accept Windows specific output in system error tests
llvm-svn: 302381
2017-05-07 21:21:07 +00:00
Eric Fiselier fc353da22e Fix two test failures caused by Windows mangling of function types.
On Windows the function template `template <class T> void test()` has
the same mangled name when instantiated with the distinct types `void()`
and `void() noexcept`. When this occurs Clang emits an error. This error
was causing two type-traits tests to fail.

However this can be worked around by using class templates instead of
function templates, which is what this patch does to fix the errors.

llvm-svn: 302380
2017-05-07 21:15:28 +00:00
Dimitry Andric 52844c83d0 Ensure showbase does not overflow do_put buffers
Summary:
In https://bugs.freebsd.org/207918, Daniel McRobb describes how using
std::showbase with ostreams can cause truncation of unsigned long long
when output format is octal.  In fact, this can even happen with
unsigned int and unsigned long.

To ensure this does not happen, add one additional character to the
do_put buffers if std::showbase is on.  Also add a test case.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits, emaste

Differential Revision: https://reviews.llvm.org/D32670

llvm-svn: 302362
2017-05-06 20:58:50 +00:00
Eric Fiselier 28d89dbd3f Fix lgamma_r linking errors on Windows. It appears the normal lgamma function is thread safe anyway
llvm-svn: 302330
2017-05-06 02:58:43 +00:00
Stephan T. Lavavej e803cc52bd [libcxx] [test] Suppress MSVC's /analyze warning C6294 in a more fine-grained manner.
Fixes D32926.

llvm-svn: 302325
2017-05-05 23:51:39 +00:00
Stephan T. Lavavej a807f5cd62 [libcxx] [test] Fix MSVC "warning C6326: Potential comparison of a constant with another constant".
The expressions `1 == 1` and `true` have the same type, value category, and value.

Fixes D32924.

llvm-svn: 302322
2017-05-05 23:38:24 +00:00
Stephan T. Lavavej 40608ce4c9 [libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't be mandated".
In C++17, these iterators are allowed but not required
to inherit from the deprecated std::iterator base class.

Fixes D32727.

llvm-svn: 302318
2017-05-05 23:01:38 +00:00
Eric Fiselier 8f8241e5c7 Mark test using <sys/time.h> as UNSUPPORTED on Windows
llvm-svn: 302298
2017-05-05 21:32:37 +00:00
Eric Fiselier 0be6d5ba92 Fix condition_variable::wait_until and wait_for on Windows.
The ERROR_TIMEDOUT returned by the Windows API does not
have the same value as ETIMEDOUT. This caused condition_variable
to return timeouts as unknown errors.

llvm-svn: 302297
2017-05-05 21:31:22 +00:00
Eric Fiselier 1a5733af6a Fix detection for [[fallthrough]] with GCC
llvm-svn: 302285
2017-05-05 20:50:24 +00:00
Eric Fiselier f7ae14dbb9 Fix remaining GCC 7 build warnings
llvm-svn: 302283
2017-05-05 20:39:03 +00:00