* [PATCH] srcpos: correct column numbers
@ 2018-01-15 18:33 Julia Lawall
2018-01-16 0:20 ` Frank Rowand
0 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2018-01-15 18:33 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
The start of a line is column 0, at least according to emacs.
Every character counts, so need to increment by 1 before adjusting for tab.
Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
---
srcpos.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/srcpos.c b/srcpos.c
index 9d38459..e8fced9 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -154,7 +154,7 @@ void srcfile_push(const char *fname)
srcfile->prev = current_srcfile;
srcfile->lineno = 1;
- srcfile->colno = 1;
+ srcfile->colno = 0;
current_srcfile = srcfile;
}
@@ -223,8 +223,9 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
for (i = 0; i < len; i++)
if (text[i] == '\n') {
current_srcfile->lineno++;
- current_srcfile->colno = 1;
+ current_srcfile->colno = 0;
} else if (text[i] == '\t') {
+ current_srcfile->colno++;
current_srcfile->colno =
ALIGN(current_srcfile->colno, TAB_SIZE);
} else {
--
2.7.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
2018-01-15 18:33 [PATCH] srcpos: correct column numbers Julia Lawall
@ 2018-01-16 0:20 ` Frank Rowand
[not found] ` <4eec9dbb-c047-86ae-e4b2-08de9f0499fe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Frank Rowand @ 2018-01-16 0:20 UTC (permalink / raw)
To: Julia Lawall, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
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.
-Frank
>
> Every character counts, so need to increment by 1 before adjusting for tab.
>
> Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> ---
> srcpos.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/srcpos.c b/srcpos.c
> index 9d38459..e8fced9 100644
> --- a/srcpos.c
> +++ b/srcpos.c
> @@ -154,7 +154,7 @@ void srcfile_push(const char *fname)
> srcfile->prev = current_srcfile;
>
> srcfile->lineno = 1;
> - srcfile->colno = 1;
> + srcfile->colno = 0;
>
> current_srcfile = srcfile;
> }
> @@ -223,8 +223,9 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
> for (i = 0; i < len; i++)
> if (text[i] == '\n') {
> current_srcfile->lineno++;
> - current_srcfile->colno = 1;
> + current_srcfile->colno = 0;
> } else if (text[i] == '\t') {
> + current_srcfile->colno++;
> current_srcfile->colno =
> ALIGN(current_srcfile->colno, TAB_SIZE);
> } else {
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
[not found] ` <4eec9dbb-c047-86ae-e4b2-08de9f0499fe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-01-16 6:10 ` Julia Lawall
2018-01-18 4:22 ` David Gibson
0 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2018-01-16 6:10 UTC (permalink / raw)
To: Frank Rowand; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
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 character.
This change made the column numbers work for me in the annotations.
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 dts file
has been through cpp, the numbers will be smaller. So it could be better
to consider tabs to be 1 character, to not have to think about what kind
of include was used.
julia
>
> -Frank
>
> >
> > Every character counts, so need to increment by 1 before adjusting for tab.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> > ---
> > srcpos.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/srcpos.c b/srcpos.c
> > index 9d38459..e8fced9 100644
> > --- a/srcpos.c
> > +++ b/srcpos.c
> > @@ -154,7 +154,7 @@ void srcfile_push(const char *fname)
> > srcfile->prev = current_srcfile;
> >
> > srcfile->lineno = 1;
> > - srcfile->colno = 1;
> > + srcfile->colno = 0;
> >
> > current_srcfile = srcfile;
> > }
> > @@ -223,8 +223,9 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
> > for (i = 0; i < len; i++)
> > if (text[i] == '\n') {
> > current_srcfile->lineno++;
> > - current_srcfile->colno = 1;
> > + current_srcfile->colno = 0;
> > } else if (text[i] == '\t') {
> > + current_srcfile->colno++;
> > current_srcfile->colno =
> > ALIGN(current_srcfile->colno, TAB_SIZE);
> > } else {
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
2018-01-16 6:10 ` Julia Lawall
@ 2018-01-18 4:22 ` David Gibson
[not found] ` <20180118042202.GI30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2018-01-18 4:22 UTC (permalink / raw)
To: Julia Lawall; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2648 bytes --]
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 character.
> This change made the column numbers work for me in the annotations.
>
> 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 dts file
> has been through cpp, the numbers will be smaller. So it could be better
> to consider tabs to be 1 character, to not have to think about what 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?
>
> julia
>
> >
> > -Frank
> >
> > >
> > > Every character counts, so need to increment by 1 before adjusting for tab.
> > >
> > > Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
> > > ---
> > > srcpos.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/srcpos.c b/srcpos.c
> > > index 9d38459..e8fced9 100644
> > > --- a/srcpos.c
> > > +++ b/srcpos.c
> > > @@ -154,7 +154,7 @@ void srcfile_push(const char *fname)
> > > srcfile->prev = current_srcfile;
> > >
> > > srcfile->lineno = 1;
> > > - srcfile->colno = 1;
> > > + srcfile->colno = 0;
> > >
> > > current_srcfile = srcfile;
> > > }
> > > @@ -223,8 +223,9 @@ void srcpos_update(struct srcpos *pos, const char *text, int len)
> > > for (i = 0; i < len; i++)
> > > if (text[i] == '\n') {
> > > current_srcfile->lineno++;
> > > - current_srcfile->colno = 1;
> > > + current_srcfile->colno = 0;
> > > } else if (text[i] == '\t') {
> > > + current_srcfile->colno++;
> > > current_srcfile->colno =
> > > ALIGN(current_srcfile->colno, TAB_SIZE);
> > > } else {
> > >
> >
> >
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
[not found] ` <20180118042202.GI30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2018-01-18 5:15 ` Julia Lawall
2018-01-18 7:01 ` David Gibson
0 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2018-01-18 5:15 UTC (permalink / raw)
To: David Gibson; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
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 character.
> > This change made the column numbers work for me in the annotations.
> >
> > 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 dts file
> > has been through cpp, the numbers will be smaller. So it could be better
> > to consider tabs to be 1 character, to not have to think about what 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 = devm_request_and_ioremap(&pdev->dev, res);
and the following code:
priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
In emacs, the go to the line and type control f 15 times solution puts the
cursor right afher after the =. The column numbers of emacs report 22 for
that position. I guess in vim, putting the cursor right on the = would
report 15.
When I run the dts compiler on tests/test_tree1.dts, for line 39:
compatible = "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 column
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 seems to
report the position of the c as 4 or 25. It seems to report the position
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.
julia
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
2018-01-18 5:15 ` Julia Lawall
@ 2018-01-18 7:01 ` David Gibson
[not found] ` <20180118070123.GV30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2018-01-18 7:01 UTC (permalink / raw)
To: Julia Lawall; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 3125 bytes --]
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 character.
> > > This change made the column numbers work for me in the annotations.
> > >
> > > 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 dts file
> > > has been through cpp, the numbers will be smaller. So it could be better
> > > to consider tabs to be 1 character, to not have to think about what 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 = devm_request_and_ioremap(&pdev->dev, res);
>
> and the following code:
>
> priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
>
> In emacs, the go to the line and type control f 15 times solution puts the
> cursor right afher after the =. The column numbers of emacs report 22 for
> that position. I guess in vim, putting the cursor right on the = would
> report 15.
>
> When I run the dts compiler on tests/test_tree1.dts, for line 39:
>
>
> compatible = "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 column
> 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 seems to
> report the position of the c as 4 or 25. It seems to report the position
> 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".
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
[not found] ` <20180118070123.GV30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2018-01-18 10:12 ` Julia Lawall
2018-01-19 5:44 ` David Gibson
0 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2018-01-18 10:12 UTC (permalink / raw)
To: David Gibson; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
On Thu, 18 Jan 2018, David Gibson wrote:
> 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 character.
> > > > This change made the column numbers work for me in the annotations.
> > > >
> > > > 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 dts file
> > > > has been through cpp, the numbers will be smaller. So it could be better
> > > > to consider tabs to be 1 character, to not have to think about what 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 = devm_request_and_ioremap(&pdev->dev, res);
> >
> > and the following code:
> >
> > priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> >
> > In emacs, the go to the line and type control f 15 times solution puts the
> > cursor right afher after the =. The column numbers of emacs report 22 for
> > that position. I guess in vim, putting the cursor right on the = would
> > report 15.
> >
> > When I run the dts compiler on tests/test_tree1.dts, for line 39:
> >
> >
> > compatible = "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 column
> > 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 seems to
> > report the position of the c as 4 or 25. It seems to report the position
> > 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".
So that would be the strategy of the patch, where seeing a newline sets
the counter to 0.
julia
>
> --
> 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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
2018-01-18 10:12 ` Julia Lawall
@ 2018-01-19 5:44 ` David Gibson
[not found] ` <20180119054454.GA28299-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: David Gibson @ 2018-01-19 5:44 UTC (permalink / raw)
To: Julia Lawall; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 3689 bytes --]
On Thu, Jan 18, 2018 at 11:12:16AM +0100, Julia Lawall wrote:
>
>
> On Thu, 18 Jan 2018, David Gibson wrote:
>
> > 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 character.
> > > > > This change made the column numbers work for me in the annotations.
> > > > >
> > > > > 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 dts file
> > > > > has been through cpp, the numbers will be smaller. So it could be better
> > > > > to consider tabs to be 1 character, to not have to think about what 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 = devm_request_and_ioremap(&pdev->dev, res);
> > >
> > > and the following code:
> > >
> > > priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> > >
> > > In emacs, the go to the line and type control f 15 times solution puts the
> > > cursor right afher after the =. The column numbers of emacs report 22 for
> > > that position. I guess in vim, putting the cursor right on the = would
> > > report 15.
> > >
> > > When I run the dts compiler on tests/test_tree1.dts, for line 39:
> > >
> > >
> > > compatible = "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 column
> > > 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 seems to
> > > report the position of the c as 4 or 25. It seems to report the position
> > > 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".
>
> 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.
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] srcpos: correct column numbers
[not found] ` <20180119054454.GA28299-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
@ 2018-01-19 5:59 ` Julia Lawall
0 siblings, 0 replies; 9+ messages in thread
From: Julia Lawall @ 2018-01-19 5:59 UTC (permalink / raw)
To: David Gibson; +Cc: Frank Rowand, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
On Fri, 19 Jan 2018, David Gibson wrote:
> On Thu, Jan 18, 2018 at 11:12:16AM +0100, Julia Lawall wrote:
> >
> >
> > On Thu, 18 Jan 2018, David Gibson wrote:
> >
> > > 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 character.
> > > > > > This change made the column numbers work for me in the annotations.
> > > > > >
> > > > > > 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 dts file
> > > > > > has been through cpp, the numbers will be smaller. So it could be better
> > > > > > to consider tabs to be 1 character, to not have to think about what 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 = devm_request_and_ioremap(&pdev->dev, res);
> > > >
> > > > and the following code:
> > > >
> > > > priv->sensor = devm_request_and_ioremap(&pdev->dev, res);
> > > >
> > > > In emacs, the go to the line and type control f 15 times solution puts the
> > > > cursor right afher after the =. The column numbers of emacs report 22 for
> > > > that position. I guess in vim, putting the cursor right on the = would
> > > > report 15.
> > > >
> > > > When I run the dts compiler on tests/test_tree1.dts, for line 39:
> > > >
> > > >
> > > > compatible = "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 column
> > > > 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 seems to
> > > > report the position of the c as 4 or 25. It seems to report the position
> > > > 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".
> >
> > 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.
OK, I'll do that.
julia
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-01-19 5:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 18:33 [PATCH] srcpos: correct column numbers Julia Lawall
2018-01-16 0:20 ` Frank Rowand
[not found] ` <4eec9dbb-c047-86ae-e4b2-08de9f0499fe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-16 6:10 ` Julia Lawall
2018-01-18 4:22 ` David Gibson
[not found] ` <20180118042202.GI30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-18 5:15 ` Julia Lawall
2018-01-18 7:01 ` David Gibson
[not found] ` <20180118070123.GV30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-18 10:12 ` Julia Lawall
2018-01-19 5:44 ` David Gibson
[not found] ` <20180119054454.GA28299-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-19 5:59 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.