public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 5/9] Remove struct explanation
Date: Tue, 22 May 2018 05:08:00 -0000	[thread overview]
Message-ID: <20180522050704.10845-6-tom@tromey.com> (raw)
In-Reply-To: <20180522050704.10845-1-tom@tromey.com>

Now that there's only a single reason for a complaint to be emitted,
this removes "struct explanation" and changes vcomplaint to emit the
desired messages directly.

gdb/ChangeLog
2018-05-21  Tom Tromey  <tom@tromey.com>

	* complaints.c (struct complaints) <explanation>: Remove.
	(symfile_explanations): Remove.
	(symfile_complaint_book): Update.
	(vcomplaint): Update.
	(struct explanation): Remove.
---
 gdb/ChangeLog    |  8 ++++++++
 gdb/complaints.c | 56 ++++++++------------------------------------------------
 2 files changed, 16 insertions(+), 48 deletions(-)

diff --git a/gdb/complaints.c b/gdb/complaints.c
index 70e297a1d3..eab7607deb 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -45,43 +45,18 @@ struct complain
   struct complain *next;
 };
 
-/* The explanatory message that should accompany the complaint.  The
-   message is in two parts - pre and post - that are printed around
-   the complaint text.  */
-struct explanation
-{
-  const char *prefix;
-  const char *postfix;
-};
-
 struct complaints
 {
   struct complain *root;
 
   enum complaint_series series;
-
-  /* The explanatory messages that should accompany the complaint.
-     NOTE: cagney/2002-08-14: In a desperate attempt at being vaguely
-     i18n friendly, this is an array of two messages.  When present,
-     the PRE and POST EXPLANATION[SERIES] are used to wrap the
-     message.  */
-  const struct explanation *explanation;
 };
 
 static struct complain complaint_sentinel;
 
-/* The symbol table complaint table.  */
-
-static struct explanation symfile_explanations[] = {
-  { "During symbol reading, ", "." },
-  { "", "..."},
-  { NULL, NULL }
-};
-
 static struct complaints symfile_complaint_book = {
   &complaint_sentinel,
-  ISOLATED_MESSAGE,
-  symfile_explanations
+  ISOLATED_MESSAGE
 };
 
 static struct complain * ATTRIBUTE_PRINTF (4, 0)
@@ -156,29 +131,14 @@ vcomplaint (const char *file,
     (*deprecated_warning_hook) (fmt, args);
   else
     {
-      if (symfile_complaint_book.explanation == NULL)
-	/* A [v]warning() call always appends a newline.  */
-	vwarning (fmt, args);
+      std::string msg = string_vprintf (fmt, args);
+      wrap_here ("");
+      begin_line ();
+      if (series == ISOLATED_MESSAGE)
+	fprintf_filtered (gdb_stderr, "During symbol reading, %s.\n",
+			  msg.c_str ());
       else
-	{
-	  std::string msg = string_vprintf (fmt, args);
-	  wrap_here ("");
-	  begin_line ();
-	  /* XXX: i18n */
-	  fprintf_filtered (gdb_stderr, "%s%s%s",
-			    symfile_complaint_book.explanation[series].prefix,
-			    msg.c_str (),
-			    symfile_complaint_book.explanation[series].postfix);
-	  /* Force a line-break after any isolated message.  */
-	  if (series == ISOLATED_MESSAGE)
-	    /* It would be really nice to use begin_line() here.
-	       Unfortunately that function doesn't track GDB_STDERR and
-	       consequently will sometimes supress a line when it
-	       shouldn't.  */
-	    fputs_filtered ("\n", gdb_stderr);
-	  else
-	    wrap_here ("");
-	}
+	fprintf_filtered (gdb_stderr, "%s...", msg.c_str ());
     }
 
   /* If GDB dumps core, we'd like to see the complaints first.
-- 
2.13.6

  parent reply	other threads:[~2018-05-22  5:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22  5:09 [RFA 0/9] Radically simplify the complaint system Tom Tromey
2018-05-22  5:07 ` [RFA 2/9] Remove elements from complaint_series Tom Tromey
2018-05-22  5:07 ` [RFA 9/9] Remove struct complaints Tom Tromey
2018-05-22  5:08 ` [RFA 6/9] Remove vcomplaint Tom Tromey
2018-05-22  5:08 ` Tom Tromey [this message]
2018-05-22  5:09 ` [RFA 4/9] Remove symfile_complaints Tom Tromey
2018-05-22  5:09 ` [RFA 1/9] Remove internal_complaint Tom Tromey
2018-05-22  5:09 ` [RFA 8/9] Remove struct complain Tom Tromey
2018-05-22  5:50 ` [RFA 3/9] Remove "noisy" parameter from clear_complaints Tom Tromey
2018-05-22  7:01 ` [RFA 7/9] Remove file and line from struct complain Tom Tromey
2018-05-23 14:49 ` [RFA 0/9] Radically simplify the complaint system Pedro Alves
2018-05-23 15:08   ` Tom Tromey
2018-05-23 17:44     ` Pedro Alves
2018-05-28 10:41       ` Tom Tromey
2018-05-28 10:41         ` Tom Tromey
2018-05-28 19:37         ` Pedro Alves
2018-05-28 22:19           ` Tom Tromey
2018-05-29 16:05             ` Pedro Alves
2018-06-04 20:25 ` Possible regression on gdb.gdb/complaints.exp (was: Re: [RFA 0/9] Radically simplify the complaint system) Sergio Durigan Junior
2018-06-04 21:38   ` Possible regression on gdb.gdb/complaints.exp Tom Tromey
2018-06-04 23:29     ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180522050704.10845-6-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).