git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] userdiff: Add a builtin pattern for dts files

From
Alban Gruin <alban.gruin@gmail.com>
Date
Jan 17, 2019, 21:26 UTC
Message-ID
<0dc48713-7a17-623f-af75-67cca2cd63b6@gmail.com>
In-Reply-To
<154749087173.169631.13885160480779834976@swboyd.mtv.corp.google.com>
Hi, sorry for the late answer.
Le 14/01/2019 à 19:34, Stephen Boyd a écrit :
Show 50 quoted lines
> 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 */ {
> 

I grepped through Linux and uboot’s sources and it seems that “it is not common” is actually “it does not exists in the wild”. Perhaps it’s not worth to support them.

Show 14 quoted lines
>>
>>> +      /* -- */
>>> +      /* 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.
> 
I’d like you to do this, yes.

To be fair, I don’t know what to think about this patch after Junio’s message.

Previous: Stephen BoydNext: Rob Herring
Message 6 of 7 in “userdiff: Add a builtin pattern for dts files”
  1. userdiff: Add a builtin pattern for dts filesStephen Boyd, Jan 11, 2019
  2. Alban GruinJan 13, 2019
  3. Junio C HamanoJan 14, 2019
  4. Alban GruinJan 17, 2019
  5. Stephen BoydJan 14, 2019
  6. Alban GruinJan 17, 2019
  7. Rob HerringJan 17, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.