From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120508 invoked by alias); 8 Jun 2015 18:46:03 -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 120496 invoked by uid 89); 8 Jun 2015 18:46:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f180.google.com Received: from mail-wi0-f180.google.com (HELO mail-wi0-f180.google.com) (209.85.212.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 08 Jun 2015 18:46:01 +0000 Received: by wibdq8 with SMTP id dq8so94933608wib.1 for ; Mon, 08 Jun 2015 11:45:59 -0700 (PDT) X-Received: by 10.180.96.232 with SMTP id dv8mr958087wib.22.1433789158941; Mon, 08 Jun 2015 11:45:58 -0700 (PDT) Received: from localhost ([95.144.14.193]) by mx.google.com with ESMTPSA id fm8sm2363522wib.9.2015.06.08.11.45.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2015 11:45:57 -0700 (PDT) From: Richard Sandiford To: Patrick Palka Mail-Followup-To: Patrick Palka ,gcc-patches@gcc.gnu.org, joseph@codesourcery.com, jason@redhat.com, dmalcolm@redhat.com, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org, joseph@codesourcery.com, jason@redhat.com, dmalcolm@redhat.com Subject: Re: [PATCH] Refactor -Wmisleading-indentation API and extend coverage References: <1433707596-6988-1-git-send-email-patrick@parcs.ath.cx> Date: Mon, 08 Jun 2015 18:59:00 -0000 In-Reply-To: <1433707596-6988-1-git-send-email-patrick@parcs.ath.cx> (Patrick Palka's message of "Sun, 7 Jun 2015 16:06:36 -0400") Message-ID: <87wpzeca3f.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2015-06/txt/msg00612.txt.bz2 Patrick Palka writes: > At the same time this patch extends the coverage of the > -Wmisleading-indentation implementation to catch misleading indentation > involving the semicolon. (These changes are all contained in > c-indentation.c.) For example, now we warn on the following code > samples: > > if (flag); > foo (); > > while (flag); > { > ... > } > > if (flag); { > ... > } > > if (flag) > ; /* blah */ { > ... > } > > if (flag); foo (); > > while avoiding to warn on code that is poorly indented but not > misleadingly so; > > while (flag); > foo (); > > while (flag) > ; > foo (); Maybe I've just been doing too much Python recently, but unlike the other two examples, this one does seem a little misleading. What would happen for: while (flag) /* blah */; foo (); where the semicolon is hidden after a comment? Thanks to David and you for the patches btw -- looks like a really useful feature. Richard > if (flag1) > ; > if (flag) > ; > else > ...