From owner-svn-src-all@freebsd.org Sun Jan 15 09:26:47 2017 Return-Path: Delivered-To: svn-src-all@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 6DB2ACA41CB; Sun, 15 Jan 2017 09:26:47 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DCD011D6; Sun, 15 Jan 2017 09:26:47 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x241.google.com with SMTP id e4so1951703pfg.0; Sun, 15 Jan 2017 01:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=wEWQI1T9e4E0AKmj/WQAKnYiI/P5JEqmn5BOGef8yLk=; b=edDJq9b6P3bb+7wgk01+vEqjtyU6aadSZFTGUdPNKyNnXAXmr8epXWSjAltY693UEU DwPVWTbKE014b3YPJ0Jw9EyITR54Q3xizcxDlIH/AzzqMDlbyKmfBAI0TqiPOpAFNl1o GxxPCNg+CA/UMctDL7A4wnogL8WFQJVl41zeaMLpZMzEc8sFOpgOYDRzqFnLSMLj1n5Y r+5hxt1Wc55EfgrqZsJn64hifd5qxFRzY0lSyqB+JUzlA6a7SSxOUsJKL/beiamJ10hy UmyQ25I7TX6bNPPq3Fu63IiyKCEsYqK7o4F4FF5uUTZ2r6c10XpMTdubNSsvcwRRKS3c urjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=wEWQI1T9e4E0AKmj/WQAKnYiI/P5JEqmn5BOGef8yLk=; b=NTAmpQEuiNNdB4WA24WHNBcNprF0T1yHm6pJqQuoQGNsF4iFLRf0CBdr2mLqpJ/OfQ o3wbh6c4w3SoBmMCS2Ex7fxFJ9BoeJzAcPnpmVvimQ/3OTeCBhOX9K3pLellhUC88zY7 BeQhPOuUIOTBz4pbryLiVQ70DMX2/QriatEI/MHwaR62Vn3OmBP7UEU+F0Ogz33aUm5A V/luPsMDKF0HDxpsLVPsMtovhnm6T1OArFDIvkpkanXLB+Q5FzIGa1SjZuaDaAxjJNRO YumOLGJjbPL+F9anSLeItnYA/FknLpLL7NZ+H9oyX8vke3UJrUp9eiXhG20sxnf4Hf1I kGZA== X-Gm-Message-State: AIkVDXJFMSHaNaqq2lOAFeNsZNIpmcDibGy2yVUn/tCoIQsPeAm75y7LryQMRWJ2f1xLVA== X-Received: by 10.98.102.21 with SMTP id a21mr26223007pfc.29.1484472406724; Sun, 15 Jan 2017 01:26:46 -0800 (PST) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id l12sm32092758pfj.37.2017.01.15.01.26.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Jan 2017 01:26:45 -0800 (PST) Subject: Re: svn commit: r312119 - head/sys/kern Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_EC0928AB-B910-47A4-B5CE-0E75932072CE"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <20170115172228.U55241@besplex.bde.org> Date: Sun, 15 Jan 2017 01:26:44 -0800 Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <53422412-6581-4C63-AD2F-8C3F5B4D4642@gmail.com> References: <201701140506.v0E56EHT068275@repo.freebsd.org> <20170115172228.U55241@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2017 09:26:47 -0000 --Apple-Mail=_EC0928AB-B910-47A4-B5CE-0E75932072CE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 14, 2017, at 22:49, Bruce Evans wrote: >=20 > On Sat, 14 Jan 2017, Ngie Cooper wrote: >=20 >> Log: >> encode_long, encode_timeval: mechanically replace `exp` with = `exponent` >>=20 >> This helps fix a -Wshadow issue with exp(3) with = tests/sys/acct/acct_test, >> which include math.h, which in turn defines exp(3) >=20 > But kern_acct.c doesn't include math.h. >=20 > This messes up the kernel sources to simplify abusing them in tests. >=20 > The bug was only in the sed script in the makefile that translates > kern_acct.c to convert.c. It converts 'log(' to 'syslog(', but is = missing > conversion of the exp identifier to sysexp. >=20 >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/kern/kern_acct.c Sat Jan 14 05:02:53 2017 = (r312118) >> +++ head/sys/kern/kern_acct.c Sat Jan 14 05:06:14 2017 = (r312119) >> @@ -469,8 +469,8 @@ static uint32_t >> encode_timeval(struct timeval tv) >> { >> int log2_s; >> - int val, exp; /* Unnormalized value and exponent */ >> - int norm_exp; /* Normalized exponent */ >> + int val, exponent; /* Unnormalized value and exponent */ >> + int norm_exponent; /* Normalized exponent */ >> int shift; >>=20 >> /* >=20 > Now the bug is also bad style in the kernel sources. The regexp was = too > simple and munged norm_exp too, but not the exp's in comments. The > comments are more banal than before now that they don't even expand = 'exp' > but just echo 'exponent'. >=20 >> ... >> - return (((FLT_MAX_EXP - 1 + exp + norm_exp) << (FLT_MANT_DIG - = 1)) | >> + return (((FLT_MAX_EXP - 1 + exponent + norm_exponent) << = (FLT_MANT_DIG - 1)) | >> ((shift > 0 ? val << shift : val >> -shift) & MANT_MASK)); >=20 > Here the expansion also broke the formatting. >=20 > The details of the abuse in the test program are that acct_test.c = includes > math.h and then includes then convert.c which is nearly a copy of the = kernel > source file. This takes clean include files and not enabling warnings > about redundant declarations to have a chance of working. >=20 > I use a similar hack to test libm, and didn't have to mess up the = sources > too much to make the translation not too hard. Files have to be = copied > just to make the include paths manageable, and to compile them all = with > the same CFLAGS since this is a performance test. The most = complicated > parts are to avoid library functions because they might not match the > sources or were compiled with different CFLAGS. The sources are not = well > organized well enough for my preferred method of "cc ${CLAGS} *.c" to = work. Thank you for the concerns. I=E2=80=99ve modified the approach based on = your recommendations above and submitted it as r312216. -Ngie --Apple-Mail=_EC0928AB-B910-47A4-B5CE-0E75932072CE Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYe0BVAAoJEPWDqSZpMIYVx4EQAMY2HVJRY8sJdUntdKbCqxkB Fp2y6FlEGyQqaSIYFqlzW5cAG1JtxjcBalKpT8mcN13JoN36IBYslxUmLyvo2GF6 tfOfavAYgIqJGJcnwmTfoRj99O7FIk72L43FbRSh1BOO7CHbpIMY1miOPZJX2hmK 2DUFFbXxBNT3K/43VXdLCXqbiMz9JRbOw8zu94anTDOyf6KNZ7OeKWgmXErD2dR5 TEcdJHxfUD6CxsM8Sy2hJ4dYp+gMYMTHtQWHmh0MyQiVyKN8t53nW80ziyInkXII wV65aagnuDzCa1S3CnwtAvMePfw6487fMj2OyKU1G2MsspnrZHEfgfvVaHXkgFRD u757fbaGGgov4EELv1IMAd6BePJ9h4AkkwS0EethWOehZb1Q84S91tANimwDmMS8 tURdqlcYxH/6iqMPyZCv1Fee47VC40CY6dcj6wZPZQrBVAl4UI4cfbCgVfgTtQTF wTBm4ROjui5Pbf47r2I062vUMnjRG48SX1kH5JaTdOMOZnRbN5VVYJLUcyXG53wO oxyF4kFv/sqz0mUED4LJArK34Cz/V1XNnoc+jLZ/LGuIh/xGPOwIQu1Tv3885PH3 L4hgm8yDlDKI0Fg1AFwIPvpIm3hVmC2N0AZbec3seQrRyjbaWlXc4LfEI7D3bzwR iP54g1hLCzw+P0cL6NAt =DKD0 -----END PGP SIGNATURE----- --Apple-Mail=_EC0928AB-B910-47A4-B5CE-0E75932072CE--