From owner-svn-src-head@freebsd.org Fri Jul 29 23:13:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5537BA7499; Fri, 29 Jul 2016 23:13:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 823A91DFA; Fri, 29 Jul 2016 23:13:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-149-109.carlnfd1.nsw.optusnet.com.au (c122-106-149-109.carlnfd1.nsw.optusnet.com.au [122.106.149.109]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id BD8C33C265B; Sat, 30 Jul 2016 09:13:41 +1000 (AEST) Date: Sat, 30 Jul 2016 09:13:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303485 - head/usr.bin/indent In-Reply-To: <201607291623.u6TGN08u064305@repo.freebsd.org> Message-ID: <20160730085927.B1012@besplex.bde.org> References: <201607291623.u6TGN08u064305@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=VIkg5I7X c=1 sm=1 tr=0 a=R/f3m204ZbWUO/0rwPSMPw==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=cXlg904i9bIos2gJljoA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 23:13:51 -0000 On Fri, 29 Jul 2016, Pedro F. Giffuni wrote: > Log: > indent(1): fix struct termination detection. > > Semicolons inside struct declarations don't end the declarations. > > Differential Revision: https://reviews.freebsd.org/D6966 (Partial) > Obtained from: Piotr Stefaniak > > Modified: > head/usr.bin/indent/indent.c > > Modified: head/usr.bin/indent/indent.c > ============================================================================== > --- head/usr.bin/indent/indent.c Fri Jul 29 16:17:54 2016 (r303484) > +++ head/usr.bin/indent/indent.c Fri Jul 29 16:23:00 2016 (r303485) > @@ -701,8 +701,10 @@ check_type: > break; > > case semicolon: /* got a ';' */ > - ps.in_or_st = false;/* we are not in an initialization or > - * structure declaration */ > + if (ps.dec_nest == 0) { > + /* we are not in an initialization or structure declaration */ > + ps.in_or_st = false; > + } This adds some style bugs. indent is written in a bad style that is very far from KNF, but perhaps it could format itself if it had an indent.pro. Part of its bad style is to use unnecessary parentheses a lot. But it mostly doesn't use unecessary braces. Except here. Another part of its bad style is to put comments to the right of the code, even when this requires misformatting them across multiple lines. The changed code gave example of both (the misformatting was to not have any whitespace between the semicolon and the comment so as to minimise comment indentation. This was actually another style bug. indent normally puts comments at the right at a tab stop even when this gives very narrow comments split across several lines). The changed code puts the comment on a line by itself. indent almost never does that elsewhere for comments about single statements. The comment here is technically for a block of compound statements, but the block has only 1 statement and was created by using excessive braces. > scase = false; /* these will only need resetting in an error */ > squest = 0; > if (ps.last_token == rparen && rparen_count == 0) Bruce