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 A45373851C3D for ; Fri, 22 Jan 2021 21:18:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A45373851C3D Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-UfYndmCoP3-WQJerv1Pe0w-1; Fri, 22 Jan 2021 16:18:45 -0500 X-MC-Unique: UfYndmCoP3-WQJerv1Pe0w-1 Received: by mail-qt1-f198.google.com with SMTP id h16so4270135qta.12 for ; Fri, 22 Jan 2021 13:18:45 -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=1A9e5cezHyZ+Mf8PrO7ijYTw/tfj+CoIwje/ZmYe45w=; b=CSdvbHGAaiUz88JAGsljmjkNiDy13Y3ajDFczelLhuNyhxj6gIZs98KuF3wtvnoiWE OtAQzqrH4AtDLvD0lYwniMgv58FI0DvcDQ8MLpua6cwWY1adhbb5H69PtSk3q8RkHXiS /moL3qHtLAs7QsyNX3VTTTYEuINKjFHL5v9bF9YoYmRdfJWHJVjcy8etVYc5gJkFmaeA q2IlnIt45wOfA5J9O+9a3RM8IKK00H0An1qGWjI1Ts+8pEc6enVVlUQ7G7zOSEr39VdK dnvE8lWc8WwxAp6e3pVSBg3AxeDL7X/NXnv7+1gL9s2oozm1XWkxDIUalwvIx8lqxVfX zTMg== X-Gm-Message-State: AOAM532Nlw5s640w/uL67SLXQl67JtCQu+KXnw8CJsrMXbes6g36vbtU s604Bo55b323a6vbrL8cDG/3GUhbftWxBkO7lNL+jY9uz5gyGpXARdBRVfRftLHvBLCb7HJJDym n81C1RrDwfgmgrCmeXqk3qbO1dAFNn7v3Ru0BmvyMaS7WnIe/5WUNi2+WyA7jnZ1jzA== X-Received: by 2002:a37:8e04:: with SMTP id q4mr6730861qkd.22.1611350324869; Fri, 22 Jan 2021 13:18:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBPg40NKOR3LL1rfsUib8lQb6NSPJlloDpR9yqDs+pru+Zi8w3ByNfz4iEYChriUwPrwzyFQ== X-Received: by 2002:a37:8e04:: with SMTP id q4mr6730835qkd.22.1611350324525; Fri, 22 Jan 2021 13:18:44 -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 y185sm1209107qkd.53.2021.01.22.13.18.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Jan 2021 13:18:43 -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: <5255efef-0df8-a172-2064-1b1050b36909@redhat.com> Date: Fri, 22 Jan 2021 16:18:42 -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.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 21:18:49 -0000 On 1/22/21 3:07 PM, Anthony Sharp wrote: > Hi Jason, > > Thanks for getting back to me so quickly. > > > Why two gcc-comit-mklog?  That would generate the log entries twice. > > It did in fact generate the log entries twice, but I deleted out the > second copy. Perhaps it would have made more sense to do git commit > --amend instead. > > > 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). > > Done. > > > Only one 'n' in inaccessible. > > Oops! > > Subsequent lines of a comment should be indented to line up with the > first line.  This applies to all your multi-line comments. > > > My bad, hopefully fixed now. > > Don't change the indentation of these blocks; in the GNU coding style > the { } are indented two spaces from the if. > > > I think I see what you mean; I forgot to indent the { } (and therefore > also everything within it, by two spaces). Hopefully fixed. > > The new line of arguments should be indented to line up with the > first one. > > > Fixed I think. > > Please find attached the latest patch version with all these changes. > git gcc-verify returns no problems and check_GNU_style.sh returns only > false positives. Source builds fine. To be super safe I re-cloned the > source and did git apply with the patch and it built and worked just > fine, and hopefully I haven't missed anything. > > Thanks again for your help. > Subject: [PATCH] This patch fixes PR17314. Previously, when class C attempted > to access member a declared in class A through class B, where class B > privately inherits from A and class C inherits from B, GCC would correctly > report an access violation, but would erroneously report that the reason was > because a was "protected", when in fact, from the point of view of class C, > it was really "private". This patch updates the diagnostics code to generate > more correct errors in cases of failed inheritance such as these. The first line of the commit message should be the subject line for the patch, i.e. "c++: private inheritance access diagnostics fix [PR17314]", then a blank line, then the rationale. > + if (parent_binfo != NULL_TREE > + && context_for_name_lookup (decl) > + != BINFO_TYPE (parent_binfo)) Here you want parens around the second != expression and its != token aligned with "context" > + complain_about_access (decl, diag_decl, diag_location, true, > + parent_access); ... > + complain_about_access (afi.get_decl (), afi.get_diag_decl (), > + afi.get_diag_decl (), false, ak_none); In both these calls, the second line is indented one space too far. Jason