From owner-svn-src-head@freebsd.org Fri Jul 22 07:45:59 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 53750BA1525; Fri, 22 Jul 2016 07:45:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE7F1F68; Fri, 22 Jul 2016 07:45:58 +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 mail105.syd.optusnet.com.au (Postfix) with ESMTPS id D722A104483D; Fri, 22 Jul 2016 17:13:59 +1000 (AEST) Date: Fri, 22 Jul 2016 17:13:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexey Dokuchaev cc: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r303146 - head/usr.bin/sed In-Reply-To: <20160722043536.GB37437@FreeBSD.org> Message-ID: <20160722165435.C2805@besplex.bde.org> References: <201607211417.u6LEHaPR086378@repo.freebsd.org> <20160722043536.GB37437@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=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=W6mxSz3NVuVsKJmdymQA:9 a=CjuIK1q_8ugA:10 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, 22 Jul 2016 07:45:59 -0000 On Fri, 22 Jul 2016, Alexey Dokuchaev wrote: >> Log: >> sed(1): Appease older GCC. "Appease" actually seems to be the correct wording here since gcc's detection of a variable that might be used unitialized seems to report one that is not used uninitialized. > Isn't it also being dictated by style(9) and common sense? :) You missed that this combines a style fix in previous gcc appeasement (or just excessive paranoia) in one variable with appeasement for another variable, since copying the previous appeasement would copy its style bug. The 2 variables are used in exactly the same limited way. >> Modified: >> head/usr.bin/sed/process.c >> >> @@ -97,11 +97,12 @@ process(void) >> { >> struct s_command *cp; >> SPACE tspace; >> - size_t oldpsl = 0; >> + size_t oldpsl; >> char *p; >> int oldpsanl; >> >> p = NULL; >> + oldpsanl = oldpsl = 0; Multiple assignments on a single line is not very good style and is probably not KNF. Here it is further from being good style since the variables have different types. Since both types are integral and the value is 0 the implicit type conversions don't change the value. However, compilers should warn about down-converting a size_t to an int unless they do the analysis that this is safe because the value in the size_t is known to fit in the int. Bruce