driver: an unknown --opt= goal should name the valid goals
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读src/driver/main.c第8580行附近对--pass=/--no-pass=的处理,以及src/driver/options.def(第114–121行)中的--opt=条目。在tests/golden/options-table.sh或tests/golden/gcc-flags.sh中添加覆盖,检查无效目标会列出有效目标并省略用法文本。消息由选项表生成且测试通过时即完成。
由索引模型根据 Issue 内容生成。
描述
Context. --opt= takes a goal (none, basic, debug, speed, max, size, min-size). A wrong one gets a generic error and the whole usage text:
$ ./embcc --opt=sped -c t.c
embcc: error: unknown argument '--opt=sped'
usage: embcc [-c|-S|-E] SOURCE... [-o FILE] ...
--pass= already does better: embcc: error: --pass=X: no optimizer pass has that name; the passes are a, b and c. --opt= should do the same, and suggest the closest goal.
Where.
src/driver/main.c, around line 8580: the--pass=/--no-pass=branch, which is the pattern to follow. The genericunknown argumenterror comes right after it.src/driver/options.def, lines 114–121: the--opt=goals are entries in the option table, so the list does not need typing in again.- Tests:
tests/golden/options-table.shandtests/golden/gcc-flags.shalready check option errors.
Steps.
- When
opt_typed(argv[i])starts with--opt=and matched no entry, printembcc: error: --opt=sped: not a goal; the goals are none, basic, debug, speed, max, size and min-size. Build the list from the option table. - Optionally, add
did you mean --opt=speed?when one goal is close. - Add a test that checks the message, and that the usage text is no longer printed.
Done when an unknown --opt= names the valid goals, the list comes from options.def (adding a goal there updates the message), 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 分钟
- 30 天内合并 PR
- 73
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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
难度 4/5 3-5 天 新手友好度 50/100
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
相似的 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 天内回复