From patchwork Tue May 22 05:07:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27385 Received: (qmail 10518 invoked by alias); 22 May 2018 05:07:36 -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 4838 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=-25.9 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=979 X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.48.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 May 2018 05:07:22 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway23.websitewelcome.com (Postfix) with ESMTP id D109E80B0 for ; Tue, 22 May 2018 00:07:09 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id KzVtff8fTBcCXKzVtfZqZI; Tue, 22 May 2018 00:07:09 -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 1fKzVt-003pV7-LW; Tue, 22 May 2018 00:07:09 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 9/9] Remove struct complaints Date: Mon, 21 May 2018 23:07:04 -0600 Message-Id: <20180522050704.10845-10-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: 1fKzVt-003pV7-LW 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: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes struct complaints now just holds a single enum value, so remove it and symfile_complaint_book and replace it with a global variable. gdb/ChangeLog 2018-05-21 Tom Tromey * complaints.c (struct complaints): Remove. (symfile_complaint_book): Remove. (series): New global. (complaint_internal): Update. (clear_complaints): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/complaints.c | 15 ++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gdb/complaints.c b/gdb/complaints.c index 2c69b8ca2c..1bf99d40f0 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -39,14 +39,9 @@ enum complaint_series { static std::unordered_map counters; -struct complaints -{ - enum complaint_series series; -}; +/* How to print the next complaint. */ -static struct complaints symfile_complaint_book = { - ISOLATED_MESSAGE -}; +static complaint_series series; /* How many complaints about a particular thing should be printed before we stop whining about it? Default is no whining at all, @@ -60,13 +55,11 @@ void complaint_internal (const char *fmt, ...) { va_list args; - enum complaint_series series; if (counters[fmt]++ > stop_whining) return; va_start (args, fmt); - series = symfile_complaint_book.series; if (deprecated_warning_hook) (*deprecated_warning_hook) (fmt, args); @@ -104,9 +97,9 @@ clear_complaints (int less_verbose) counters.clear (); if (!less_verbose) - symfile_complaint_book.series = ISOLATED_MESSAGE; + series = ISOLATED_MESSAGE; else - symfile_complaint_book.series = SHORT_FIRST_MESSAGE; + series = SHORT_FIRST_MESSAGE; } static void