Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use interprocess headers without exception handling #103

Closed
cngzhnp opened this issue Nov 18, 2019 · 2 comments
Closed

Use interprocess headers without exception handling #103

cngzhnp opened this issue Nov 18, 2019 · 2 comments

Comments

@cngzhnp
Copy link

cngzhnp commented Nov 18, 2019

Boost Version : 1.71

By default when try to add interprocess header files, exceptions are enabled by default and it cannot be disabled with any preprocessor or configuration.

In Boost, there is a preprocessor defined BOOST_NO_EXCEPTIONS which used in many other places. If user does not want to implement exception handling in their project and do not want to add flag like -fexceptions , it has to be configurable in one of the config files.

So, before adding <boost/interprocess/exceptions.hpp> header file in the interprocess component, it has to be checked before BOOST_NO_EXCEPTIONS was defined in config files.

I looked deeply a little bit more on implementation and there is an inconsistency between exception handling in interprocess files. In some of them, problem was solved by adding no_exceptions_support.hpp, please take a look on segment_manager.hpp

However, the other files has to be considered as well and common solution has to be used.

My proposal is, with checking BOOST_NO_EXCEPTIONS compiler has to choose which file is included (in this case <boost/interprocess/exceptions.hpp> and #include <boost/core/no_exceptions_support.hpp>).

Also default keywords ( try, catch, throw ) has to be replaced with corresponding preprocessor definitions such as ( BOOST_TRY, BOOST_CATCH, BOOST_RETHROW )

@raspopov
Copy link

Boost Version: 1.75
Compiled for embedded QNX 6.5 (GCC 4.3) without exceptions.

This issue requires just a straight and mechanical replacement of try, catch, throw to BOOST_TRY, BOOST_CATCH/BOOST_CATCH_END, BOOST_RETHROW/BOOST_THROW_EXCEPTION as mentioned author above and including a #include <boost/exception/all.hpp> (which is a good practice anyway) and #include <boost/core/no_exceptions_support.hpp> to the top of <boost/interprocess/exceptions.hpp>.

During adapting and compiling to QNX I done it but only for subset of used headers only, seems all works well.

@igaztanaga
Copy link
Member

Thanks for the report. As the request does not require a design change (just be able to include interprocess with no exceptions support, with no additional modifications to support alternative error mechanisms when exceptions are off) I've modified all headers to use <boost/core/no_exceptions_support.hpp>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants