Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Getting PARSE_ERRORS in BOOST headers

LegacyForum Posts: 1,664 ✭✭
edited December 2016 in Insure++
If you are using Insure++ with a Microsoft C++ compiler and getting parse errors in BOOST header files that look like this:



anything containing BOOST_FUNCTION_COMMA
with or without

Then you are running into a configuration bug in the boost libraries. BOOST libraries try to automatically reconfigure on each compilation. It "notices" that an ISO-compliant parser, (the one in Insure++), is in use, and configures for that. But, since we are emulating the Microsoft compiler, (which is *not* ISO compliant). Therefore BOOST misconfigures.

There is an easy way around this bug in the BOOST headers:

Just add: " -DBOOST_PP_CONFIG_FLAGS()=BOOST_PP_CONFIG_MSVC()" (don't forget to include the quotes), to your compile commands. This simple incantation forces BOOST to use only the Microsoft semantics.

BOOST has been notified of the bug, and have fixed it in version 1.34 of BOOST. Therefore, the permanent fix is to use BOOST version 1.34 or later.

You can also custom modify the boost configuration files, (note these files are *intended* to be user-configurable).

Here is what boost_1_33_1/boost/preprocessor/config/config.hpp has:

# elif defined(__EDG__) || defined(__EDG_VERSION__) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT())
And corresponding boost_1_34_1:
# elif defined(__EDG__) || defined(__EDG_VERSION__) # if defined(_MSC_VER) && __EDG_VERSION__ >= 308 # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC()) # else # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) # endif
The solution is straight-forward. Find the config.hpp file, then find the lines above then make it the same as the version from 1.34. Once you have done that, these parse errors should just go away.