adek05 added a comment.
@aaron.ballman I think this could be hard to achieve without an extra note if
you have something like:
cat test2.c
int main() {
char *c = 'a';
char volatile** cc = &c;
cc = &c;
}
test2.c:2:15: warning: incompatible integer to pointer conversion
initializing 'char *' with an expression of type 'int' [-Wint-conversion]
char *c = 'a';
^ ~~~
test2.c:4:25: warning: initializing 'volatile char **' with an expression of
type 'char **' discards qualifiers in nested pointer types
[-Wincompatible-pointer-types-discards-qualifiers]
char volatile** cc = &c;
^ ~~
test2.c:4:9: note: nested pointer type with discarded 'const' qualifier
char volatile** cc = &c;
^~~~~~~~~~~~~~~~~~
test2.c:5:12: warning: assigning to 'volatile char **' from 'char **'
discards qualifiers in nested pointer types
[-Wincompatible-pointer-types-discards-qualifiers]
cc = &c;
^ ~~
3 warnings generated.
Sadly, my code doesn't print a note in the second case, which I would have to
debug. In case of initialization, I think we can just print one line and omit
note.
For assignment which is not an initialization, it might be useful to point to
the declaration of a variable which is assigned.
I will try to handle the second case and write tests for this. Let me know if
you feel like it is still worth proceeding.
http://reviews.llvm.org/D15486
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits