From owner-svn-src-head@freebsd.org Fri Jul 22 14:52:05 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 2C9DEBA166E for ; Fri, 22 Jul 2016 14:52:05 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm20.bullet.mail.bf1.yahoo.com (nm20.bullet.mail.bf1.yahoo.com [98.139.212.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D96E014EE for ; Fri, 22 Jul 2016 14:52:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1469199117; bh=WgJd9D1VJ3g4OAHmBCdiJeVVn6S7ZIQvkH0rGCFQBjY=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=hh4SD+ntSUHpje1hf2HBNeF5YFBylWbqZX/D09bHLIy+/270C4FPbPL08EjEaw2ycfAPkp66rqbLVYvTNCZoS5RZnkiNfUK1n/CXB+G8j8hR61exa3AxKOULhDXQNY7K3VCcDx+auaqoSPUYqnCqZhdwECManIlrSq6qb/1LeeiXIOZXUX2azPpL4vItXloXgbQbcJ44ilPSYI/E29OAGBnU469Z0+mPLYqCLFWEzOuAR5IDEUGr49fiy4OM8Tv4JzfDGl/W0oxIRkmxkHmEKKW8gOZKzmOfiwpcrUrgLjQyNEE8QXfmWdhv1SxfI44/S7GYhakmhgZC/uzuc3mi/Q== Received: from [66.196.81.173] by nm20.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 Received: from [98.139.211.204] by tm19.bullet.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 Received: from [127.0.0.1] by smtp213.mail.bf1.yahoo.com with NNFMP; 22 Jul 2016 14:51:57 -0000 X-Yahoo-Newman-Id: 450564.16098.bm@smtp213.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: _u.xcr0VM1kCK_lObeOEPTfBWsOp2XhH_5UzDXtKl7eeYHJ wOlpODEtLvczs5H7HYAzzAh_c5F3HTR5hgtQD5P.gvRIKA_qE1ZpyqmNkmri xmoyOk3jUliVa4mcsWNWs42492Cp_dlghf.1B8NLNx1qVceU_NCe3Qpx2o3y ZwqCy0QWAJm9mpg0u1jIIg4M6fdP6bCQC.QrVd9h7lFPi5TZof_D9aTDvuN. 0CN9qpIu01PfMjso0uoHuzGp5G5vflunO1hsbOznavNgG_y.Cq_3k4sgHouC haEBWyp7d15R4QUO10SjhxNpJTmPNNYFq.VA3u6mnvZ6yuTUXBhKPR9C6u16 Ad6_qtRUYdCWB4VlfbMEkrtaEI9y9gtPIfi4SDQpKrcoN8JivEPzzkqxhULx Ll8EZhAyHzSAdcF3PSopVquSADTpKP0kq4DPuwsztAyU5k.GuH1.rl0wSeIO HN56na1qzjg22JpeOJKfSIkS.io.Jf8oFZMFeBy8pKCWr7OYcpibhtIlO_hG fNYuhVvC0LAXiP.mpyld.TXqsbEJy.L6vGAUFQmc4wiiZ5A-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r303146 - head/usr.bin/sed To: Bruce Evans , Alexey Dokuchaev References: <201607211417.u6LEHaPR086378@repo.freebsd.org> <20160722043536.GB37437@FreeBSD.org> <20160722165435.C2805@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: Date: Fri, 22 Jul 2016 09:52:04 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160722165435.C2805@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 14:52:05 -0000 On 07/22/16 02:13, Bruce Evans wrote: > 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. > Yes, the first one is just a style fix while I was there. The oldpsanl bogusness was breaking the build with gcc42. gcc48+, clang and coverity all agree it was a false positive. It was likely a side effect of raising the WARNS level to 5. >>> 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. > Doing the multiple assignment seemed natural and readable as both are (perhaps equally bogus) initializations. I did notice the different types after committing. Perhaps swapping the assignment would have been preferable? I suspect the compiler manages to optimize out the casting. Pedro.