[libcxx] r333467 - Fix embarrasing typo in uncaught_exceptions. Update tests to really test this. Thanks to Peter Klotz for calling my attention to this.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue May 29 15:25:42 PDT 2018


Author: marshall
Date: Tue May 29 15:25:42 2018
New Revision: 333467

URL: http://llvm.org/viewvc/llvm-project?rev=333467&view=rev
Log:
Fix embarrasing typo in uncaught_exceptions. Update tests to really test this. Thanks to Peter Klotz for calling my attention to this.

Modified:
    libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
    libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp

Modified: libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp?rev=333467&r1=333466&r2=333467&view=diff
==============================================================================
--- libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp (original)
+++ libcxx/trunk/src/support/runtime/exception_libcxxabi.ipp Tue May 29 15:25:42 2018
@@ -18,7 +18,7 @@ bool uncaught_exception() _NOEXCEPT { re
 
 int uncaught_exceptions() _NOEXCEPT
 {
-# if _LIBCPPABI_VERSION > 1101
+# if _LIBCPPABI_VERSION > 1001
     return __cxa_uncaught_exceptions();
 # else
     return __cxa_uncaught_exception() ? 1 : 0;

Modified: libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp?rev=333467&r1=333466&r2=333467&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp Tue May 29 15:25:42 2018
@@ -15,40 +15,48 @@
 // XFAIL: availability=macosx10.9
 // XFAIL: availability=macosx10.10
 // XFAIL: availability=macosx10.11
+// XFAIL: with_system_cxx_lib=macosx10.12
+// XFAIL: with_system_cxx_lib=macosx10.13
 
 // test uncaught_exceptions
 
 #include <exception>
 #include <cassert>
 
-struct A
-{
-    ~A()
-    {
-        assert(std::uncaught_exceptions() > 0);
-    }
-};
+struct Uncaught {
+    Uncaught(int depth) : d_(depth) {}
+    ~Uncaught() { assert(std::uncaught_exceptions() == d_); }
+    int d_;
+    };
 
-struct B
-{
-    B()
-    {
-        // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#475
-        assert(std::uncaught_exceptions() == 0);
+struct Outer {
+    Outer(int depth) : d_(depth) {}
+    ~Outer() {
+    try {
+        assert(std::uncaught_exceptions() == d_);
+        Uncaught u(d_+1);
+        throw 2;
     }
+    catch (int) {}
+    }
+    int d_;
 };
 
-int main()
-{
-    try
+int main () {
+    assert(std::uncaught_exceptions() == 0);
     {
-        A a;
-        assert(std::uncaught_exceptions() == 0);
-        throw B();
+    Outer o(0);
     }
-    catch (...)
+    
+    assert(std::uncaught_exceptions() == 0);
     {
-        assert(std::uncaught_exception() == 0);
+    try {
+        Outer o(1);
+        throw 1;
+        }
+    catch (int) {
+        assert(std::uncaught_exceptions() == 0);
+        }   
     }
     assert(std::uncaught_exceptions() == 0);
 }




More information about the cfe-commits mailing list