From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 5F93A384607A for ; Fri, 22 Jan 2021 03:44:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F93A384607A Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-501-wBoWVUzCMumdhIitk5dzsw-1; Thu, 21 Jan 2021 22:44:32 -0500 X-MC-Unique: wBoWVUzCMumdhIitk5dzsw-1 Received: by mail-qv1-f72.google.com with SMTP id c3so2901519qve.15 for ; Thu, 21 Jan 2021 19:44:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=R97a2Q0sLCjlhPZ9Qwng1hj0sJTx3r+pQqrbczDQPHk=; b=dHPmn7d8R3iOJKyh2rNxM3AGwFb5Ov/DBl8FAZU4y6173EEtTBRa0QIqZtG6bgHERa 8TrS2hkGrkDTsF1ecX36fW7M2GLz3BkLHBwvy906XX0ZRuO2lU3u0lG46iIzUsPNaFqq kj3GnQQViuOs/dASZO3L+P+AOllo8m/tLlv9yqPcJdx8HPycNYuf3pynkBoMOl3n8dr/ Di1q5VgTXe2r0lVOsQu2D8ADTFvajENfxzYvH9U7UIdQHHEbm2zDxcDiieLEZR1Q1RxT bzFI/3cFlm6B8rIZWR448rbWaUvKYYN762Ozxpn6jrDFUI2A4NfbaKdas6NkN0WEv6Yj kdCA== X-Gm-Message-State: AOAM5327HFLRzd6ojVm+P7lnmsbRCSCoHcDuUS4cY6VLLt7pWJbVeFoA cpYZBEg239xuMpfwVy2cIBxVsp2u5zE1UCII05wvDel6FWMCpdCJ/x6pzCYh2moGyDrsXo2+Qg0 4esvn/qKTfeQYhAad1ugvRvkCGTZGuY4SSyKfYRo4wm+9foJiu7Tafo9L6ldUy/lCBg== X-Received: by 2002:ac8:4557:: with SMTP id z23mr2759928qtn.191.1611287071861; Thu, 21 Jan 2021 19:44:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJySLjDq1Ycs0KKAA6pQCmHzc3hq6iIf0irOmpZnhp1aNBUw2ZYbzPWmeXFiXlbfUeGPH2KplA== X-Received: by 2002:ac8:4557:: with SMTP id z23mr2759914qtn.191.1611287071527; Thu, 21 Jan 2021 19:44:31 -0800 (PST) Received: from [192.168.1.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id i13sm5333631qkk.83.2021.01.21.19.44.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Jan 2021 19:44:30 -0800 (PST) Subject: Re: [PATCH] c++: private inheritance access diagnostics fix [PR17314] To: Anthony Sharp Cc: gcc-patches@gcc.gnu.org References: <8beca582-97eb-3e4c-1437-162ae896f031@redhat.com> <92edd773-5832-6371-4003-d29d1539202a@redhat.com> From: Jason Merrill Message-ID: Date: Thu, 21 Jan 2021 22:44:29 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 03:44:41 -0000 On 1/21/21 2:28 PM, Anthony Sharp wrote: > Hi Jason, > > I've finally completed my copyright assignment form. I've attached it > to this email for reference. > >> You don't need write access to the main repository to use these commands >> on your local copy. One nice thing about git compared to svn is that >> you don't need to touch the server for anything but push and pull. >> >> Incidentally, how are you producing your patch? Maybe try git >> format-patch instead. > > The method I am using at the moment is the one Ranjit Mathew talks > about here: http://rmathew.com/articles/gcj/crpatch.html. Actually, > having just re-read it, it says: 'NOTE: This is not the “proper” or > “official” way of creating and submitting patches - that process has > been explained in detail elsewhere. That process requires one to use > Subversion (SVN). The process described here is meant for “one-off > hackers” or people who cannot use SVN for some reason or the other.' > ... oops! > > It's my fault kind of - the official GCC webpage > (https://gcc.gnu.org/gitwrite.html) explaining how to do it is called > 'Read-write Git access' so I assumed it was only relevant for people > who have access to the repo, but I see that is not the case. > > I've tried the git way of doing it and I'm attaching a new patch file > that (hopefully) is better this time. Basically what I did was what > you suggested: > > git pull > contrib/gcc-git-customization.sh > (make changes) > git add * > git gcc-commit-mklog > git gcc-commit-mklog --amend > git format-patch -1 master > > I also re-built the source just to make sure I hadn't messed anything > up. I re-ran the C++ regression tests using make check-c and make > check-c++. Whilst I did not do a before/after comparison of the > results, I checked the FAILs in gcc.sum and g++.sum and they all > looked like they had nothing to do with my code. All the code is the > same as before, so I'm thinking it should be fine (I just wanted to be > safe). Also checked against check_GNU_style.sh. > > Assuming that's all fine, as for the code itself, there might well be > some tweaks that could make it better, and so if that is the case then > please let me know. The code looks good, I just have some minor tweaks. Thanks! > +++ b/gcc/cp/semantics.c ... > +extern access_kind access_in_type (tree type, tree decl); ... > +static tree > +get_parent_with_private_access (tree decl, tree binfo) Instead of making access_in_type non-static, let's defiine get_parent_with_private_access in search.c and declare it in cp-tree.h (with the declarations of nearby search.c functions). > + /* If we have not already figured out why DECL is innaccessible... */ ... > + /* Couldn't figure out why DECL is innaccesible, so just say it's > + innaccessible. */ Only one 'n' in inaccessible. There are various minor formatting issues: (https://www.gnu.org/prep/standards/standards.html#Formatting) > + /* Couldn't figure out why DECL is innaccesible, so just say it's > + innaccessible. */ Subsequent lines of a comment should be indented to line up with the first line. This applies to all your multi-line comments. > - { > - if (issue_error) > - error ("%q#D is private within this context", diag_decl); > - inform (DECL_SOURCE_LOCATION (diag_decl), > - "declared private here"); > - } > + { > + if (issue_error) > + error ("%q#D is private within this context", diag_decl); > + inform (DECL_SOURCE_LOCATION (diag_location), "declared private here"); > + } Don't change the indentation of these blocks; in the GNU coding style the { } are indented two spaces from the if. > + tree parent_binfo = get_parent_with_private_access (decl, > + basetype_path); ... > + complain_about_access (decl, diag_decl, diag_location, true, > + parent_access); The new line of arguments should be indented to line up with the first one. Jason