-
Notifications
You must be signed in to change notification settings - Fork 206
Improve attribute validation Rust-GCC/gccrs#4235 #4339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
e90e4de to
4d45489
Compare
|
(sorry for the ci spam 🙇 , my ChangeLog wasn't correctly formatted ; didn't realize there was a script to check in the contrib/ + all the gnu specific stuff until it was too late. I'll probably make a pr to add a few words about that to Contributing.md once this is done, to help out the next person) anyway, thanks a lot to whomever reviews this 👍 |
| @@ -0,0 +1,2 @@ | |||
| #[target_feature] // { dg-error "the ...target_feature.. attribute may only be applied to functions" } | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to change that attribute to something like #[target_feature(enable = "")] otherwise a second error will get thrown and won't be matched, the CI will complain about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely right, sorry about that ; silly oversight on my part.
changes are up and CI looks green.
P-E-P
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
|
@sqrtM Would you please rebase your branch on top of master ? I really like your changes and would like to merge them |
|
absolutely. I'll get on that as soon as I can this week. Unfortunately, all my tests are failing after the rebase ; trying to figure out where that's coming from but I don't have any time left today to really crack into that. I'll see if I can't find some time to fix that up this weekend. thanks again |
fixes Rust-GCC#4235 gcc/rust/ChangeLog: * util/rust-attributes.cc: add new function to validate that an attribute is assigned to a valid item type gcc/testsuite/ChangeLog: * rust/compile/issue-4232.rs: update expected error to include the specific illegal attribute Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog: * util/rust-attributes.cc: factor out loops from several functions to prevent us from having to loop several times over the same attributes Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog: * util/rust-attributes.cc: remove loop helper functions * util/rust-attributes.h: remove function defs Signed-off-by: Mason Pike <[email protected]>
gcc/rust/ChangeLog: * util/rust-attributes.cc: add attributes to the __outer_attributes set. This prevents some inconsistent behavior, like: https://godbolt.org/z/Eq1GE7xxY Signed-off-by: Mason Pike <[email protected]>
Thank you for making Rust GCC better!
If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.
Here is a checklist to help you with your PR.
make check-rustpasses locallyclang-formatgcc/testsuite/rust/Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
Commit 1 Fixes #4235. Commit 4 also corrects an unrelated inconsistency with how create-level traits throw errors.
Commits 2+3 are a small refactor and not at all necessary for the correct functioning of the other commits. If they're not to anyone's liking they can be swiftly dropped 🙏 . I only added them because, in light of the changes made in commit 1, it seemed logical to drop the loops and their associated functions.
Thanks a bunch and happy holidays 🎉