[PATCH] Fix PR c++/13560 wrong file reported for file

Andrew Pinski pinskia@physics.uc.edu
Sat Oct 9 01:31:00 GMT 2004


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);



More information about the Gcc-patches mailing list