Message ID | 20230109092044.787665-1-gprocida@google.com |
---|---|
State | New |
Headers |
Return-Path: <libabigail-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4034E3858409 for <patchwork@sourceware.org>; Mon, 9 Jan 2023 09:21:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4034E3858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673256062; bh=cbE/EdK3Ae1MFFM48wnrE497m+hJcj6Ule7ddOhmsnI=; h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive: List-Help:List-Subscribe:From:Reply-To:From; b=YEBSFEno2W52AzY6tChpHpAAIxKziAM7h6NR+QuKZ7tTq3za26s1ycBbFJa9Tj9nd t6/POb8yI4ESv+sj8aApTVplgvtEGIKaFoGsq1JXabx1pUWCjY8FYJ6vMJJsHSgTHB oaYo9A4y6tiKL5qR8FsaUeYxNFqMzoQzuzT8aSew= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-ed1-x54a.google.com (mail-ed1-x54a.google.com [IPv6:2a00:1450:4864:20::54a]) by sourceware.org (Postfix) with ESMTPS id 22DCA3858D37 for <libabigail@sourceware.org>; Mon, 9 Jan 2023 09:20:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22DCA3858D37 Received: by mail-ed1-x54a.google.com with SMTP id b15-20020a056402350f00b0048477a5114bso4800913edd.2 for <libabigail@sourceware.org>; Mon, 09 Jan 2023 01:20:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cbE/EdK3Ae1MFFM48wnrE497m+hJcj6Ule7ddOhmsnI=; b=UUIjh+9U4KhI525CTd967Q/ac5igBKcv/Idv36hJeVi2Iq8iyq+MBolccVWYi1WUxU WhAseAgTmWfcsvfzPjHVf61RHD8K5F/on8HGeRwIcS6s0MgmYxJ0Gv/iS5xZ7Fln5MLK qYxR76fBboXyAXj5YQlkgO/z+LUbMgF6girvGAR0WJ7+bvO/QE10Jit/n8Hu4MkheoAp tHcGeAX0h/EoQHTUBvMeV0zavm04XfMQamZQpHdSReg3vN77UfJzk6vrAm0ZFBwCuUrd TUL2XPahVqS5/7L8l27nPBhauZIaIntr+3lvZ8nUo29r1UckkIaHMmRp8WHkG8Joz0fi tx1A== X-Gm-Message-State: AFqh2krgkz55UGfXazy5LSt+rp6S2v6iTmDZtcwpe+j1wCMGqXetCuGa x+uCsXrVVcn9H0JuclM/vaYnU82BKIke+4F84+BWI/wPfLVq+H+BreVpLPljiv0mSwjd9ycI1GH V0xqAvoIoR2PcY3Rqp2kzJLkxgyLGm9yI/MIOvQdR0I0CrGc3XfOfobk7wuaVXPmjXj++HR8= X-Google-Smtp-Source: AMrXdXucCwOwoRLAmL02M/bCKe9sMLZ7szwnfAoYD+Lb8h6hrF8q1czNb4u7E3lWiDAbq1UNes7dJzzyXMmurQ== X-Received: from tef.lon.corp.google.com ([2a00:79e0:d:209:4082:1638:14e1:810a]) (user=gprocida job=sendgmr) by 2002:aa7:cad6:0:b0:490:df3b:d889 with SMTP id l22-20020aa7cad6000000b00490df3bd889mr1871152edt.205.1673256054727; Mon, 09 Jan 2023 01:20:54 -0800 (PST) Date: Mon, 9 Jan 2023 09:20:44 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230109092044.787665-1-gprocida@google.com> Subject: [PATCH] DWARF reader: avoid C++20 operator!= overload ambiguity To: libabigail@sourceware.org Cc: dodji@seketeli.org, kernel-team@android.com, gprocida@google.com, maennich@google.com, sidnayyar@google.com, vvvvvv@google.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-21.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project <libabigail.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libabigail>, <mailto:libabigail-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libabigail/> List-Help: <mailto:libabigail-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libabigail>, <mailto:libabigail-request@sourceware.org?subject=subscribe> From: Giuliano Procida via Libabigail <libabigail@sourceware.org> Reply-To: Giuliano Procida <gprocida@google.com> Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" <libabigail-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
DWARF reader: avoid C++20 operator!= overload ambiguity
|
|
Commit Message
Giuliano Procida
Jan. 9, 2023, 9:20 a.m. UTC
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(-)
Comments
Hello Giuliano, First of all, Happy New Year to you and your beloved ones! Giuliano Procida <gprocida@google.com> a écrit: > 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> Applied to the master branch, thanks! [...] Cheers,
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;