public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Giuliano Procida <gprocida@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com, gprocida@google.com,
	 maennich@google.com, sidnayyar@google.com, vvvvvv@google.com
Subject: [PATCH 1/3] abidw: fix --stats output for resolved classes and enums
Date: Thu, 25 Aug 2022 12:48:54 +0100	[thread overview]
Message-ID: <20220825114856.3137373-2-gprocida@google.com> (raw)
In-Reply-To: <20220825114856.3137373-1-gprocida@google.com>

The code to print out the remaining declaration-only types
unintentionally omitted the first such type. This change fixes the
logic and uses a single test to decide whether or not to print the
stats header line.

	* src/abg-dwarf-reader.cc
	(read_context::resolve_declaration_only_classes): Fix
	conditional logic so that showing stats includes the first
	unresolved type.
	(read_context::resolve_declaration_only_enums): Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-dwarf-reader.cc | 40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index e5159c89..a954de6d 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -4325,19 +4325,15 @@ public:
 	 ++i)
       declaration_only_classes().erase(*i);
 
-    for (string_classes_map::iterator i = declaration_only_classes().begin();
-	 i != declaration_only_classes().end();
-	 ++i)
+    if (show_stats() && !declaration_only_classes().empty())
       {
-	if (show_stats())
-	  {
-	    if (i == declaration_only_classes().begin())
-	      cerr << "Here are the "
-		   << num_decl_only_classes - num_resolved
-		   << " unresolved class declarations:\n";
-	    else
-	      cerr << "    " << i->first << "\n";
-	  }
+	cerr << "Here are the "
+	     << num_decl_only_classes - num_resolved
+	     << " unresolved class declarations:\n";
+	for (string_classes_map::iterator i = declaration_only_classes().begin();
+	     i != declaration_only_classes().end();
+	     ++i)
+	  cerr << "    " << i->first << "\n";
       }
   }
 
@@ -4527,19 +4523,15 @@ public:
 	 ++i)
       declaration_only_enums().erase(*i);
 
-    for (string_enums_map::iterator i = declaration_only_enums().begin();
-	 i != declaration_only_enums().end();
-	 ++i)
+    if (show_stats() && !declaration_only_enums().empty())
       {
-	if (show_stats())
-	  {
-	    if (i == declaration_only_enums().begin())
-	      cerr << "Here are the "
-		   << num_decl_only_enums - num_resolved
-		   << " unresolved enum declarations:\n";
-	    else
-	      cerr << "    " << i->first << "\n";
-	  }
+	cerr << "Here are the "
+	     << num_decl_only_enums - num_resolved
+	     << " unresolved enum declarations:\n";
+	for (string_enums_map::iterator i = declaration_only_enums().begin();
+	     i != declaration_only_enums().end();
+	     ++i)
+	  cerr << "    " << i->first << "\n";
       }
   }
 
-- 
2.37.1.595.g718a3a8f04-goog


  reply	other threads:[~2022-08-25 11:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 11:48 [PATCH 0/3] Improve resolution of declaration-only enums Giuliano Procida
2022-08-25 11:48 ` Giuliano Procida [this message]
2022-08-29 11:19   ` [PATCH 1/3] abidw: fix --stats output for resolved classes and enums Dodji Seketeli
2022-08-25 11:48 ` [PATCH 2/3] abidw: remove always true test in resolve_declaration_only_classes Giuliano Procida
2022-08-29 11:19   ` Dodji Seketeli
2022-08-25 11:48 ` [PATCH 3/3] abidw: resolve declaration-only enums the same as classes Giuliano Procida
2022-08-29 11:20   ` Dodji Seketeli

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=20220825114856.3137373-2-gprocida@google.com \
    --to=gprocida@google.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    --cc=maennich@google.com \
    --cc=sidnayyar@google.com \
    --cc=vvvvvv@google.com \
    /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).