Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

context::set_language does not correctly set __cplusplus

Đang mở
#263 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

@martis42 đang làm issue này rồi.

Từ ngày 27/9/2026.

  • #264 của @martis42 — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
56/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
compilers

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C++
Star
29
Fork
56
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của boostorg/wave

Tất cả issue của boostorg/wave

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.