From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH] srcpos: correct column numbers Date: Fri, 19 Jan 2018 16:44:54 +1100 Message-ID: <20180119054454.GA28299@umbus.fritz.box> References: <4eec9dbb-c047-86ae-e4b2-08de9f0499fe@gmail.com> <20180118042202.GI30352@umbus.fritz.box> <20180118070123.GV30352@umbus.fritz.box> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ikeVEW9yuYc//A+q" Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1516341480; bh=fwqneLphpZrB67pR/jTPjfX+IlE49l125afarU6nR3w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LT9RI9qPhpzY3DlLzpwq90l/FMtyCKPH64gXJc3uy7YwRbBgH0naeV6c32P1gcHEd NDxwg+rxdMg99U6fz0JtxN+0rgZ9KgkVlUfmSMRzhehzgt5SED6LTQfqMIoCKIpyqh 2wNyJzVJ8bVpLgbAwVyPL+fGZ1ZSCt08B/6sjZog= Content-Disposition: inline In-Reply-To: Sender: devicetree-compiler-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: To: Julia Lawall Cc: Frank Rowand , devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 18, 2018 at 11:12:16AM +0100, Julia Lawall wrote: >=20 >=20 > On Thu, 18 Jan 2018, David Gibson wrote: >=20 > > On Thu, Jan 18, 2018 at 06:15:47AM +0100, Julia Lawall wrote: > > > > > > > > > On Thu, 18 Jan 2018, David Gibson wrote: > > > > > > > On Tue, Jan 16, 2018 at 07:10:23AM +0100, Julia Lawall wrote: > > > > > > > > > > > > > > > On Mon, 15 Jan 2018, Frank Rowand wrote: > > > > > > > > > > > On 01/15/18 10:33, Julia Lawall wrote: > > > > > > > The start of a line is column 0, at least according to emacs. > > > > > > > > > > > > According to vim, the first character of a line is column 1. I= don't know > > > > > > if it has a concept of column 0, to the left of that character. > > > > > > > > > > > > $ vim --version > > > > > > VIM - Vi IMproved 7.4 > > > > > > > > > > > > Let the editor wars begin.... :-) > > > > > > > > > > > > Personally, I use vim, but if the dtc column numbers match emac= 's world view > > > > > > instead of vim's, that is fine with me. > > > > > > > > > > At the start of a line, ie just after a \n, there has been no cha= racter. > > > > > This change made the column numbers work for me in the annotation= s. > > > > > > > > > > There is also the issue of tabs. David wanted tabs to count as 8 > > > > > characters, but actually cpp converts tabs to spaces. So if a dt= s file > > > > > has been through cpp, the numbers will be smaller. So it could b= e better > > > > > to consider tabs to be 1 character, to not have to think about wh= at kind > > > > > of include was used. > > > > > > > > Urgh.. debating which editor to match sounds like it's going to be a > > > > rathole. > > > > > > > > Let's try a different approach: does gcc ever report column numbers? > > > > If so, what's its interpretation? > > > > > > Chosen at random, I have the following error: > > > > > > drivers/thermal/kirkwood_thermal.c:88:15: warning: assignment makes > > > pointer from > > > integer without a cast [enabled by default] > > > priv->sensor =3D devm_request_and_ioremap(&pdev->dev, res); > > > > > > and the following code: > > > > > > priv->sensor =3D devm_request_and_ioremap(&pdev->dev, res); > > > > > > In emacs, the go to the line and type control f 15 times solution put= s the > > > cursor right afher after the =3D. The column numbers of emacs report= 22 for > > > that position. I guess in vim, putting the cursor right on the =3D w= ould > > > report 15. > > > > > > When I run the dts compiler on tests/test_tree1.dts, for line 39: > > > > > > > > > compatible =3D "subsubnode2", "subsubnode"; > > > > > > I get the start and end as 24 and 65. 24 is what emacs shows as the > > > column number when I put the cursor right on the c. 65 is what the c= olumn > > > number shows when I put the cursor right past the semicolon. > > > > > > I tried to move around in vim, but I don't know how it works. It see= ms to > > > report the position of the c as 4 or 25. It seems to report the posi= tion > > > of the final semicolon as 44 or 65. I am not sure how it work though, > > > because it gives the impression that there is a single blank character > > > before c, which is not the case. > > > > Ok, let's go with the gcc definition, which appears to be "# of bytes > > past the last \n". >=20 > So that would be the strategy of the patch, where seeing a newline sets > the counter to 0. Right, but we should kill the tab expansion stuff at the same time. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlphhdYACgkQbDjKyiDZ s5JlsxAAvMcxu2b6vebzdTe4srDLjyiWX4CxZUXe96XtaFQmpl0Ek9jbZR77LHGQ c7V/5OjwB39lylbQ/xAt2WIBzzlCpYXrSZMxbyT4ITb8kn8+9cRb0MtXPzzDeZCo FRF+knOrUn/sOzfkgqg6okVvlWf5KjITxAhXor3fKT7DCxrx/i2u87Ey8ba9Kd2l UjN9BN1KLgw4Oqrdi2WGn1W8nvJ5j3PB9S4sJxhijxHqJUdLqa02tn4MNF8amTnN dNNE/GrnQP1k8yiCGlsKlqAi8FmmggbW8Z+eOBs9RLqhIVag87Dk0yGw05d+Yhrf ecq7pefXgnjCN4/BAvnWpKsSHmg3zGnvCUFz+U7S3GFeMbUesdfoJbbDukKXqsa+ HkQ1I6O+0rYJq9fTeHfomkpxZq0tJsj6U2U5CIUaHdDUf0J+QT9OxkKWsu6PyVQs 2U7llK4mz1ozBz6HDfrPPlyp2hEWMRekT7exlA6d7xN0ETqHlcfRaS6Qo/UKkudE yDPtofpJlACDh101B2Y3rO/goOfiv59f2cSu2Ir6uBSsf7tzU8AJlSUHBhsromPK 3sHMFvP+Xv6C8JSuC5J3Whh5G/m7hKBr/cu6pxmdGkhrlKD2r4kCdJh4iMa3mYJ6 4FAyfydMWxgyyiz9GfBiLbc0HGWDgHcgIz2AlXsCmWDO5I8dRiQ= =RJme -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q--