https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61803
Bug ID: 61803 Summary: error reports macro location first, but should not Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tromey at gcc dot gnu.org This is not really a C-specific bug but I wasn't sure where else to file it. Consider this source: #define Nil ((int *) 0) double *fun(void) { return Nil; } Now compile: barimba. gcc --syntax-only q.c q.c: In function ‘fun’: q.c:1:13: warning: return from incompatible pointer type [-Wincompatible-pointer-types] #define Nil ((int *) 0) ^ q.c:5:10: note: in expansion of macro ‘Nil’ return Nil; ^ I think the "warning" and the "note" should be switched here. Some tools -- e.g., emacs -- prioritize different output from the compiler differently. By default emacs' next-error will take one to the errors and warnings, but skip the "note"s. This seems reasonable enough to me. However, for the above output, this means skipping the spot that is probably the cause of the error. I think instead it would be better to emit the warning at the "final" location and then print the macro definition information as notes.