Commit edad96f
util/attributes: error on malformed #[link_section] input
Emit a diagnostic when #[link_section] is used without arguments on
functions or static items, matching rustc behavior. This prevents
silent acceptance of empty attributes and provides a helpful
diagnostic that shows the expected form.
Fixes #4229
gcc/rust/ChangeLog:
* util/rust-attributes.cc (check_link_section_attribute): New helper.
(AttributeChecker::visit): Check link_section on functions and statics.
gcc/testsuite/ChangeLog:
* rust/compile/link_section-malformed.rs: New test.
Signed-off-by: Jayant Chauhan <[email protected]>1 parent a1ee38a commit edad96f
File tree
2 files changed
+31
-0
lines changed- gcc
- rust/util
- testsuite/rust/compile
2 files changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
436 | 448 | | |
437 | 449 | | |
438 | 450 | | |
| |||
896 | 908 | | |
897 | 909 | | |
898 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
899 | 915 | | |
| 916 | + | |
900 | 917 | | |
901 | 918 | | |
902 | 919 | | |
| |||
958 | 975 | | |
959 | 976 | | |
960 | 977 | | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
961 | 987 | | |
962 | 988 | | |
963 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments