Re: [boost] [Boost.Config] Detect compiler support for std::current_exception
Hi all,
I'm working on a Boost.Exception issue [1] and I need to detect compiler support of std::current_exception. In the issue there is a suggestion to use #if __cplusplus > 199711L but that does not work for my use case (VS2015 reports __cplusplus = 199711L).
MSVC defines _MSVC_LANG for this[1]. At least, it used to. However, it would be cleaner to have a dedicated macro in Boost.Config for this.
Totally agree.
Is it possible to add a config macro for this? Or is there a good enough existing macro I can use?
I don't think there is. Something like BOOST_NO_CXX11_HDR_EXCEPTION would be useful.
I would need to detect support for std::current_exception, not the presence of header <exception>, so I would think that BOOST_NO_CXX11_CURRENT_EXCEPTION is what I need, right?
BOOST_NO_CXX11_HDR_EXCEPTION, as all BOOST_NO_CXX11_HDR_* macros, detect that the header not only exists, but is usable and contains all major components described by the standard. In case of BOOST_NO_CXX11_HDR_EXCEPTION, that would mean std::exception_ptr, std::current_exception, std::rethrow_exception, std::make_exception_ptr, etc. You need at least std::exception_ptr and std::current_exception.
Thanks, that makes sense!
Should I open an issue in github for Boost.Config?
Yes, or better yet - make a PR.
Added github Issue #284 [1], I'll try to come up with a PR. Wondering how deep the rabbit hole goes... ^_^ Regards [1] https://github.com/boostorg/config/issues/284
Hi all,
I'm working on a Boost.Exception issue [1] and I need to detect
compiler
support of std::current_exception. In the issue there is a suggestion to use #if __cplusplus > 199711L but that does not work for my use case (VS2015 reports __cplusplus = 199711L).
MSVC defines _MSVC_LANG for this[1]. At least, it used to. However, it would be cleaner to have a dedicated macro in Boost.Config for this.
Totally agree.
Is it possible to add a config macro for this? Or is there a good enough existing macro I can use?
I don't think there is. Something like BOOST_NO_CXX11_HDR_EXCEPTION would be useful.
I would need to detect support for std::current_exception, not the presence of header <exception>, so I would think that BOOST_NO_CXX11_CURRENT_EXCEPTION is what I need, right?
BOOST_NO_CXX11_HDR_EXCEPTION, as all BOOST_NO_CXX11_HDR_* macros, detect that the header not only exists, but is usable and contains all major components described by the standard. In case of BOOST_NO_CXX11_HDR_EXCEPTION, that would mean std::exception_ptr, std::current_exception, std::rethrow_exception, std::make_exception_ptr, etc. You need at least std::exception_ptr and std::current_exception.
Thanks, that makes sense!
Should I open an issue in github for Boost.Config?
Yes, or better yet - make a PR.
Added github Issue #284 [1], I'll try to come up with a PR.
Wondering how deep the rabbit hole goes... ^_^ Regards
Hi all, I've added these files to my local boost/config repo, following the example set by other tests: test/boost_no_cxx11_hdr_exception.ipp test/no_cxx11_hdr_exception_fail.cpp test/no_cxx11_hdr_exception_pass.cpp Now I can see a lot of automatically generated files with no instructions to generate them! Are there instructions for developers that I've missed? I've tried several things, and luckily this seems to do something: cd path/to/libs/config/tools ..\..\..\b2.exe toolset=msvc-14.0 and indeed I can see many files being changed, although most of them only the timestamp: "This file was automatically generated on..." Sorry if this is a stupid question, but, am I going in the right direction? Also, I was planning for a minimal PR, but I see dozens of files changed... How do I know which files I should commit and which are only noise? And last: should I ask these questions here or in the github issue? Thanks!
On 6/3/19 7:30 PM, dariomt--- via Boost wrote:
Hi all,
I've added these files to my local boost/config repo, following the example set by other tests: test/boost_no_cxx11_hdr_exception.ipp test/no_cxx11_hdr_exception_fail.cpp test/no_cxx11_hdr_exception_pass.cpp
Now I can see a lot of automatically generated files with no instructions to generate them! 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...
I've tried several things, and luckily this seems to do something: cd path/to/libs/config/tools ..\..\..\b2.exe toolset=msvc-14.0
and indeed I can see many files being changed, although most of them only the timestamp: "This file was automatically generated on..."
Sorry if this is a stupid question, but, am I going in the right direction? Also, I was planning for a minimal PR, but I see dozens of files changed... How do I know which files I should commit and which are only noise?
Boost.Config maintainer will probably respond, but you definitely need to commit the files you added or modified, including those two .cpp files created for your test.
And last: should I ask these questions here or in the github issue?
The mailing list usually gives wider exposure to questions. But you'll reach Boost.Config maintainer either way.
participants (2)
-
Andrey Semashev
-
dariomt@gmail.com