Message ID | 20200709182250.1677238-3-gprocida@google.com |
---|---|
State | Committed, archived |
Headers |
Return-Path: <libabigail-bounces@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 5F1103844045; Thu, 9 Jul 2020 18:23:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F1103844045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594318994; bh=2HIgEOrJasAlRmIYVN9ZynFv54m3IZ+UDks8zEoMl7E=; h=Date:In-Reply-To:References:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:Cc:From; b=sKvp+1NgaGY9/wPbac5dAIjf3zkrFhuiCoR3TDCPiB9D18WcpsTMJ9dUz2xwsxMnd 5f8BW7O40XNOVfH+tA2yNLeHnP1dozn5uQXeiQmRQlMsvfaLZhSBParGzlMT0JEScW BXWEm7e2gszhszvUgtKPVlr29tKiqW12D9/Y7rSM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by sourceware.org (Postfix) with ESMTPS id 0B49F384B13D for <libabigail@sourceware.org>; Thu, 9 Jul 2020 18:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0B49F384B13D Received: by mail-qv1-xf4a.google.com with SMTP id k3so1976689qvm.11 for <libabigail@sourceware.org>; Thu, 09 Jul 2020 11:23:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=2HIgEOrJasAlRmIYVN9ZynFv54m3IZ+UDks8zEoMl7E=; b=Cn1DwFH4kg5vackYUqGYcjR55tMY3rp/UiQW9Z0v+A6u3FBR674gzz6beVWzs/9erY xkFp+t9nJyd6Bz/eRqA+N3pzymjQZE7LaLndnpkLXkFL8asI/mb4UDe6jYZ9q4raaqwu Gy0NGAxx0Oj3dodYAgg+JRbjYrI7re4e76E58jIsktx4HAoxtZF2wxXLO85H86todYEG 8jA/hGX1XBSqjbxcm5g+a1ONI0lJqAAfBhTQ2wLt2PLImBpuVvzcdQGeGl2NI1BlPbRo t3f80lxIrWuKxBi5Yt6aVqwDWN2nvJXyNU8dFUUsV9tSABMYtO+HINob3RLUNG9YXSNA igOA== X-Gm-Message-State: AOAM530xsR4QjkkCQju2SYcP7Hx6elf4FHViOZGqvHkxy32B+6AuecXO byhsS7ubogOO/f06rrkZOLhpW8mNLMp/8X7A9PWpzP7FLHarh5zY5deEMKCRtnjQSV95DwePXBV CoblqrKhOikvBImDn4+7putkpe0Nj+s5VGSaj0hc73TI+KAihf4g/KaQmlcCJEdfLtGVkUXI= X-Google-Smtp-Source: ABdhPJxR6MTEXoROvkxVydl+cpOGZT2Sugv2aVwpGkQxiIKfITZnEgLMBaeDuND6lZTW67keNYL5NextCtc+WA== X-Received: by 2002:a05:6214:328:: with SMTP id j8mr48916650qvu.75.1594318989591; Thu, 09 Jul 2020 11:23:09 -0700 (PDT) Date: Thu, 9 Jul 2020 19:22:49 +0100 In-Reply-To: <20200709182250.1677238-1-gprocida@google.com> Message-Id: <20200709182250.1677238-3-gprocida@google.com> Mime-Version: 1.0 References: <20200709164523.1578400-1-gprocida@google.com> <20200709182250.1677238-1-gprocida@google.com> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 2/3] Fix inheritance of scope_decl::insert_member_decl To: libabigail@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-22.7 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: <http://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: <http://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> Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" <libabigail-bounces@sourceware.org> |
Series |
Bug 21485 - problems compiling with clang
|
|
Commit Message
Giuliano Procida
July 9, 2020, 6:22 p.m. UTC
The classes class_decl, class_or_union and scope_decl derive from each
other. The method insert_member_decl is declared virtual and defined
in each of these. Unfortunately, it has different argument types in
the base scope_decl class.
Most calls to insert_member_decl are at a statically known class, but
in insert_decl_into_scope the method is called via a scope_decl
pointer. There is the possibility that this could be a type derived
from scope_decl rather than scope_decl itself, in which case the base
method would be called, not as intended.
This commit adjusts the type of the member argument to
scope_decl::insert_member_decl to match the other two classes and
eliminates the last trigger of Clang's -Werror-overloaded-virtual.
* include/abg-ir.h (scope_decl::insert_member_decl): Change
type of member argument from const decl_base_sptr& to plain
decl_base_sptr.
* src/abg-ir.cc (scope_decl::insert_member_decl): Likewise.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
include/abg-ir.h | 3 +--
src/abg-ir.cc | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
Comments
On Thu, Jul 09, 2020 at 07:22:49PM +0100, Giuliano Procida wrote: >The classes class_decl, class_or_union and scope_decl derive from each >other. The method insert_member_decl is declared virtual and defined >in each of these. Unfortunately, it has different argument types in >the base scope_decl class. > >Most calls to insert_member_decl are at a statically known class, but >in insert_decl_into_scope the method is called via a scope_decl >pointer. There is the possibility that this could be a type derived >from scope_decl rather than scope_decl itself, in which case the base >method would be called, not as intended. > >This commit adjusts the type of the member argument to >scope_decl::insert_member_decl to match the other two classes and >eliminates the last trigger of Clang's -Werror-overloaded-virtual. > > * include/abg-ir.h (scope_decl::insert_member_decl): Change > type of member argument from const decl_base_sptr& to plain > decl_base_sptr. > * src/abg-ir.cc (scope_decl::insert_member_decl): Likewise. > >Signed-off-by: Giuliano Procida <gprocida@google.com> Reviewed-by: Matthias Maennich <maennich@google.com> Cheers, Matthias >--- > include/abg-ir.h | 3 +-- > src/abg-ir.cc | 2 +- > 2 files changed, 2 insertions(+), 3 deletions(-) > >diff --git a/include/abg-ir.h b/include/abg-ir.h >index c2b66c4c..ea6a7ce4 100644 >--- a/include/abg-ir.h >+++ b/include/abg-ir.h >@@ -1653,8 +1653,7 @@ protected: > add_member_decl(const decl_base_sptr& member); > > virtual decl_base_sptr >- insert_member_decl(const decl_base_sptr& member, >- declarations::iterator before); >+ insert_member_decl(decl_base_sptr member, declarations::iterator before); > > virtual void > remove_member_decl(decl_base_sptr member); >diff --git a/src/abg-ir.cc b/src/abg-ir.cc >index a434ec69..a257cf67 100644 >--- a/src/abg-ir.cc >+++ b/src/abg-ir.cc >@@ -6081,7 +6081,7 @@ scope_decl::add_member_decl(const decl_base_sptr& member) > /// @param before an interator pointing to the element before which > /// the new member should be inserted. > decl_base_sptr >-scope_decl::insert_member_decl(const decl_base_sptr& member, >+scope_decl::insert_member_decl(decl_base_sptr member, > declarations::iterator before) > { > ABG_ASSERT(!member->get_scope()); >-- >2.27.0.383.g050319c2ae-goog >
Giuliano Procida <gprocida@google.com> a écrit: > The classes class_decl, class_or_union and scope_decl derive from each > other. The method insert_member_decl is declared virtual and defined > in each of these. Unfortunately, it has different argument types in > the base scope_decl class. > > Most calls to insert_member_decl are at a statically known class, but > in insert_decl_into_scope the method is called via a scope_decl > pointer. There is the possibility that this could be a type derived > from scope_decl rather than scope_decl itself, in which case the base > method would be called, not as intended. > > This commit adjusts the type of the member argument to > scope_decl::insert_member_decl to match the other two classes and > eliminates the last trigger of Clang's -Werror-overloaded-virtual. > > * include/abg-ir.h (scope_decl::insert_member_decl): Change > type of member argument from const decl_base_sptr& to plain > decl_base_sptr. > * src/abg-ir.cc (scope_decl::insert_member_decl): Likewise. > > Signed-off-by: Giuliano Procida <gprocida@google.com> Applied to master, thanks! Cheers,
diff --git a/include/abg-ir.h b/include/abg-ir.h index c2b66c4c..ea6a7ce4 100644 --- a/include/abg-ir.h +++ b/include/abg-ir.h @@ -1653,8 +1653,7 @@ protected: add_member_decl(const decl_base_sptr& member); virtual decl_base_sptr - insert_member_decl(const decl_base_sptr& member, - declarations::iterator before); + insert_member_decl(decl_base_sptr member, declarations::iterator before); virtual void remove_member_decl(decl_base_sptr member); diff --git a/src/abg-ir.cc b/src/abg-ir.cc index a434ec69..a257cf67 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -6081,7 +6081,7 @@ scope_decl::add_member_decl(const decl_base_sptr& member) /// @param before an interator pointing to the element before which /// the new member should be inserted. decl_base_sptr -scope_decl::insert_member_decl(const decl_base_sptr& member, +scope_decl::insert_member_decl(decl_base_sptr member, declarations::iterator before) { ABG_ASSERT(!member->get_scope());