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
Subject: [PATCH 3/3] abidiff: Omit declaration-only type size 0 diffs.
Date: Wed, 22 Apr 2020 22:20:59 +0100	[thread overview]
Message-ID: <20200422212059.258602-3-gprocida@google.com> (raw)
In-Reply-To: <20200422212059.258602-1-gprocida@google.com>

When reporting declaration-only type changes, the size is reported as
changing to or from 0, which is not correct. The declaration type is
of unknown size. This patch eliminates such size reports.

	* src/abg-reporter-priv.cc (report_size_and_alignment_changes):
	Filter out declaration-only / defined type size changes
	unconditionally.
	* tests/data/test-abidiff-exit/test-decl-struct-report.txt:
	Update test.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-reporter-priv.cc                                 | 9 ++++-----
 tests/data/test-abidiff-exit/test-decl-struct-report.txt | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc
index bdf6690d..4ea591aa 100644
--- a/src/abg-reporter-priv.cc
+++ b/src/abg-reporter-priv.cc
@@ -714,12 +714,11 @@ report_size_and_alignment_changes(type_or_decl_base_sptr	first,
   class_or_union_sptr first_class = is_class_or_union_type(first),
     second_class = is_class_or_union_type(second);
 
-  if (filtering::has_class_decl_only_def_change(first_class, second_class)
-      && !(ctxt->get_allowed_category() & CLASS_DECL_ONLY_DEF_CHANGE_CATEGORY))
+  if (filtering::has_class_decl_only_def_change(first_class, second_class))
     // So these two classes differ only by the fact that one is the
-    // declaration-only form of the second.  And the user asked that
-    // this kind of change be filtered out, so do not report any size
-    // change due to this.
+    // declaration-only form of the second.  The declaration-only class
+    // is of unknown size (recorded as 0) and it is not meaningful to
+    // report a size change.
     return;
 
   unsigned fs = f->get_size_in_bits(), ss = s->get_size_in_bits(),
diff --git a/tests/data/test-abidiff-exit/test-decl-struct-report.txt b/tests/data/test-abidiff-exit/test-decl-struct-report.txt
index 8bb712e6..f1fa2077 100644
--- a/tests/data/test-abidiff-exit/test-decl-struct-report.txt
+++ b/tests/data/test-abidiff-exit/test-decl-struct-report.txt
@@ -7,13 +7,11 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
     parameter 1 of type 'const embodied*' has sub-type changes:
       in pointed to type 'const embodied':
         in unqualified underlying type 'struct embodied' at test-decl-struct-v1.c:1:1:
-          type size changed from 0 to 32 (in bits)
           type struct embodied was a declaration-only type and is now a defined type
 
   [C] 'function void reg2(const disembodied*)' at test-decl-struct-v1.c:5:1 has some indirect sub-type changes:
     parameter 1 of type 'const disembodied*' has sub-type changes:
       in pointed to type 'const disembodied':
         in unqualified underlying type 'struct disembodied':
-          type size changed from 32 to 0 (in bits)
           type struct disembodied was a defined type and is now a declaration-only type
 
-- 
2.26.1.301.g55bc3eb7cb9-goog


  parent reply	other threads:[~2020-04-22 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 21:20 [PATCH 1/3] Add tests for declaration-only struct diffs Giuliano Procida
2020-04-22 21:20 ` [PATCH 2/3] abidiff: Blank line after declaration-only diff Giuliano Procida
2020-04-27 11:15   ` Dodji Seketeli
2020-04-22 21:20 ` Giuliano Procida [this message]
2020-04-27 11:15   ` [PATCH 3/3] abidiff: Omit declaration-only type size 0 diffs Dodji Seketeli
2020-04-27 11:15 ` [PATCH 1/3] Add tests for declaration-only struct diffs 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=20200422212059.258602-3-gprocida@google.com \
    --to=gprocida@google.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    /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).