driver: suggest the closest triple for an unknown --target=
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 85/100
Rechercherichtung
Read src/driver/main.c around the unknown-target error and src/sema/sema.c around edit_distance() to understand the existing suggestion logic. Share that helper for the driver, then update tests/golden/triple.sh to cover a one-letter typo and a distant target such as banana. Done when the typo suggests the closest built triple, the distant target gets no suggestion, and the listed checks pass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Context. A mistyped triple gets the whole list of targets EmbCC knows, with no hint about which one was meant:
$ ./embcc --target=thumbv7m-none-eab -c t.c
embcc: error: unknown target 'thumbv7m-none-eab'
embcc: the targets it emits for are:
embcc: x86_64-elf
...
clang and GCC users expect did you mean 'thumbv7m-none-eabi'?.
Where.
src/driver/main.c, around line 7091: theunknown targeterror, which walkstarget_triple_count()/target_triple_name().src/sema/sema.c, line 2108:edit_distance(), a bounded Levenshtein distance that already powers "did you mean" for undeclared names. It isstaticthere. Move it somewhere the driver can share (for examplesrc/driver/util.candutil.h), rather than copying it.- Tests:
tests/golden/triple.shalready checks the unknown-target error.
Steps.
- Make
edit_distanceshareable, and keep sema's use of it unchanged. - In the unknown-target branch, find the built triple (
target_triple_built(t)) closest to what was typed. If it is within a few edits (sema usesmax(2, len / 3)), printembcc: note: did you mean 'X'?before the list. - Add cases to
tests/golden/triple.sh: a one-letter typo gets the suggestion, and something far from every triple (--target=banana) gets none.
Done when --target=thumbv7m-none-eab suggests thumbv7m-none-eabi, a nonsense triple suggests nothing, the test covers both, and make check and sh tests/golden/triple.sh 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.
- Vorherrschende Sprache
- C
- Sterne
- 1
- Forks
- 2
- Ø Merge
- 20 Std. 55 Min.
- Gemergte PRs (30 T.)
- 73
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus EmbLinkOs/EmbCC
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
documentation good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 50/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in EmbLinkOs/EmbCC
Ähnliche Issues
-
bug game: 01008BA02525A000 ios
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
area/ysql kind/bug priority/medium status/awaiting-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
yugabyte/yugabyte-db#37523 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
ly05010419/MacNativeGames#2079 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
ChupathingyCE/chupathingyce#1020 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
regression Windows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
dosbox-staging/dosbox-staging#5163 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag