driver: suggest the closest warning for an unknown -W name
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Read the unknown warning handling in src/driver/main.c around lines 7625 and 7729, then inspect warning enumeration in src/driver/diag.c and edit_distance() in src/sema/sema.c. Start with tests/golden/driver-wp.sh to see the current output. Add close and distant typo cases; done means the three specified misspellings suggest unused-variable, distant names get no suggestion, and the tests pass.
索引モデルが issue の本文から書いたものです。
説明
Context. A misspelled warning is reported, but EmbCC does not say what was probably meant:
$ ./embcc -Wunused-vairable -c t.c
embcc: warning: -Wunused-vairable is not a warning EmbCC has, so it turns nothing on (--help-warnings lists them)
It should add did you mean -Wunused-variable?.
Where.
src/driver/main.c, around line 7729, where a-Wor-Wno-name is looked up. Near line 7625 there is a second message of the same kind, for-Werror=NAME("names no warning EmbCC has"); give it the suggestion too.src/driver/diag.c, line 1068:diag_warning_count()anddiag_warning_name(i)list every warning name.src/sema/sema.c, line 2108:edit_distance(). It isstatic; share it with the driver instead of copying it. Another good first issue moves the same function, for--target=; whichever lands first, the other reuses it.- Tests:
tests/golden/driver-wp.shchecks the current message.
Steps.
- For an unknown name, find the closest
diag_warning_name(i). Suggest it only if it is withinmax(2, len / 3)edits. - Add the suggestion to the warning, keeping the existing wording, so scripts that grep for it still match.
- Add cases to the test: one with a close typo, and one with a name far from every warning.
Done when -Wunused-vairable, -Wno-unused-vairable and -Werror=unused-vairable all suggest unused-variable, a far-off name suggests nothing, and the tests pass.
Before you start: the contributor's guide has the rules. A new test counts only after it has failed against the code before your change, and a commit subject reads area: summary. Questions are welcome in the comments or in Discussions.
- 主要言語
- C
- スター
- 1
- フォーク
- 2
- 平均マージ
- 20時間 55分
- マージ済み PR(30日)
- 73
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
EmbLinkOs/EmbCC のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
メンテナーはふだん 1 日以内に返信
EmbLinkOs/EmbCC の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area: test kind: bug preview-effort: small priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
libsdl-org/SDL#16684 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
Issue-Bug Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信