public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applying to mainline] dwarf-reader: Avoid duplicating union members
Date: Mon, 12 Feb 2024 22:24:58 +0100	[thread overview]
Message-ID: <878r3pz87p.fsf@redhat.com> (raw)

Hello,

The DWARF from some C++ binaries represents unions in a "piece wise"
fashion.  When dealing with those unions, we need to avoid adding the
same member twice, just like what we do for classes.

	* src/abg-dwarf-reader.cc (add_or_update_union_type): Do not add
	an union member that already exists in the union.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applying to the master branch.
---
 src/abg-dwarf-reader.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index 735f0342..8c624d48 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -13582,6 +13582,9 @@ add_or_update_union_type(reader&	 rdr,
 	      if (n.empty() && result->find_data_member(dm))
 		continue;
 
+	      if (!n.empty() && lookup_var_decl_in_scope(n, result))
+		continue;
+
 	      result->add_data_member(dm, access, /*is_laid_out=*/true,
 				      /*is_static=*/false,
 				      offset_in_bits);
-- 
2.39.3


-- 
		Dodji


                 reply	other threads:[~2024-02-12 21:25 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=878r3pz87p.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).