From patchwork Wed Jan 1 00:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksei Vetrov via Libabigail X-Patchwork-Id: 38996 X-Patchwork-Original-From: libabigail@sourceware.org (Matthias Maennich via libabigail) From: Aleksei Vetrov via Libabigail Date: Wed, 01 Jan 2020 00:00:00 -0000 Subject: [PATCH 2/2] writer: completely skip over empty corpora In-Reply-To: <20200113144451.46359-1-maennich@google.com> References: <20200113144451.46359-1-maennich@google.com> Message-ID: <20200113144451.46359-3-maennich@google.com> A corpus that has no symbols contributing to the ABI surface (e.g. because of an exhaustive suppression), will not contribute in a later comparison via abidiff and friends. Hence, there is no need for such entries to appear in the ABI xml representation. This patch completely suppresses empty corpora. * src/abg-writer.cc (write_corpus): completely skip empty corpora rather than creating an empty entry for them. Signed-off-by: Matthias Maennich --- src/abg-writer.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/abg-writer.cc b/src/abg-writer.cc index 994a21e28066..ca10af8d5e7e 100644 --- a/src/abg-writer.cc +++ b/src/abg-writer.cc @@ -4378,6 +4378,9 @@ write_corpus(write_context& ctxt, if (!corpus) return false; + if (corpus->is_empty()) + return true; + do_indent_to_level(ctxt, indent, 0); std::ostream& out = ctxt.get_ostream(); @@ -4411,12 +4414,6 @@ write_corpus(write_context& ctxt, write_tracking_non_reachable_types(corpus, out); - if (corpus->is_empty()) - { - out << "/>\n"; - return true; - } - out << ">\n"; // Write the list of needed corpora.