From owner-svn-src-head@freebsd.org Mon Aug 1 05:51:45 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 7B7EEBAB974; Mon, 1 Aug 2016 05:51:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 43F2C1486; Mon, 1 Aug 2016 05:51:44 +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 mail104.syd.optusnet.com.au (Postfix) with ESMTPS id A72EE427BA4; Mon, 1 Aug 2016 15:51:40 +1000 (AEST) Date: Mon, 1 Aug 2016 15:51:39 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Jilles Tjoelker , Alexey Dokuchaev , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303586 - head/bin/sh In-Reply-To: Message-ID: <20160801154048.K884@besplex.bde.org> References: <201607311311.u6VDBYr8066638@repo.freebsd.org> <20160731134316.GB85936@FreeBSD.org> <20160731201614.GA58505@stack.nl> 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=EfU1O6SC 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=9xrvncSL6j3s53b_JZkA: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: Mon, 01 Aug 2016 05:51:45 -0000 On Sun, 31 Jul 2016, Warner Losh wrote: > On Sun, Jul 31, 2016 at 2:16 PM, Jilles Tjoelker wrote: >> On Sun, Jul 31, 2016 at 01:43:16PM +0000, Alexey Dokuchaev wrote: >>> On Sun, Jul 31, 2016 at 01:11:34PM +0000, Jilles Tjoelker wrote: >>>> New Revision: 303586 >>>> URL: https://svnweb.freebsd.org/changeset/base/303586 >> >>>> Log: >>>> sh: Fix a clang warning. >> >>>> Submitted by: bdrewery >> >>>> Modified: >>>> head/bin/sh/expand.c >> >>>> Modified: head/bin/sh/expand.c >>>> ============================================================================== >>>> --- head/bin/sh/expand.c Sun Jul 31 12:59:10 2016 (r303585) >>>> +++ head/bin/sh/expand.c Sun Jul 31 13:11:34 2016 (r303586) >>>> @@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in >>>> if (--in.nleft < 0) { >>>> if (in.fd < 0) >>>> break; >>>> - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR); >>>> + while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) >>>> + ; >> >>> `continue;' would be even better; some tools might barf at stray semicolon. >> >> Both continue; and ; (the latter with and without comment) occur in the >> source tree many times. I don't really like a continue that does nothing >> because it is at the end of a loop, so I prefer to make this whitespace >> change only (there are two more instances in bin/sh). I think a sole >> semicolon on a line is conspicuous enough that nothing additional is >> required. > > For humans, yes. For picky tools that warn about strange constructs, no. > Clang may be happy, but there's many other tools that expect you to declare > an 'empty' while loop with continue. This tradition has dated back to > at least the > late 80's... Buggy tools. I thought that programmers used the stand-alone semicolon since that is shorter and clearer. The stand-alone semicolon is bad if it is misformatted. 'while(foo());' is shorter and unclearer. A C parser must ignore whitespace, so you need a tool like indent that sort of understands whitespace to disallow while(foo()); but accept 'while (foo())\n\t;'. It is not far from full indent(1) and insisting on the correct number of \t's before the semicolon. Bruce