You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
context::set_language does not correctly set __cplusplus #263
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_cpp14boost::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.
Update: the c++14 thing may be challenging, as we would need to separate out the associated features, which are currently lumped either under C++11 or 17, I can't remember which
Update: the c++14 thing may be challenging, as we would need to separate out the associated features, which are currently lumped either under C++11 or 17, I can't remember which
I believe The C++14 mode can be with respect to the associated features be a copy of C++11. It seems to me, C++14 simply did not ad new things to the language on preprocessor level. The things wave associates with C++11 and C++17 are correctly associated:
Officially supporting files with a missing new-line at the end as added with C++11
Activity
jefftrull commentedon Sep 26, 2026
That sounds very reasonable and I would welcome a PR. Thanks!
jefftrull commentedon Sep 26, 2026
Update: the c++14 thing may be challenging, as we would need to separate out the associated features, which are currently lumped either under C++11 or 17, I can't remember which
martis42 commentedon Sep 27, 2026
I believe The C++14 mode can be with respect to the associated features be a copy of C++11. It seems to me, C++14 simply did not ad new things to the language on preprocessor level. The things wave associates with C++11 and C++17 are correctly associated:
has_includewas added with C++17jefftrull commentedon Sep 28, 2026
See also #184