I am using wave as library in a tool which preprocesses C++ code to obtain some information and then lint it.
This requires preprocessing the code with a proper value for __cplusplus, as the code might use different #if .. branches depending on the value.
I know the C++ standard of the project. But I can't set __cplusplus myself because it is a special value which wave ignores when using the context::remove_macro_definition or context::add_macro_definition functions. This is fine, since the public API context::set_language exists.
However, I believe this API does not behave as expected:
boost::wave::language_support::support_cpp14 does not exists, thus one cannot set __cplusplus accordingly
boost::wave::language_support::support_cpp17 sets __cplusplus to 199711L, aka C++98
boost::wave::language_support::support_cpp23 sets __cplusplus to 199711L, aka C++98
boost::wave::language_support::support_cpp14 boost::wave::language_support::support_cpp26 does not exists, thus one cannot set __cplusplus accordingly. To be fair, C++26 is quite new and this point is more for completeness sake.
On the other hand, boost::wave::language_support::support_cpp, boost::wave::language_support::support_cpp11 and boost::wave::language_support::support_cpp20 cause __cplusplus to be set to the expected value.
I believe wave should offer a dedicated boost::wave::language_support::support_cppXX value for each released C++ version and set __cplusplus accordingly for preprocessing according to the values documented here
If you agree with the request I am happy to create a contribution for that.
I am using wave as library in a tool which preprocesses C++ code to obtain some information and then lint it.
This requires preprocessing the code with a proper value for
__cplusplus, as the code might use different#if ..branches depending on the value.I know the C++ standard of the project. But I can't set
__cplusplusmyself because it is a special value which wave ignores when using thecontext::remove_macro_definitionorcontext::add_macro_definitionfunctions. This is fine, since the public APIcontext::set_languageexists.However, I believe this API does not behave as expected:
boost::wave::language_support::support_cpp14does not exists, thus one cannot set__cplusplusaccordinglyboost::wave::language_support::support_cpp17sets__cplusplusto199711L, aka C++98boost::wave::language_support::support_cpp23sets__cplusplusto199711L, aka C++98boost::wave::language_support::support_cpp14boost::wave::language_support::support_cpp26does not exists, thus one cannot set__cplusplusaccordingly. To be fair, C++26 is quite new and this point is more for completeness sake.On the other hand,
boost::wave::language_support::support_cpp,boost::wave::language_support::support_cpp11andboost::wave::language_support::support_cpp20cause__cplusplusto be set to the expected value.I believe wave should offer a dedicated
boost::wave::language_support::support_cppXXvalue for each released C++ version and set__cplusplusaccordingly for preprocessing according to the values documented hereIf you agree with the request I am happy to create a contribution for that.