git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Alban Gruin <alban.gruin@gmail.com>, git@vger.kernel.org
Cc: Adrian Johnson <ajohnson@redneon.com>,
	William Duclot <william.duclot@ensimag.grenoble-inp.fr>,
	Johannes Sixt <j6t@kdbg.org>,
	Matthieu Moy <matthieu.moy@grenoble-inp.fr>,
	devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] userdiff: Add a builtin pattern for dts files
Date: Mon, 14 Jan 2019 10:34:31 -0800
Message-ID: <154749087173.169631.13885160480779834976@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <16335abe-5e7e-fd7a-25f4-373f94e176e1@gmail.com>

Quoting Alban Gruin (2019-01-13 13:26:21)
> Hi Stephen,
> 
> thank you for your patch.  I left a few comments below.
> 
> Le 11/01/2019 à 22:51, Stephen Boyd a écrit :
> > diff --git a/userdiff.c b/userdiff.c
> > index 97007abe5b16..2bc964e11089 100644
> > --- a/userdiff.c
> > +++ b/userdiff.c
> > @@ -23,6 +23,15 @@ IPATTERN("ada",
> >        "[a-zA-Z][a-zA-Z0-9_]*"
> >        "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?"
> >        "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"),
> > +PATTERNS("dts",
> > +      /* Node name (with optional label and unit address) */
> > +      "^[ \t]*((([a-zA-Z_][a-zA-Z0-9_]*: )?[a-zA-Z][a-zA-Z0-9,._+-]*(@[a-zA-Z0-9,._+-]+)?"
> 
> From the spec, label and node names “shall be [between] 1 to 31
> characters in length”.  It’s not enforced here, and I guess it’s not
> really git’s job to check for this kind of rule.  Others may disagree
> with me, though.
> 
> Should labels end with exactly one space after the colon, or can there
> be more, or none at all?

There can be any number of spaces after the colon. I can fix the regex
here to accept any amount of whitespace after the colon.

> 
> > +      /* Reference */
> > +      "|&[a-zA-Z_][a-zA-Z0-9_]*[ \t]*)[ \t]*\\{)[ \t]*$",
> 
> It’s not specified in the spec, but these lines must end with a curly
> brace?  

That isn't common but it is supported. I can change the regex to look
for a line that ends in '{' or something that isn't ';' with anything
after the node name?

> What if there is a comment after the curly brace?

There can be a comment after the curly brace or before the curly brace.
The spec allows C style /* */ type comments, in addition to C++ style //
comments. I've never really seen that happen in practice though so it's
not very common. Grepping the linux sources shows two hits:

arch/arm/boot/dts/lpc3250-ea3250.dts:&ohci /* &usbd */ {
arch/arm/boot/dts/lpc3250-phy3250.dts:&ohci /* &usbd */ {

> 
> This pattern does not match the root node, but I guess it’s not
> important as most of the interesting stuff in a dts is not directly in it.

Agreed.

> 
> > +      /* -- */
> > +      /* Property names and math operators */
> > +      "[a-zA-Z0-9,._+?#-]+"
> > +      "|[-+*/%&^|!~]"),
> 
> There is a `%' operator here and in your tests, but it’s not mentioned
> in the spec if I’m not mistaken.  Does it actually exists?

The compiler doesn't seem to complain when it's used. I can send a patch
to update the spec for this rather esoteric feature. I can also include
more tests and support for the boolean relational operators which also
seem to be supported but probably never used.


  parent reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 21:51 Stephen Boyd
2019-01-13 21:26 ` Alban Gruin
2019-01-14 18:34   ` Junio C Hamano
2019-01-17 21:26     ` Alban Gruin
2019-01-14 18:34   ` Stephen Boyd [this message]
2019-01-17 21:26     ` Alban Gruin
2019-01-17 22:13   ` Rob Herring

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154749087173.169631.13885160480779834976@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=ajohnson@redneon.com \
    --cc=alban.gruin@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=matthieu.moy@grenoble-inp.fr \
    --cc=robh+dt@kernel.org \
    --cc=william.duclot@ensimag.grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox