From patchwork Tue May 22 05:07:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27387 Received: (qmail 11075 invoked by alias); 22 May 2018 05:07:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5191 invoked by uid 89); 22 May 2018 05:07:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=SERIES, complain, friendly X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.144.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 May 2018 05:07:22 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id B913ABC913 for ; Tue, 22 May 2018 00:07:08 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id KzVsfvQUT5CKDKzVsfOagG; Tue, 22 May 2018 00:07:08 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:36532 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fKzVs-003pV7-HW; Tue, 22 May 2018 00:07:08 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 5/9] Remove struct explanation Date: Mon, 21 May 2018 23:07:00 -0600 Message-Id: <20180522050704.10845-6-tom@tromey.com> In-Reply-To: <20180522050704.10845-1-tom@tromey.com> References: <20180522050704.10845-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fKzVs-003pV7-HW X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:36532 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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 * complaints.c (struct complaints) : 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.