[libcxx] r286809 - Protect smart-pointer tests under no exceptions

Roger Ferrer Ibanez via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 02:27:58 PST 2016


Author: rogfer01
Date: Mon Nov 14 04:27:56 2016
New Revision: 286809

URL: http://llvm.org/viewvc/llvm-project?rev=286809&view=rev
Log:
Protect smart-pointer tests under no exceptions

Skip tests that expect an exception be thrown under no-exceptions.

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


Modified:
    libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
    libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp

Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp?rev=286809&r1=286808&r2=286809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp Mon Nov 14 04:27:56 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // UNSUPPORTED: sanitizer-new-delete
 
 // <memory>
@@ -63,6 +62,7 @@ int main()
         assert(p.get() == raw_ptr);
         assert(ptr.get() == 0);
     }
+#ifndef TEST_HAS_NO_EXCEPTIONS
     assert(A::count == 0);
     {
         std::unique_ptr<A> ptr(new A);
@@ -86,6 +86,7 @@ int main()
 #endif
         }
     }
+#endif
     assert(A::count == 0);
     { // LWG 2399
         fn(std::unique_ptr<int>(new int));

Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp?rev=286809&r1=286808&r2=286809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/weak_ptr.pass.cpp Mon Nov 14 04:27:56 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <memory>
 
 // shared_ptr
@@ -17,6 +16,8 @@
 #include <memory>
 #include <cassert>
 
+#include "test_macros.h"
+
 struct B
 {
     static int count;
@@ -42,6 +43,7 @@ int A::count = 0;
 
 int main()
 {
+#ifndef TEST_HAS_NO_EXCEPTIONS
     {
         std::weak_ptr<A> wp;
         try
@@ -54,6 +56,7 @@ int main()
         }
         assert(A::count == 0);
     }
+#endif
     {
         std::shared_ptr<A> sp0(new A);
         std::weak_ptr<A> wp(sp0);
@@ -63,6 +66,7 @@ int main()
         assert(A::count == 1);
     }
     assert(A::count == 0);
+#ifndef TEST_HAS_NO_EXCEPTIONS
     {
         std::shared_ptr<A> sp0(new A);
         std::weak_ptr<A> wp(sp0);
@@ -77,4 +81,5 @@ int main()
         }
     }
     assert(A::count == 0);
+#endif
 }




More information about the cfe-commits mailing list