[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rmaprath added a comment. On the other hand, disabling `` would mean disabling some parts of the library as well (in this case, `std::promise::set_exception`). Perhaps that's a bad path to follow. Not sure. Repository: rL LLVM https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rmaprath added a comment. In https://reviews.llvm.org/D26458#594069, @EricWF wrote: > There are cases where it is useful to be able to name `std::nested_exception` > while exceptions are disabled. I was thinking about the opposite. That is, we might want to consider disabling the `` header altogether when compiling with `-fno-exceptions`. My particular use case is to do with futures: void make_hello(std::promise &p, bool set_exception) { if (set_exception) p.set_exception(std::make_exception_ptr( std::runtime_error {"No hellos left."})); else p.set_value("Hello world!"); } This will compile fine with `-fno-exceptions` and when the client thread attempts to read from the promise, whole program would crash. May be they deserve it, but I feel like it's something we can help with; if we disable the `` header, this code wouldn't compile under `-fno-exceptions`. In what cases do we need to allow various exception types under `-fno-exceptions`? Cheers, / Asiri Repository: rL LLVM https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
This revision was automatically updated to reflect the committed changes. Closed by commit rL286813: Protect nested-exceptions tests under no-exceptions (authored by rogfer01). Changed prior to commit: https://reviews.llvm.org/D26458?vs=77363&id=77782#toc Repository: rL LLVM https://reviews.llvm.org/D26458 Files: libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Index: libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp === --- libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp +++ libcxx/trunk/test/std/language.support/support.exception/except.nested/assign.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -34,6 +35,7 @@ e = e0; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -57,4 +59,5 @@ } } } +#endif } Index: libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp === --- libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp +++ libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -33,6 +34,7 @@ std::nested_exception e = e0; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -55,4 +57,5 @@ } } } +#endif } Index: libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp === --- libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp +++ libcxx/trunk/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -32,6 +33,7 @@ std::nested_exception e; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -53,4 +55,5 @@ } } } +#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. In https://reviews.llvm.org/D26458#590865, @rmaprath wrote: > Not sure if either of these tests add much value to the no-exceptions > variant, using `std::nested_exception` with such a library seem pointless to > me. Perhaps marking these as `UNSUPPORTED` is a better fix? There are cases where it is useful to be able to name `std::nested_exception` while exceptions are disabled. I agree with @rogfer01 on this patch. https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rogfer01 added a comment. @rmaprath well each case is testing a different special member: the assignment operator, the copy constructor and the default constructor. My feeling is that at least the non-throwing part must be tested under no-exceptions. But I understand, that this class is probably useless in the context of no-exceptions. https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rmaprath added a comment. In https://reviews.llvm.org/D26458#590865, @rmaprath wrote: > Not sure if either of these tests add much value to the no-exceptions > variant, using `std::nested_exception` with such a library seem pointless to > me. Perhaps marking these as `UNSUPPORTED` is a better fix? Also, it seems like we are saving the same assert in all the three tests. If we want to save it that badly, perhaps creating a new test case with a `REQUIRES: libcpp-no-exceptions` is a better fix. https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rmaprath added a comment. Not sure if either of these tests add much value to the no-exceptions variant, using `std::nested_exception` with such a library seem pointless to me. Perhaps marking these as `UNSUPPORTED` is a better fix? https://reviews.llvm.org/D26458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26458: Protect nested-exceptions tests under no-exceptions
rogfer01 created this revision. rogfer01 added reviewers: mclow.lists, EricWF, rmaprath. rogfer01 added a subscriber: cfe-commits. Skip tests that expect an exception be thrown. https://reviews.llvm.org/D26458 Files: test/std/language.support/support.exception/except.nested/assign.pass.cpp test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Index: test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp === --- test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp +++ test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -32,6 +33,7 @@ std::nested_exception e; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -53,4 +55,5 @@ } } } +#endif } Index: test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp === --- test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp +++ test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -33,6 +34,7 @@ std::nested_exception e = e0; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -55,4 +57,5 @@ } } } +#endif } Index: test/std/language.support/support.exception/except.nested/assign.pass.cpp === --- test/std/language.support/support.exception/except.nested/assign.pass.cpp +++ test/std/language.support/support.exception/except.nested/assign.pass.cpp @@ -7,7 +7,6 @@ // //===--===// -// XFAIL: libcpp-no-exceptions // // class nested_exception; @@ -17,6 +16,8 @@ #include #include +#include "test_macros.h" + class A { int data_; @@ -34,6 +35,7 @@ e = e0; assert(e.nested_ptr() == nullptr); } +#ifndef TEST_HAS_NO_EXCEPTIONS { try { @@ -57,4 +59,5 @@ } } } +#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits