Language level control in code is error prone
まだ誰も着手していません。
評価
調査の方向性
Start in include/boost/wave/language_support.hpp, where need_cppXX and the BOOST_WAVE_SUPPORT_CPPXX macros live, then search the tree for chained need_cppXX() || ... sites and macro-gated branches. The issue asks for a design decision first: whether to add need_at_least_cppXX only or also make language_support.hpp support all versions. Done means the agreed API is implemented and affected version checks are converted, with Wave preprocessing tests passing.
索引モデルが issue の本文から書いたものです。
説明
This issue has multiple aspects. I will gather them here since they are semantically connected.
The problem
Brittle boost::wave::need_cppXX(..) usage
The need_cppXX() functions return true for exactly the chosen language version. Consequently, all places wanting a branch being active for version XX and following have to do need_cppXX() || need_cppYY() || need_cppZZ() || ... Besides being suboptimal code code readability, it is also easy to forget extending one of those constructs when adding a language version.
In my recent contributions I found such an existing bug by chance.
Managing the C++ language version in 2 ways with the programmatic API and the BOOST_WAVE_SUPPORT_CPPXX macros
Code readability and maintaining suffer in my opinion due to those constructs all over the plase:
#if BOOST_WAVE_SUPPORT_CPPXX != 0
// Do something requiring at least version XX
#endif
#if BOOST_WAVE_SUPPORT_CPPYY != 0
// Do something requiring at least version YY
#endif
Proposal
Better express desired logic for "active starting from C++ version XX"
Introduce functions boost::wave::need_at_least_cppXX(..):
- Those are always true given the user chooses a language version >= XX. Those would allow replacing all the or chaining cases with a single expressive function.
- Maybe we can even remove the
need_cppXXfunctions. I can't think of a proper use case for them. This is optional. If there are use cases I do not see right now, they can also stay.
include/boost/wave/language_support.hpp always supports all C++ versions independent of BOOST_WAVE_SUPPORT_CPPXX macros
The only reason for the BOOST_WAVE_SUPPORT_CPPXX I can think of is performance optimization. This does in my opinion not really matter for what happens in include/boost/wave/language_support.hpp.
Having the enum and selection/check functions for all C++ versions and features always available is the precondition for at some point writing code no longer using the BOOST_WAVE_SUPPORT_CPPXX macros pattern.
This part of the proposal can be rejected and we can still implement need_at_least_cppXX(..). But we should decide first, as both parts of the proposal touch include/boost/wave/language_support.hpp.
- 主要言語
- C++
- スター
- 28
- フォーク
- 56
- 平均マージ
- 16時間 59分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/wave のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
Is it possible? Dumping preprocessor state at end of output so that preprocessing can be resumed?オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
似ている issue
-
agent:WSL code-review linux pri:medium refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
kind/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
psi29a/d2decomped#691 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CachyOS/packageinstaller#144 ·
メンテナーはふだん 1 日以内に返信
-
(S1 - Need confirmation)
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CleverRaven/Cataclysm-DDA#89715 ·
メンテナーはふだん 1 日以内に返信