224 Commits

Author SHA1 Message Date
Richard Smith
b3b00818e5 Fix use of libc++ <foo.h> headers from within an 'extern "C"' context in C++98.
Previously, this resulted in us declaring a template for static_assert emulation within the 'extern "C"' context, which is ill-formed.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 23:12:22 +00:00
Eric Fiselier
42b89c7e05 Revert r249931 - Remove same_decls.pass.cpp because it fails on OS X and in C++03 mode.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249938 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 03:31:23 +00:00
Eric Fiselier
ea33904773 Get some of wchar_h.pass.cpp working on apple.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 02:54:41 +00:00
Richard Smith
de66c515de Unrevert r249889, and XFAIL the test for Darwin, where the libc apparently doesn't provide a correct overload set for some functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249932 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 01:39:51 +00:00
Richard Smith
8b7a6b8995 Add a test that we declare the right set of C library function signatures in ::
and std::, and that the names in :: and std:: are declaring the same entity.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249931 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 01:33:17 +00:00
Manman Ren
e35e663f73 Revert r249889 due to bot failure.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-10 01:03:55 +00:00
Richard Smith
26a70eccf2 Split <wchar.h> out of <cwchar>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249889 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 19:56:37 +00:00
Richard Smith
f650ea7131 Split <stdlib.h> out of <cstdlib>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249800 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 01:41:45 +00:00
Richard Smith
ff7ba4da7d Split <stdio.h> out of <cstdio>.
As with <stddef.h>, skip our custom header if __need_FILE or __need___FILE is defined.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 01:29:09 +00:00
Richard Smith
1883b40a07 Fix test failure in C++98 mode due to imperfect static_assert emulation.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249780 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 23:44:26 +00:00
Richard Smith
759cd0e86b Split <stddef.h> out of <cstddef>.
There are a bunch of macros (__need_size_t etc) that request just one piece of
<stddef.h>; if any one of these is defined, we just directly include the
underlying header.

