public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH] Bug 26992 - Try harder to resolve declaration-only classes
Date: Fri, 15 Jan 2021 18:21:03 +0100	[thread overview]
Message-ID: <87mtxai0ao.fsf@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2678 bytes --]

Hello,

When a declaration of a class, named H, matches more than one
definition (let's call them D) of H (in several other translation
units of the abi corpus) then H is left unresolved; that is, H is
considered as being a declaration-only class.  Note that down the
road, H will compare different to all those Ds.

However when those Ds are all equal, it turns out that this can lead
to issues down the road.  This is because conceptually, H equals D.
But then by not resolving H to D (and there are several Ds), we
artificially create a situation where H is different from D.  We can
even create situations where those Ds are different among themselves.
So doing comparisons inevitably leads to spurious changes.

This is the root cause of the issue described in this bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=26992.

To fix the issue, this patch thus resolves H to D when the different
Ds are all equal.

Note that a similar thing should be done for the process of resolving
declaration-only enums as well.  But I don't have an issue reproducer
at hand involving enums at the moment, so I am adding a comment to
read_context::resolve_declaration_only_enums for now.

I have also filled the enhancement request
https://sourceware.org/bugzilla/show_bug.cgi?id=27189 to track a task
that would do away with read_context::resolve_declaration_only_enums
altogether by factorizing out the resolution of declaration-only
abigail::ir::decl_base.

	* src/abg-dwarf-reader.cc
	(read_context::compare_before_canonicalisation): Define new member
	function.
	(read_context::resolve_declaration_only_classes): When there are
	more than one definition that can resolve a given declaration, if
	all those definitions are equal, then resolve the declaration to
	those definitions.
	(read_context::resolve_declaration_only_enums): Add a comment to
	update similarly update this function (or do away with it
	completely) later.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.rpm: Add new
	test input.
	* tests/data/test-diff-pkg/cogl-debuginfo-1.22.8-2.fc33.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.self-check-report-0.txt:
	Likewise.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs
	to the test harness.
	* tests/data/Makefile.am: Add the new test input files to source
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Applied to the mainline branch.

The patch is a bit big so I am attaching it gzip'ed here.


[-- Attachment #2: Compressed patch --]
[-- Type: application/gzip, Size: 2226061 bytes --]

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

                 reply	other threads:[~2021-01-15 17:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87mtxai0ao.fsf@redhat.com \
    --to=dodji@redhat.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).