Commit 5b9706f
util/attributes: error on malformed #[export_name] input
Emit a diagnostic when #[export_name] is used without arguments or
with invalid arguments (non-string literals). This prevents silent
failures or backend crashes when lowering the attribute to GIMPLE,
ensuring the attribute follows the expected form: #[export_name = name].
Fixes #4387
gcc/rust/ChangeLog:
* util/rust-attributes.cc (check_export_name_attribute): New helper.
(AttributeChecker::visit): Check export_name on functions.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4387.rs: New test.
Signed-off-by: Jayant Chauhan <[email protected]>1 parent 457a44e commit 5b9706f
File tree
2 files changed
+34
-0
lines changed- gcc
- rust/util
- testsuite/rust/compile
2 files changed
+34
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
449 | 468 | | |
450 | 469 | | |
451 | 470 | | |
| |||
906 | 925 | | |
907 | 926 | | |
908 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
909 | 932 | | |
910 | 933 | | |
911 | 934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments