This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Complaint fix
- From: Andrew Cagney <ac131313 at ges dot redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 20 Sep 2002 23:42:09 -0400
- Subject: [patch] Complaint fix
(a.k.a., I discover begin_line()).
The attached should fix the stray newline problem Kevin discovered. I
don't know why it isn't generic -- the fix looks generic :-/
[As a side note, begin_line() is really useful. I think it should be
used everywhere. It would help get rid of a few other stray blank lines
such as appear in error messages.]
committing,
Andrew
2002-09-20 Andrew Cagney <cagney@redhat.com>
* complaints.c (symfile_explanations): Remove newline from
``isolated_message''.
(vcomplaint): When ISOLATED_MESSAGE, force a line break.
(clear_complaints): When a SUBSEQUENT_MESSAGE, force a line break.
Index: complaints.c
===================================================================
RCS file: /cvs/src/src/gdb/complaints.c,v
retrieving revision 1.7
diff -u -r1.7 complaints.c
--- complaints.c 19 Sep 2002 00:42:41 -0000 1.7
+++ complaints.c 21 Sep 2002 03:11:05 -0000
@@ -84,7 +84,7 @@
/* The symbol table complaint table. */
static const char *symfile_explanations[] = {
- "During symbol reading, %s.\n",
+ "During symbol reading, %s.",
"During symbol reading...%s...",
"%s...",
"%s...",
@@ -181,6 +181,7 @@
else
{
if (complaints->explanation == NULL)
+ /* A [v]warning() call always appends a newline. */
vwarning (complaint->fmt, args);
else
{
@@ -194,7 +195,13 @@
fprintf_filtered (gdb_stderr,
complaints->explanation[series],
msg);
- wrap_here ("");
+ /* Force a line-break after any isolated message. For the
+ other cases, clear_complaints() takes care of any missing
+ trailing newline, the wrap_here() is just a hint. */
+ if (series == ISOLATED_MESSAGE)
+ begin_line ();
+ else
+ wrap_here ("");
do_cleanups (cleanups);
}
}
@@ -267,10 +274,21 @@
p->counter = 0;
}
- if (complaints->series > 1 && !warning_hook)
+ switch (complaints->series)
{
- /* Terminate previous series, since caller won't. */
- puts_filtered ("\n");
+ case FIRST_MESSAGE:
+ case SHORT_FIRST_MESSAGE:
+ /* Haven't yet printed anything. */
+ break;
+ case ISOLATED_MESSAGE:
+ /* The code above, always forces a line-break. No need to do it
+ here. */
+ break;
+ case SUBSEQUENT_MESSAGE:
+ begin_line ();
+ break;
+ default:
+ internal_error (__FILE__, __LINE__, "bad switch");
}
if (!less_verbose)