From patchwork Thu Aug 25 11:48:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 57045 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68555385275A for ; Thu, 25 Aug 2022 11:49:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68555385275A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661428153; bh=QPM6vmG1Xv4shS2aAeqolcema5zzL/hmbrcADA1xcDU=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=A0hxFkCY/thRDu4ZzR6ozaU/i34yFRrm3MxtQ7u2Mr67SSG2lvxjvD3/+W3GiCH9v KgTeJteFhNY3Kq7NovVt1twLWDYhTTD5Fj3592uSewkcJ0rvufeD479G+3DEpRDzk/ MVszY2STtU3VpBB/DgRuexoQ8OLxK9p5E75VPTWo= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-ed1-x54a.google.com (mail-ed1-x54a.google.com [IPv6:2a00:1450:4864:20::54a]) by sourceware.org (Postfix) with ESMTPS id 373403858C2F for ; Thu, 25 Aug 2022 11:49:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 373403858C2F Received: by mail-ed1-x54a.google.com with SMTP id m18-20020a056402511200b00446d4abe6c8so7025214edd.12 for ; Thu, 25 Aug 2022 04:49:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=QPM6vmG1Xv4shS2aAeqolcema5zzL/hmbrcADA1xcDU=; b=j1i9D0qrefUqxB8e9yqvsKTS7nw7WQl945mtc5/mFqvXTzk2CxV+3zEt62RYtwy8Ri Abyd2VuZ2KtYAxbjPk0zKZXWZnMkaYIuUqSLbdg3DetxuLpfgEGAXQOaYXZeqKxHxbAz HiEkslZn4m0iosBKqw9yxKX5ozj+anIYaMzqwc/8UcOZkJGNPcdGCGxdm/lVRf926Ryj eFVzItQb26nL24oAXQH+2kGmvBXnTTS77Rt+knHCnDxlFViFZcYKwfuks/AvgUZ83ZqO 6WaCwiiBDvCzZtZAFibDQyGWJ+Ma1lVmm7kBAPNEzMhPbqU6gxsuZrXHQ9YKRobwdiut qHFg== X-Gm-Message-State: ACgBeo07vT2x881rba6EbV51yJtQb9RHFn7uyPSNYPHZmImeVZcLuGIm DP6PFTnX3HLguonFXUPoD5sZvKsaCWOybTl5nwQoDmqezPmb0Iy9YFVZ0IsXMmxtBT4AhvLfz5/ co+eQGUpN1ZaWN9X2ownvKwesqRrL/5TiyxM9DIEng2EzAl4rxlXcuIpdj+CM2TqIOQ580Jk= X-Google-Smtp-Source: AA6agR4jUjeAUnXPUBpRIfAXXZz/x2c3hQuUMuWll31ARcTEyiW+W3Hj+uvAp6nlzdWmCPuwz8RMC/Me68vGFg== X-Received: from tef.lon.corp.google.com ([2a00:79e0:d:209:e2f1:457f:d595:4f88]) (user=gprocida job=sendgmr) by 2002:a05:6402:2791:b0:447:3193:6b13 with SMTP id b17-20020a056402279100b0044731936b13mr2966920ede.335.1661428146883; Thu, 25 Aug 2022 04:49:06 -0700 (PDT) Date: Thu, 25 Aug 2022 12:48:54 +0100 In-Reply-To: <20220825114856.3137373-1-gprocida@google.com> Message-Id: <20220825114856.3137373-2-gprocida@google.com> Mime-Version: 1.0 References: <20220825114856.3137373-1-gprocida@google.com> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [PATCH 1/3] abidw: fix --stats output for resolved classes and enums To: libabigail@sourceware.org X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Giuliano Procida via Libabigail From: Giuliano Procida Reply-To: Giuliano Procida Cc: maennich@google.com, vvvvvv@google.com, sidnayyar@google.com, dodji@seketeli.org, kernel-team@android.com Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" 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 --- 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"; } }