diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-05-08 01:17:50 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-05-08 01:17:50 +0000 |
commit | 3e254a6ece452fcaee6da4a7286245d0a9ef7c45 (patch) | |
tree | 41134395324ddff7bbf652472f84ce6ddb4fc5ce /libcxx/test/std/language.support/support.exception | |
parent | 90a8fc8cb837083fe379a4188bd9775c90af93b8 (diff) | |
download | bcm5719-llvm-3e254a6ece452fcaee6da4a7286245d0a9ef7c45.tar.gz bcm5719-llvm-3e254a6ece452fcaee6da4a7286245d0a9ef7c45.zip |
[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
Diffstat (limited to 'libcxx/test/std/language.support/support.exception')
10 files changed, 17 insertions, 27 deletions
diff --git a/libcxx/test/std/language.support/support.exception/except.nested/assign.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/assign.pass.cpp index ec5575d072c..6338c8aaa26 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/assign.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/assign.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // <exception> // class nested_exception; diff --git a/libcxx/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp index 92134c993af..4cbdbb2ec89 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // <exception> // class nested_exception; diff --git a/libcxx/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp index 8f8503b254d..18ca9968ff5 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // <exception> // class nested_exception; diff --git a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp index fe9cd6042ba..88e2253d08c 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp @@ -7,10 +7,11 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows +// UNSUPPORTED: libcpp-no-exceptions + +// This test fails due to a stack overflow // XFAIL: LIBCXX-WINDOWS-FIXME -// UNSUPPORTED: libcpp-no-exceptions // <exception> // class nested_exception; diff --git a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp index 73d02da3933..d511a72f9f5 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-no-exceptions // <exception> diff --git a/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp index 6353afcb239..6a9f25cd085 100644 --- a/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-no-exceptions // <exception> diff --git a/libcxx/test/std/language.support/support.exception/propagation/current_exception.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/current_exception.pass.cpp index 2046997774a..c33d64d06f0 100644 --- a/libcxx/test/std/language.support/support.exception/propagation/current_exception.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/propagation/current_exception.pass.cpp @@ -7,7 +7,8 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows +// This test needs to be rewritten for the Windows exception_ptr semantics +// which copy the exception each time the exception_ptr is copied. // XFAIL: LIBCXX-WINDOWS-FIXME // UNSUPPORTED: libcpp-no-exceptions diff --git a/libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp index 9621a736036..3aa8dcf55bb 100644 --- a/libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // <exception> // typedef unspecified exception_ptr; diff --git a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp index 4980c656b2b..35821d9bd1b 100644 --- a/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-no-exceptions // <exception> @@ -41,7 +38,12 @@ int main() } catch (const A& a) { +#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); +#else + // On Windows exception_ptr copies the exception + assert(A::constructed == 2); +#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -50,4 +52,5 @@ int main() } assert(A::constructed == 0); } + assert(A::constructed == 0); } diff --git a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp index 7d27eee6689..37ffb5be506 100644 --- a/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp @@ -7,9 +7,6 @@ // //===----------------------------------------------------------------------===// -// exception_ptr has not been implemented on Windows -// XFAIL: LIBCXX-WINDOWS-FIXME - // UNSUPPORTED: libcpp-no-exceptions // <exception> @@ -49,7 +46,12 @@ int main() } catch (const A& a) { +#ifndef _LIBCPP_ABI_MICROSOFT assert(A::constructed == 1); +#else + // On Windows the exception_ptr copies the exception + assert(A::constructed == 2); +#endif assert(p != nullptr); p = nullptr; assert(p == nullptr); @@ -58,4 +60,5 @@ int main() } assert(A::constructed == 0); } + assert(A::constructed == 0); } |