This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove struct complaints


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a8be540e8ae8d16da5854c75d4724f3875aeba2e

commit a8be540e8ae8d16da5854c75d4724f3875aeba2e
Author: Tom Tromey <tom@tromey.com>
Date:   Wed May 16 23:25:09 2018 -0600

    Remove struct complaints
    
    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-23  Tom Tromey  <tom@tromey.com>
    
    	* complaints.c (struct complaints): Remove.
    	(symfile_complaint_book): Remove.
    	(series): New global.
    	(complaint_internal): Update.
    	(clear_complaints): Update.

Diff:
---
 gdb/ChangeLog    |  8 ++++++++
 gdb/complaints.c | 15 ++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4ee336..8c98603 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2018-05-23  Tom Tromey  <tom@tromey.com>
 
+	* complaints.c (struct complaints): Remove.
+	(symfile_complaint_book): Remove.
+	(series): New global.
+	(complaint_internal): Update.
+	(clear_complaints): Update.
+
+2018-05-23  Tom Tromey  <tom@tromey.com>
+
 	* complaints.c (counters): New global.
 	(struct complain): Remove.
 	(struct complaints) <root>: Remove.
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 2c69b8c..1bf99d4 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -39,14 +39,9 @@ enum complaint_series {
 
 static std::unordered_map<const char *, int> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]