Commit Graph

4064 Commits

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