This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH in diagnostic.c for warn-1.c regression
- From: Per Bothner <per at bothner dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Jul 2003 11:18:01 -0700
- Subject: PATCH in diagnostic.c for warn-1.c regression
That patches fixes a regression in warn-1.c and other places, where the
"included from" context was not being printed correctly. The problem is
an inconsistency with my June 5 change to push_srcloc / pop_srcloc.
This change actually slightly simplies the code.
(However, I'm surprised that I didn't know about it before Geoff Keating
pointed it out to me - perhaps some other change triggered the
regression. Or perhaps I and other just overlooked a relatively
non-obvious regression buried within the other failing testcases.)
Anyway, this has bootsrrapped (all languages) on Linux, and the
testsuite doesn't complain too loudly. Ok to check in?
--
--Per Bothner
per@bothner.com http://per.bothner.com/
2003-07-22 Per Bothner <pbothner@apple.com>
* diagnostic.c.(diagnostic_report_current_module): Update to match
2003-06-05 changes to push_srcloc and pop_srcloc.
Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.124
diff -u -p -r1.124 diagnostic.c
--- diagnostic.c 15 Jul 2003 23:31:51 -0000 1.124
+++ diagnostic.c 22 Jul 2003 17:59:27 -0000
@@ -978,18 +978,16 @@ diagnostic_report_current_module (diagno
output_needs_newline (&context->buffer) = false;
}
- if (input_file_stack && input_file_stack->next != 0
- && diagnostic_last_module_changed (context))
+ if (input_file_stack && diagnostic_last_module_changed (context))
{
- for (p = input_file_stack->next; p; p = p->next)
- if (p == input_file_stack->next)
- output_verbatim (&context->buffer,
- "In file included from %s:%d",
- p->location.file, p->location.line);
- else
- output_verbatim (&context->buffer,
- ",\n from %s:%d",
- p->location.file, p->location.line);
+ p = input_file_stack;
+ output_verbatim (&context->buffer,
+ "In file included from %s:%d",
+ p->location.file, p->location.line);
+ while ((p = p->next) != NULL)
+ output_verbatim (&context->buffer,
+ ",\n from %s:%d",
+ p->location.file, p->location.line);
output_verbatim (&context->buffer, ":\n");
diagnostic_set_last_module (context);
}