driver: suggest the closest triple for an unknown --target=
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 1
- Fork
- 2
- Merge trung bình
- 20 giờ 55 phút
- Pull request đã merge (30 ngày)
- 73
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của EmbLinkOs/EmbCC
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của EmbLinkOs/EmbCC
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: test kind: bug preview-effort: small priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
libsdl-org/SDL#16684 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Issue-Bug Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày