From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41675 invoked by alias); 23 Jul 2017 20:49:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 41658 invoked by uid 89); 23 Jul 2017 20:49:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1965, simplicity X-HELO: cc-smtpout3.netcologne.de Received: from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de) (89.1.8.213) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jul 2017 20:49:02 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id 901CB12661; Sun, 23 Jul 2017 22:49:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin2.netcologne.de (Postfix) with ESMTP id 88E8F11DDD; Sun, 23 Jul 2017 22:49:00 +0200 (CEST) Received: from [89.0.10.77] (helo=cc-smtpin2.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 59750bbc-022c-7f0000012729-7f000001aff8-1 for ; Sun, 23 Jul 2017 22:49:00 +0200 Received: from linux-mqtz.fritz.box (xdsl-89-0-10-77.netcologne.de [89.0.10.77]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA; Sun, 23 Jul 2017 22:48:59 +0200 (CEST) Date: Sun, 23 Jul 2017 20:49:00 -0000 From: Volker Reichelt Subject: Re: [PATCH] New C++ warning option '-Wduplicated-access-specifiers' To: David Malcolm cc: gcc-patches List In-Reply-To: <1500684971.10760.4.camel@redhat.com> Message-ID: References: <1500652589.7686.31.camel@redhat.com> <1500684971.10760.4.camel@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE X-SW-Source: 2017-07/txt/msg01382.txt.bz2 On 21 Jul, David Malcolm wrote: > On Fri, 2017-07-21 at 19:58 +0200, Volker Reichelt wrote: >> On 21 Jul, David Malcolm wrote: >> > On Thu, 2017-07-20 at 18:35 +0200, Volker Reichelt wrote: >> >> Hi, >> >> >> >> the following patch introduces a new C++ warning option >> >> -Wduplicated-access-specifiers that warns about redundant >> >> access-specifiers in classes, e.g. >> >> >> >> class B >> >> { >> >> public: >> >> B(); >> >> >> >> private: >> >> void foo(); >> >> private: >> >> int i; >> >> }; >> >> >> >> test.cc:8:5: warning: duplicate 'private' access-specifier [ >> >> -Wduplicated-access-specifiers] >> >> private: >> >> ^~~~~~~ >> >> ------- >> >> test.cc:6:5: note: access-specifier was previously given here >> >> private: >> >> ^~~~~~~ {...snip...] >> > If you're going to implement a fix-it hint for this, there should >> be a >> > test case that tests it (probably as a separate file, e.g. >> Wduplicated >> > -access-specifiers-2.C, to allow for the extra option - >> -fdiagnostics >> > -show-caret, covering just one instance of the diagnostic firing, >> for >> > simplicity). >> >> I actually did try that, but dejagnu somehow gets confused. >> To me it looks like the reason for this is that both multi-line >> messages >> are so similar. I'll give it a second try, though. > > I'm not sure what you mean by "both" multi-line messages; shouldn't > there be just one multi-line message for the fix-it hint. > > Isn't this like e.g. g++.dg/cpp0x/auto1.C ? (an example of a testcase > that verifies a deletion fix-it hint) > > Dave There are two multi-line messages. One for the warning and one for the note, see the example above the "[...snip...]". The message after the note consists of the first two lines of the message after the warning. This seems to confuse dejagnu. However, I managed to work around this problem. I'll post an updated patch soon. Regards, Volker