public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH 2/8, applied] ir: Tighten the test for anonymous data member
Date: Wed, 11 Aug 2021 18:03:33 +0200	[thread overview]
Message-ID: <8735rgdl4a.fsf@redhat.com> (raw)

Hello,

In is_anonymous_data_member(), we only test that the name of the data
member is empty; we forget to test that decl_base::get_is_anonymous()
is true.  This might make us wrongly think that a data member is
anonymous in cases like in the equals() function for var_decl, where
we temporarily set the name of the compared var_decl to "" before
invoking the decl_base::operator==.  We do this to perform the
comparison by not taking into account the name of the variable.

This hasn't yet happened on the binaries of the regression test suite,
but it's definitely wrong so I am fixing it here.

	* src/abg-ir.cc: (is_anonymous_data_member): Consider
	decl_base::get_is_anonymous as well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
 src/abg-ir.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 39540582..8e00eabf 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -5474,6 +5474,7 @@ bool
 is_anonymous_data_member(const var_decl& d)
 {
   return (is_data_member(d)
+	  && d.get_is_anonymous()
 	  && d.get_name().empty()
 	  && is_class_or_union_type(d.get_type()));
 }
-- 
2.30.0


-- 
		Dodji


                 reply	other threads:[~2021-08-11 16:03 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=8735rgdl4a.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).