-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
[Shaders] Disallow trailing commas in function declarations #87075
base: master
Are you sure you want to change the base?
Conversation
#ifdef DISABLE_DEPRECATED | ||
// Disallow trailing comma. | ||
if (tk.type == TK_PARENTHESIS_CLOSE) { | ||
_set_error(RTR("Expected a valid data type for argument.")); |
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.
Picked this error as it matches what happens if you do void foo(,)
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.
Would a more user-friendly error be better, though? E.g. "(Remove the trailing comma?)"
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.
Could add 🙂 considering a warning as well so working on the wording, thank you!
Tested and it doesn't look good and isn't noticeable, also feels like a bad idea to add a new warning category just for this to allow it to be configured well |
2d211f1
to
2c0abaf
Compare
2c0abaf
to
46e1b34
Compare
46e1b34
to
94165e5
Compare
94165e5
to
39acc83
Compare
39acc83
to
706b910
Compare
706b910
to
65ec7a0
Compare
65ec7a0
to
6b8c867
Compare
6b8c867
to
eec6ed5
Compare
328a4ae
to
22db465
Compare
Might not be the most elegant fix, but not very familiar with this code, if someone has a cleaner idea for doing this I'd appreciate suggestions. Added it with deprecation to avoid breaking existing shaders, though I'm not sure that's necessary
I was considering enclosing the whole
while
loop in a block to check closing paren at the start, which would make catching this easier, but want to avoid noise in the blame if I can, having to indent the whole thing.For reasoning, see the discussion in:
Alternative to: