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,
	 maennich@google.com, sidnayyar@google.com, vvvvvv@google.com
Subject: [PATCH] DWARF reader: avoid C++20 operator!= overload ambiguity
Date: Mon,  9 Jan 2023 09:20:44 +0000	[thread overview]
Message-ID: <20230109092044.787665-1-gprocida@google.com> (raw)

C++20 automatically generates overloads for certain comparison
operators based on others and this can create ambiguity with older
code. The type expr_result has various operators defined and comparing
expr_result != int becomes ambiguous.

This change just avoids this comparison by extracting the underlying
value, rather than making changes to the type itself. There should be
no change in behaviour and no tests are affected.

	* (src/abg-dwarf-reader.cc) op_is_control_flow: In the
	DW_OP_bra case, when testing the popped value, use the
	expr_result's const_value explicitly.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-dwarf-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index e3a1348d..ce6b52d4 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -8279,7 +8279,7 @@ op_is_control_flow(Dwarf_Op* expr,
 
     case DW_OP_bra:
       val1 = ctxt.pop();
-      if (val1 != 0)
+      if (val1.const_value() != 0)
 	index += val1.const_value() - 1;
       break;
 
-- 
2.39.0.314.g84b9a713c41-goog


             reply	other threads:[~2023-01-09  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09  9:20 Giuliano Procida [this message]
2023-01-09 16:03 ` 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=20230109092044.787665-1-gprocida@google.com \
    --to=gprocida@google.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    --cc=maennich@google.com \
    --cc=sidnayyar@google.com \
    --cc=vvvvvv@google.com \
    /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).