From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by sourceware.org (Postfix) with ESMTPS id 3C25A3842400 for ; Fri, 10 Jul 2020 16:27:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C25A3842400 Received: by mail-wm1-x341.google.com with SMTP id o2so6506297wmh.2 for ; Fri, 10 Jul 2020 09:27:34 -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:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=N6CX2rnB1hLfAogb33ovkZ0bso6JZ3SG82JZevYmGwU=; b=ffKM/1PIhhZnPOJJMZOyMXU7Uh6B/+xDtAtqk+qeKtgg6BGYRhiloGggPrDX2D+Sbi 4eFcBEnfAJ+lWKhffuiVLnO2ZDJ7m4+70kqpQ9l+QmrDJWFqrr6PlCM4emUK+tdpIIFy h/bXokgaHFuPU7xe85MfYK7CWwTz3i6QzhlvKCmygBErzo5Mo0+4NqPKYLrgArbaVC1a Ax7Ot2MAdTkR0TL/ADgkE9nPUSP7RFr2gGpdvaN/0/fDFCjwAY1rqw7tWZOajTyA9tZI eH0leBUB2JcEkJn6YqRYW4eQeSXlRLHgYZtE7Y4iTYppTfAWR0uFCJe9z7LhGjIcdPpF HV8Q== X-Gm-Message-State: AOAM530WQkr05U44gvZDp+4HicxwxQSpEm/Ekpprhf/+vWRBnNjNOtV+ eyCymJBqWrRCDm7FETAaQiCWfEmGONM= X-Google-Smtp-Source: ABdhPJw2lcxWZw0w+GoiyUYUj0BCGoO7NrdvLR2wPDz3zOX8tsc/33et98F8CwsSd7SQ1p+sUQ056A== X-Received: by 2002:a1c:6809:: with SMTP id d9mr5904089wmc.34.1594398453109; Fri, 10 Jul 2020 09:27:33 -0700 (PDT) Received: from google.com ([2a00:79e0:d:110:7220:84ff:fe09:a3aa]) by smtp.gmail.com with ESMTPSA id e23sm9666350wme.35.2020.07.10.09.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 09:27:32 -0700 (PDT) Date: Fri, 10 Jul 2020 18:27:32 +0200 From: Matthias Maennich To: Giuliano Procida Cc: libabigail@sourceware.org, dodji@seketeli.org, kernel-team@android.com Subject: Re: [PATCH 2/3] Fix inheritance of scope_decl::insert_member_decl Message-ID: <20200710162732.GH995455@google.com> References: <20200709164523.1578400-1-gprocida@google.com> <20200709182250.1677238-1-gprocida@google.com> <20200709182250.1677238-3-gprocida@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200709182250.1677238-3-gprocida@google.com> X-Spam-Status: No, score=-29.2 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_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 List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2020 16:27:35 -0000 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 Reviewed-by: Matthias Maennich 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 >