This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/61803] New: error reports macro location first, but should not
- From: "tromey at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 14 Jul 2014 16:00:35 +0000
- Subject: [Bug c/61803] New: error reports macro location first, but should not
- Auto-submitted: auto-generated
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.