From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38979 invoked by alias); 6 Jun 2017 13:12:46 -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 38654 invoked by uid 89); 6 Jun 2017 13:12:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=tad, belong X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 13:12:44 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F9B24DD62; Tue, 6 Jun 2017 13:12:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F9B24DD62 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2F9B24DD62 Received: from redhat.com ([10.40.205.13]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v56DCgtm018803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 6 Jun 2017 09:12:45 -0400 Date: Tue, 06 Jun 2017 13:12:00 -0000 From: Marek Polacek To: Martin Sebor Cc: David Malcolm , gcc-patches@gcc.gnu.org Subject: Re: [PING] Re: [PATCH] Fix-it hints for -Wimplicit-fallthrough Message-ID: <20170606131242.GO3413@redhat.com> References: <1493921803-37798-1-git-send-email-dmalcolm@redhat.com> <1495828794.9289.82.camel@redhat.com> <9aa52616-0cbf-31df-a18e-0ea9fbaf8db3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9aa52616-0cbf-31df-a18e-0ea9fbaf8db3@gmail.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-SW-Source: 2017-06/txt/msg00310.txt.bz2 On Fri, May 26, 2017 at 02:13:56PM -0600, Martin Sebor wrote: > On 05/26/2017 01:59 PM, David Malcolm wrote: > > Ping: > > https://gcc.gnu.org/ml/gcc-patches/2017-05/msg00334.html > > > > On Thu, 2017-05-04 at 14:16 -0400, David Malcolm wrote: > > > As of r247522, fix-it-hints can suggest the insertion of new lines. > > > > > > This patch updates -Wimplicit-fallthrough to provide suggestions > > > with fix-it hints, showing the user where to insert "break;" or > > > fallthrough attributes. > > > > > > For example: > > > > > > test.c: In function 'set_x': > > > test.c:15:9: warning: this statement may fall through [-Wimplicit > > > -fallthrough=] > > > x = a; > > > ~~^~~ > > > test.c:22:5: note: here > > > case 'b': > > > ^~~~ > > > test.c:22:5: note: insert '__attribute__ ((fallthrough));' to > > > silence this warning > > > + __attribute__ ((fallthrough)); > > > case 'b': > > > ^~~~ > > > test.c:22:5: note: insert 'break;' to avoid fall-through > > > + break; > > > case 'b': > > > ^~~~ > > I haven't read the patch but the notes above make me wonder: > > If the location of at least one of t hints is always the same > as that of the first "note: here" would it make sense to lose > the latter and reduce the size of the output? (Or lose it in > the cases where one of the fix-it hints does share a location > with it). I agree that it's a tad verbose but I'm not sure if it'd be easy to suppress printing case 2: ^~~~ more times simple enough. So I'd be fine with the current state. I'd also be happy with e.g. a.c: In function ‘foo’: a.c:7:9: warning: this statement may fall through [-Wimplicit-fallthrough=] x = 1; ~~^~~ a.c:8:5: note: here case 2: ^~~~ a.c:8:5: note: insert ‘__attribute__ ((fallthrough));’ to silence this warning + __attribute__ ((fallthrough)); or insert ‘break;’ to avoid fall-through + break; but I don't think we've got the means to do so. On the patch, I'd think that add_newline_fixit_with_indentation doesn't belong to gimplify.c, even though it only has one user. But I won't be able to approve it in any case. Marek