Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

context::set_language does not correctly set __cplusplus

未关闭
#263 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@martis42 已经在做这个了。

开始于 2026年9月27日。

  • #264 来自 @martis42 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp
领域
compilers

调研方向

Start by locating context::set_language and the boost:👋:language_support definitions, then inspect how each language mode assigns __cplusplus. Compare the existing values with the documented C++ standard values in the linked reference. Done means released C++ versions have dedicated support_cppXX values and preprocessing reports the corresponding __cplusplus value.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
29
派生
56
平均合并
3 天 23 小时
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

boostorg/wave 的其他 Issue

查看 boostorg/wave 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。