Re: [boost] [Boost.Config] Detect compiler support for std::current_exception
Are there instructions for developers that I've missed?
There are some instructions here:
https://www.boost.org/doc/libs/1_70_0/libs/config/doc/html/boost_config/guid...
Thanks!
I was expecting developer guidelines in the github readme, not in the actual library docs! doh! I have made a PR #285 and after some trial and error (I only have VS2015 and VS2017 available to test locally) I think I have something. However, in my test I throw and catch exceptions: int test() { std::exception_ptr ep; try { throw 42; } catch(...) { ep = std::current_exception(); } try { std::rethrow_exception(ep); } catch(int i) { // return zero on success return i == 42 ? 0 : 1; } return 1; } But the CI jobs have gcc and clang configured to compile without exception support! And I get errors like: libs/config/test/boost_no_cxx11_hdr_exception.ipp:22:5: error: cannot use 'throw' with exceptions disabled throw 42; ^ libs/config/test/boost_no_cxx11_hdr_exception.ipp:20:3: error: cannot use 'try' with exceptions disabled try ^ I have two questions: 1) Where are exceptions disabled in the CI jobs? I can't find it in the .travis.yml, but I can see e.g. clang being invoked with -fno-exceptions 2) How can I test proper support for std::current_exception() and std::rethrow_exception() if exceptions are disabled for the test? Thanks!
On 6/6/19 4:53 PM, dariomt--- via Boost wrote:
Are there instructions for developers that I've missed?
There are some instructions here:
https://www.boost.org/doc/libs/1_70_0/libs/config/doc/html/boost_config/guid...
Thanks!
I was expecting developer guidelines in the github readme, not in the actual library docs! doh!
I have made a PR #285 and after some trial and error (I only have VS2015 and VS2017 available to test locally) I think I have something.
However, in my test I throw and catch exceptions:
int test() { std::exception_ptr ep; try { throw 42; } catch(...) { ep = std::current_exception(); } try { std::rethrow_exception(ep); } catch(int i) { // return zero on success return i == 42 ? 0 : 1; } return 1; }
But the CI jobs have gcc and clang configured to compile without exception support! And I get errors like:
libs/config/test/boost_no_cxx11_hdr_exception.ipp:22:5: error: cannot use 'throw' with exceptions disabled throw 42; ^ libs/config/test/boost_no_cxx11_hdr_exception.ipp:20:3: error: cannot use 'try' with exceptions disabled try ^
I have two questions:
1) Where are exceptions disabled in the CI jobs? I can't find it in the .travis.yml, but I can see e.g. clang being invoked with -fno-exceptions
It's in the test/Jamfile.v2 file, look for <exception-handling>off.
2) How can I test proper support for std::current_exception() and std::rethrow_exception() if exceptions are disabled for the test?
You should probably condition your test on BOOST_NO_EXCEPTIONS and make the test no-op when exceptions are disabled.
participants (2)
-
Andrey Semashev
-
dariomt@gmail.com