This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR c++/13560 wrong file reported for file
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Oct 2004 21:27:08 -0400
- Subject: [PATCH] Fix PR c++/13560 wrong file reported for file
We were printing out the wrong file name for a function because
the location which we change the diagnostic to. The way to fix
this is to have cp_error_at print out the starter before having
to report diagnostic. This what this patch do.
OK? Bootstrapped and tested on powerpc-apple-darwin.
Thanks,
Andrew Pinski
Testcase (which I don't know how to get into the testsuite):
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"
# 1 "test.h" 1
class t
{
int g;
};
void h(t&);
# 2 "test.cc" 2
int main()
{
t y;
h(y);
return y.g;
}
ChangeLog:
* error.c (cp_error_at): Output the context as it might be
different file as the other location.
Index: error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.266
diff -u -p -r1.266 error.c
--- error.c 8 Oct 2004 19:40:57 -0000 1.266
+++ error.c 9 Oct 2004 01:18:33 -0000
@@ -2396,6 +2396,9 @@ cp_error_at (const char *msgid, ...)
va_start (ap, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
+ input_location, DK_ERROR);
+ cp_diagnostic_starter (global_dc, &diagnostic);
+ diagnostic_set_info (&diagnostic, msgid, &ap,
location_of (here), DK_ERROR);
report_diagnostic (&diagnostic);
va_end (ap);