-
Notifications
You must be signed in to change notification settings - Fork 56
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
Issue a warning on gnu void pointer arithmetic #776
Conversation
It's not a bad idea but we already have a specialized function for it; you can just use |
I agree. Implementation of such a function is out of this pull requests scope |
src/aro/Parser.zig
Outdated
@@ -5504,6 +5504,10 @@ pub const Result = struct { | |||
// if both aren't arithmetic then either both should be pointers or just a | |||
if (!a_ptr or !(b_ptr or b_int)) return a.invalidBinTy(tok, b, p); | |||
|
|||
if ((a.ty.isVoidStar() or b.ty.isVoidStar()) and | |||
(p.comp.diagnostics.options.@"gnu-pointer-arith" == .warning or p.comp.diagnostics.options.pedantic == .warning)) |
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.
The last condition here (p.comp.diagnostics.options.@"gnu-pointer-arith" == .warning or p.comp.diagnostics.options.pedantic == .warning)
is not needed - that is all checked in Diagnostics.add
via Diagnostics.tagKind
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.
done
We'll also need a check in the One final area to add the checks would be for |
done |
Closes #759
In this request I implemented the
Type.isPtrTo
function but only for the.pointer
type specifier. I'm not sure if it is right approach to do that. Maybe other specifiers should be considered as well. I'm open for the conversation.