Commit Graph

31 Commits

Author SHA1 Message Date
Eric Fiselier
0da4cb892b [libc++] Work around C1XX bug which breaks poisoned hash tests.
Summary: This is my attempt to work around the C1XX bug described to me by @BillyONeal.

Reviewers: BillyONeal, STL_MSFT, CaseyCarter

Reviewed By: BillyONeal

Subscribers: cfe-commits, BillyONeal

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298554 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 22:41:41 +00:00
Eric Fiselier
76880f55bf Fix DoNotOptimize on MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-11 00:07:08 +00:00
Eric Fiselier
25f28d0c9e Prevent UBSAN from generating unsigned overflow diagnostics in the hashing internals
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-08 00:10:10 +00:00
Eric Fiselier
478f902c62 Refactor unique_ptr/shared_ptr deleter test types into single header.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292577 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-20 04:39:17 +00:00
Eric Fiselier
50ca3248fb Use __is_identifier to detect Clang extensions instead of __has_extension.
When -pedantic-errors is specified `__has_extension(<feature>)` is always
false when it would otherwise be true. This causes C++03 <atomic> to break
along with other issues.

This patch avoids the above problem by using __is_identifier(...) instead since
it is not affected by -pedantic-errors. For example instead of checking for
__has_extension(c_atomics) we now check `!__is_identifier(_Atomic)`, which
is only true when _Atomic is not a keyword provided by the compiler.

This patch applies similar changes to the detection logic for __decltype and
__nullptr as well.

Note that it does not apply this change to the C++03
`static_assert` macro since -Wc11-extensions warnings generated by expanding
that macro will appear in user code, and will not be suppressed as part of a
system header.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291995 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-14 04:27:58 +00:00
Eric Fiselier
e5bca2ba66 Fix more uses of dynamic exception specifications in C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289356 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 02:47:36 +00:00
Stephan T. Lavavej
aa1d62b4af [libcxx] [test] Add LIBCPP_ASSERT_NOEXCEPT/LIBCPP_ASSERT_NOT_NOEXCEPT, remove an unused variable.
test/support/test_macros.h
For convenience/greppability, add macros for libcxx-specific static_asserts about noexceptness.

(Moving the definitions of ASSERT_NOEXCEPT/ASSERT_NOT_NOEXCEPT isn't technically necessary
because they're macros, but I think it's better style to define stuff before using it.)

test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp
There was a completely unused `TrackedCallable obj;`.

apply() isn't depicted with conditional noexcept in C++17.

test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp
Now that we have LIBCPP_ASSERT_NOEXCEPT, use it.

Fixes D27622.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289264 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-09 19:53:08 +00:00
Eric Fiselier
de8e3d3a4f Unbreak C++03 build
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 11:20:27 +00:00
Eric Fiselier
4775578c61 Remove usages of _ALIGNAS_TYPE
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 10:19:48 +00:00
Eric Fiselier
159b45f505 Fix nasty_containers.hpp for other stdlibs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283994 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 09:31:26 +00:00
Eric Fiselier
2c429bee79 Fix various issues in std::any and the related tests.
* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283606 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 21:27:45 +00:00
Eric Fiselier
8f972f6538 [libcxx] [test] Guard __has_include usage with a macro
Summary: There's a macro scheme already being used for __has_feature etc. Use it for __has_include too, which makes MSVC happy (it doesn't support __has_include yet, and unguarded use explodes horribly).

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283260 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 21:25:51 +00:00
Eric Fiselier
cdac787ae8 Replace test_throw.h header with a single test macro
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 10:34:13 +00:00
Eric Fiselier
4bc5e1f444 Fix bad locale test data when using the newest glibc
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280608 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-04 00:48:54 +00:00
Eric Fiselier
e739d54f86 [libcxx] Add std::any
Summary:
This patch adds std::any by moving/adapting <experimental/any>.

This patch also implements the std::any parts of p0032r3 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0032r3.pdf)
and LWG 2509 (http://cplusplus.github.io/LWG/lwg-defects.html#2509).

I plan to push it in a day or two if there are no comments.


Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 03:13:11 +00:00
Eric Fiselier
b5bdc070f2 Unbreak traits tests by handling differences between version macros in clang/apple-clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20 22:53:21 +00:00
Eric Fiselier
83d7ca9ea5 Implement P0163r0. Add shared_ptr::weak_type.
This patch adds the weak_type typedef in shared_ptr. It is available in
C++17 and newer.

This patch also updates the _LIBCPP_STD_VER and TEST_STD_VER macros to
have the value of 16, since 2016 is the current year.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 01:02:43 +00:00
Eric Fiselier
8c4dc32424 Add [[noreturn]] attribute to throw_bad_alloc_helper().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273819 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-26 19:42:59 +00:00
Eric Fiselier
cef97f9cc9 Use correct Clang feature names. I got them wrong in the previous commit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 05:40:17 +00:00
Eric Fiselier
8905b11d2d Support old GCC exception and rtti detection macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 05:33:52 +00:00
Eric Fiselier
5cdd5437e1 Fix exception/rtti detection in tests.
So the macros TEST_HAS_NO_EXCEPTIONS and TEST_HAS_NO_RTTI were always
getting defined because I spelt __cpp_exceptions and __cpp_rtti as
__cxx_exceptions and __cxx_rtti.

Tests incoming after this patch.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273381 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 05:03:10 +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
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
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
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
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
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
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
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
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
Eric Fiselier
8f1d85fde5 Add test macros header to remove dependance on __config macros.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-27 00:28:30 +00:00