driver: an unknown --opt= goal should name the valid goals
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
Research direction
Read the --pass=/--no-pass= handling near line 8580 in src/driver/main.c and the --opt= entries in src/driver/options.def (lines 114–121). Add coverage in tests/golden/options-table.sh or tests/golden/gcc-flags.sh, checking that an invalid goal lists valid goals and omits usage text. Done when the message is generated from the option table and the tests pass.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C
- Stars
- 1
- Forks
- 2
- Avg merge
- 20h 55m
- Merged PRs (30d)
- 73
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EmbLinkOs/EmbCC
-
avr: errno does not link: __errno_location is not in the C libraryPossibly taken @Firat17aze claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 50/100
Maintainers usually reply within 1 day
-
avr: inline assembly with lo8()/hi8() cuts symbols longer than 16 charactersPossibly taken @Firat17aze claimed this today. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
SPIDevice selects an active-high device as soon as it is createdPossibly taken @mikeysklar claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
adafruit/circuitpython#11869 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
gnif/LookingGlass#1352 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100