Note that <stddef.h> provides a ::nullptr_t. We don't want that available to
includers of <cstddef>, so instead of following the usual pattern where <cfoo>
includes <foo.h> then pulls things from :: into std:: with using-declarations,
we implement <stddef.h> and <cstddef> separately; both include <__nullptr> for
the definition of std::nullptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 22:25:27 +00:00
Richard Smith
ddbf08114a Split <setjmp.h> out of <csetjmp>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249743 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 20:41:26 +00:00
Richard Smith
4faa3944c6 Split <math.h> out of <cmath>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 20:40:34 +00:00
Richard Smith
325c37a20f Split <inttypes.h> out of <cinttypes>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249741 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 20:38:53 +00:00
Richard Smith
ceeace9a60 Split <ctype.h> out of <cctype>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 20:36:30 +00:00
Marshall Clow
a09319b898 While researching LWG#2244, I noticed we weren't testing that eofbit was being cleared. Now we are
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-07 19:41:24 +00:00
Marshall Clow
ba4775171e Fixed a possible overflow in a test of allocator::max_size().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 20:50:25 +00:00
Marshall Clow
7ed093bde7 Implement LWG#2063, and update the issues links to point to the github generated pages
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 16:17:34 +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
9698ac5a68 Manually suppress -Wnonnull when it occurs in an unevaluated context
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 07:41:07 +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
Marshall Clow
bf94e48216 The test I cnecked in to check the fix for PR#24890 failed (as expected) w/o the fix, but for the wrong reason. Now it fails for the right reason.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248307 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 18:09:13 +00:00
Marshall Clow
842e3f6f51 Check in the test for PR#24890 that I forgot in previous commit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-22 17:57:41 +00:00
Marshall Clow
41a04d69c4 Suppress some warnings in the tests that snuck in. That 'tmpnam' is deprecated doesn't change the fact that we have to test it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@247704 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 17:12:49 +00:00
Marshall Clow
c2d317f1a2 Change initialization of mbstate_t objects in tests from '= {0}' to '= {}', which does the same thing, w/o having clang and gcc warn with -Wall.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@247695 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 14:46:03 +00:00
Marshall Clow
af9a44f256 Implementation of Boyer-Moore and Boyer-Moore-Horspool searchers for the LFTS.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@247036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 17:59:09 +00:00
Eric Fiselier
65a6f64221 make common_type SFINAE-friendly and support void. Patch from Agustin Berge.
This patch also fixes PR22135. (https://llvm.org/bugs/show_bug.cgi?id=22135)
See the review for more information: http://reviews.llvm.org/D6964


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 00:13:57 +00:00
Eric Fiselier
408369b7c9 Suppress clang warnings in some tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-30 22:04:20 +00:00
Eric Fiselier
9eddf6e1f5 Remove task to get C++03 tests passing from TODO.txt
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-30 17:58:50 +00:00
Eric Fiselier
87813277b3 Finally get the test suite passing in C++03!!
After months of work there are only 4 tests still failing in C++03.
This patch fixes those tests.

All of the libc++ builders should be green.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 05:46:17 +00:00
Eric Fiselier
ba3e81f6a8 Remove empty file that arcanist created
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246273 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 05:18:13 +00:00
Eric Fiselier
031a3d203a [libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03
Summary:
This patch marks *most* tests for `std::promise`, `std::future` and `std::shared_future` as unsupported in C++03. These tests fail in C++03 mode because they attempt to copy a `std::future` even though it is a `MoveOnly` type. AFAIK the missing move-semantics in `std::future` is the only reason these tests fail but without move semantics these classes are useless. For example even though `std::promise::set_value` and `std::promise::set_exception(...)` work in C++03 `std::promise` is still useless because we cannot call `std::promise::get_future(...)`.

It might be possible to hack `std::move(...)` like we do for `std::unique_ptr` to make the move semantics work but I don't think it is worth the effort. Instead I think we should leave the `<future>` header as-is and mark the failing tests as `UNSUPPORTED`. I don't believe there are any users of `std::future` or `std::promise` in C++03 because they are so unusable. Therefore I am not concerned about losing test coverage and possibly breaking users. However because there are still parts of `<future>` that work in C++03 it would be wrong to `#ifdef` out the entire header.

@mclow.lists Should we take further steps to prevent the use of `std::promise`, `std::future` and `std::shared_future` in C++03?


Note: This patch also cleans up the tests and converts them to use `support/test_allocator.h` instead of a duplicate class in `test/std/futures/test_allocator.h`.

Reviewers: mclow.lists

Subscribers: vsk, mclow.lists, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246271 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 05:06:04 +00:00
Eric Fiselier
f1626ad28d [libcxx] Rewrite C++03 __invoke.
Summary:
This patch rewrites the C++03 `__invoke` and related meta-programming. There are a number of major changes.

`__invoke` in C++03 now has a fallback overload for when the invoke expression is ill-formed (similar to C++11). This means that the `__invoke_return` traits will return `__nat` when `__invoke(...)` is ill formed. This would previously cause a compile error.

Bullets 1-4 of `__invoke` have been rewritten. In the old version `__invoke` had 32 overloads for bullets 1 and 2,
one for each possible cv-qualified function signature with arities 0-3. 64 overloads would be needed to support member functions
with varargs. Currently these overloads were fundamentally broken. An example overload looked like:
```
template <class Rp, class Tp, class T1, class A0>
Rp __invoke(Rp (Tp::*pm)(A0) const, T1&, A0&)
```
Because `A0` appeared in two different deducible contexts it would have to deduce to be an exact match or the overload
would be rejected. This is made even worse because `A0` appears without a reference qualifier in the member function signature
and with a reference qualifier as an `__invoke` parameter. This means that only member functions that took all
of their arguments by value could be matched.

One possible fix would be to make the second occurrence of `A0` appear in a non-deducible context. This way
any type convertible to `A0` could be passed as the first parameter. The benefit of this approach is that the
signature of the member function enforces the arity and types taken by the `__invoke` signature it generates. However
nothing in the `INVOKE` specification requires this behavior.

My solution is to use a `__invoke_enable_if<PM_Type, Tp>`  metafunction to selectively enable the `__invoke` overloads for bullets 1, 2, 3 and 4.  It uses `__member_function_traits` to inspect and extract the return type and class type of the pointer to member. Using `__member_function_traits` to inspect `PM_Type` also allows us to reduce the number of `__invoke` overloads from 32 to 8 and add
varargs support at the same time.

Because `__invoke_enable_if` knows the exact return type of `__invoke` for bullets 1-4 we no longer need to use `decltype(__invoke(...))` to
compute the return type in the `__invoke_return*` traits. This will reduce the problems caused by `#define decltype(X) __typeof__(X)` in C++03.

Tests for this change have already been committed. All tests in `test/std/utilities/function.objects` now pass in C++03, previously there were 20 failures.

Reviewers: K-ballo, howard.hinnant, mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246068 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 20:15:02 +00:00
Eric Fiselier
db8a5fd864 Refactor flaky shared_mutex tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 19:04:40 +00:00
Eric Fiselier
3dfc10d4b1 Remove XFAIL in test. The bug causing it has been fixed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 07:03:43 +00:00
Eric Fiselier
6d51f6c58c Mark test as XFAIL with MSAN until D12311 gets committed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245922 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 04:35:55 +00:00
Eric Fiselier
7bcd5704d9 Refactor and fix more flaky shared_mutex tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 01:28:52 +00:00
Eric Fiselier
4add27b763 Move test/std/utilities/date.time to proper stable name utilities/time/date.time
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245877 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 21:27:25 +00:00
Jonathan Roelofs
5e91fa1eec Misc drive-by cleanups. NFC
http://reviews.llvm.org/D12294


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245876 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 21:20:07 +00:00
Marshall Clow
70e8f59884 Fix a crasher found by libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245849 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24 15:57:09 +00:00
Eric Fiselier
bb2f28e15d Recommit rL245802: Cleanup fancy pointer rebinding in list using __rebind_pointer.
Currently we need an #ifdef branch every time we use pointer traits to rebind a pointer because
it is done differently in C++11 and C++03. This patch introduces the __rebind_pointer utility to
clean this up.

Also add a test that list and it's iterators can be instantiated with incomplete element types.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-23 02:56:05 +00:00
Eric Fiselier
a73d0926fc Refactor shared_timed_mutex tests.
First I removed all of the uses of _LIBCPP_STD_VER and added LIT UNSUPPORTED tags to prevent the tests from being run in older standard dialects.
Second I increased the time tolerances used in some tests when testing with Thread Sanitizer because thread sanitizer make these tests take longer.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245793 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 21:24:01 +00:00
Eric Fiselier
3d46eb0f6d Fix a typo: abreviated -> abbreviated - Patch from Kai Zhao
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245538 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 05:20:29 +00:00
Eric Fiselier
66d7d70263 Cleanup unique_ptr failure tests and convert them to Clang verify
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 01:08:03 +00:00
Eric Fiselier
f4d8ff9d93 Add files that got missed in r245512.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:35:56 +00:00
Eric Fiselier
672575dadc More unique_ptr test cleanup. Fixes in <memory> to come later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245512 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 22:35:07 +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
35a6c564bf Use TestAtomic instead of std::atomic so the test can run in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245415 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 05:00:36 +00:00
Eric Fiselier
faa9a31aef Mark std::packaged_task tests as unsupported in C++03.
std::packaged_task requires variadic templates and is #ifdef out in C++03.
This patch silences the tests in C++03. This patch also rewrites the .fail.cpp tests so that they use clang verify.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245413 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 04:10:15 +00:00