]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sb/userdiff-dts'
authorJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2019 19:26:39 +0000 (12:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Sep 2019 19:26:39 +0000 (12:26 -0700)
Device-tree files learned their own userdiff patterns.

* sb/userdiff-dts:
  userdiff: add a builtin pattern for dts files

14 files changed:
Documentation/gitattributes.txt
t/t4018-diff-funcname.sh
t/t4018/dts-labels [new file with mode: 0644]
t/t4018/dts-node-unitless [new file with mode: 0644]
t/t4018/dts-nodes [new file with mode: 0644]
t/t4018/dts-nodes-comment1 [new file with mode: 0644]
t/t4018/dts-nodes-comment2 [new file with mode: 0644]
t/t4018/dts-reference [new file with mode: 0644]
t/t4018/dts-root [new file with mode: 0644]
t/t4034-diff-words.sh
t/t4034/dts/expect [new file with mode: 0644]
t/t4034/dts/post [new file with mode: 0644]
t/t4034/dts/pre [new file with mode: 0644]
userdiff.c

index fb1d188d440cc2fd3579844045d01a77423a58c7..c5a528c667b62abe81e6454b061834200011657e 100644 (file)
@@ -810,6 +810,8 @@ patterns are available:
 
 - `css` suitable for cascading style sheets.
 
+- `dts` suitable for devicetree (DTS) files.
+
 - `fortran` suitable for source code in the Fortran language.
 
 - `fountain` suitable for Fountain documents.
index 9261d6d3a0000e9891e1af58265349522ca40b84..6f5ef0035e92998eb74b14081aa021247abf67d8 100755 (executable)
@@ -31,6 +31,7 @@ diffpatterns="
        cpp
        csharp
        css
+       dts
        fortran
        fountain
        golang
diff --git a/t/t4018/dts-labels b/t/t4018/dts-labels
new file mode 100644 (file)
index 0000000..b21ef87
--- /dev/null
@@ -0,0 +1,9 @@
+/ {
+       label_1: node1@ff00 {
+               label2: RIGHT {
+                       vendor,some-property;
+
+                       ChangeMe = <0x45-30>;
+               };
+       };
+};
diff --git a/t/t4018/dts-node-unitless b/t/t4018/dts-node-unitless
new file mode 100644 (file)
index 0000000..c5287d9
--- /dev/null
@@ -0,0 +1,8 @@
+/ {
+       label_1: node1 {
+               RIGHT {
+                       prop-array = <1>, <4>;
+                       ChangeMe = <0xffeedd00>;
+               };
+       };
+};
diff --git a/t/t4018/dts-nodes b/t/t4018/dts-nodes
new file mode 100644 (file)
index 0000000..5a4334b
--- /dev/null
@@ -0,0 +1,8 @@
+/ {
+       label_1: node1@ff00 {
+               RIGHT@deadf00,4000 {
+                       #size-cells = <1>;
+                       ChangeMe = <0xffeedd00>;
+               };
+       };
+};
diff --git a/t/t4018/dts-nodes-comment1 b/t/t4018/dts-nodes-comment1
new file mode 100644 (file)
index 0000000..559dfce
--- /dev/null
@@ -0,0 +1,8 @@
+/ {
+       label_1: node1@ff00 {
+               RIGHT@deadf00,4000 /* &a comment */ {
+                       #size-cells = <1>;
+                       ChangeMe = <0xffeedd00>;
+               };
+       };
+};
diff --git a/t/t4018/dts-nodes-comment2 b/t/t4018/dts-nodes-comment2
new file mode 100644 (file)
index 0000000..27e9718
--- /dev/null
@@ -0,0 +1,8 @@
+/ {
+       label_1: node1@ff00 {
+               RIGHT@deadf00,4000 { /* a trailing comment */ 
+                       #size-cells = <1>;
+                       ChangeMe = <0xffeedd00>;
+               };
+       };
+};
diff --git a/t/t4018/dts-reference b/t/t4018/dts-reference
new file mode 100644 (file)
index 0000000..8f0c87d
--- /dev/null
@@ -0,0 +1,9 @@
+&label_1 {
+       TEST = <455>;
+};
+
+&RIGHT {
+       vendor,some-property;
+
+       ChangeMe = <0x45-30>;
+};
diff --git a/t/t4018/dts-root b/t/t4018/dts-root
new file mode 100644 (file)
index 0000000..2ef9e6f
--- /dev/null
@@ -0,0 +1,5 @@
+/RIGHT { /* Technically just supposed to be a slash */
+       #size-cells = <1>;
+
+       ChangeMe = <0xffeedd00>;
+};
index 912df91226f2a018016129a6634b837faee19869..9a93c2a3e0dd8a4763092549df77172657009c56 100755 (executable)
@@ -303,6 +303,7 @@ test_language_driver bibtex
 test_language_driver cpp
 test_language_driver csharp
 test_language_driver css
+test_language_driver dts
 test_language_driver fortran
 test_language_driver html
 test_language_driver java
diff --git a/t/t4034/dts/expect b/t/t4034/dts/expect
new file mode 100644 (file)
index 0000000..560fc99
--- /dev/null
@@ -0,0 +1,37 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index b6a9051..7803aee 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,32 +1,32 @@<RESET>
+/ {<RESET>
+       <RED>this_handle<RESET><GREEN>HANDLE_2<RESET>: <RED>node<RESET><GREEN>new-node<RESET>@<RED>f00<RESET><GREEN>eeda<RESET> {
+               compatible = "<RED>mydev<RESET><GREEN>vendor,compat<RESET>";
+               string-prop = <RED>start<RESET><GREEN>end<RESET>: "hello <RED>world!<RESET><GREEN>world?<RESET>" <RED>end<RESET><GREEN>start<RESET>: ;
+               <RED>#size-cells<RESET><GREEN>#address-cells<RESET> = <<RED>0+0<RESET><GREEN>0+40<RESET>>;
+               reg = <<RED>0xf00<RESET><GREEN>0xeeda<RESET>>;
+               prop = <<GREEN>(<RESET>1<GREEN>)<RESET>>;
+               prop = <<GREEN>(<RESET>-1e10<GREEN>)<RESET>>;
+               prop = <(!<RED>3<RESET><GREEN>1<RESET>)>;
+               prop = <(~<RED>3<RESET><GREEN>1<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>*<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>&<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>*<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>/<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>%<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3+4<RESET><GREEN>1+2<RESET>)>;
+               prop = <(<RED>3-4<RESET><GREEN>1-2<RESET>)>;
+               prop = /bits/ <RED>64<RESET><GREEN>32<RESET> <(<RED>3<RESET><GREEN>1<RESET><<<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>>><RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>&<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>^<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>|<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>&&<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>3<RESET><GREEN>1<RESET>||<RED>4<RESET><GREEN>2<RESET>)>;
+               prop = <(<RED>4?5<RESET><GREEN>1?2<RESET>:3)>;
+               list = <&<RED>this_handle<RESET><GREEN>HANDLE_2<RESET>>, <0 0 0 <RED>0<RESET><GREEN>1<RESET>>;
+       };<RESET>
+
+       &<RED>phandle<RESET><GREEN>phandle2<RESET> {
+               <RED>pre-phandle<RESET><GREEN>prop_handle<RESET> = <&<RED>this_handle<RESET><GREEN>HANDLE_2<RESET>>;
+       };<RESET>
+};<RESET>
diff --git a/t/t4034/dts/post b/t/t4034/dts/post
new file mode 100644 (file)
index 0000000..7803aee
--- /dev/null
@@ -0,0 +1,32 @@
+/ {
+       HANDLE_2: new-node@eeda {
+               compatible = "vendor,compat";
+               string-prop = end: "hello world?" start: ;
+               #address-cells = <0+40>;
+               reg = <0xeeda>;
+               prop = <(1)>;
+               prop = <(-1e10)>;
+               prop = <(!1)>;
+               prop = <(~1)>;
+               prop = <(1*2)>;
+               prop = <(1&2)>;
+               prop = <(1*2)>;
+               prop = <(1/2)>;
+               prop = <(1%2)>;
+               prop = <(1+2)>;
+               prop = <(1-2)>;
+               prop = /bits/ 32 <(1<<2)>;
+               prop = <(1>>2)>;
+               prop = <(1&2)>;
+               prop = <(1^2)>;
+               prop = <(1|2)>;
+               prop = <(1&&2)>;
+               prop = <(1||2)>;
+               prop = <(1?2:3)>;
+               list = <&HANDLE_2>, <0 0 0 1>;
+       };
+
+       &phandle2 {
+               prop_handle = <&HANDLE_2>;
+       };
+};
diff --git a/t/t4034/dts/pre b/t/t4034/dts/pre
new file mode 100644 (file)
index 0000000..b6a9051
--- /dev/null
@@ -0,0 +1,32 @@
+/ {
+       this_handle: node@f00 {
+               compatible = "mydev";
+               string-prop = start: "hello world!" end: ;
+               #size-cells = <0+0>;
+               reg = <0xf00>;
+               prop = <1>;
+               prop = <-1e10>;
+               prop = <(!3)>;
+               prop = <(~3)>;
+               prop = <(3*4)>;
+               prop = <(3&4)>;
+               prop = <(3*4)>;
+               prop = <(3/4)>;
+               prop = <(3%4)>;
+               prop = <(3+4)>;
+               prop = <(3-4)>;
+               prop = /bits/ 64 <(3<<4)>;
+               prop = <(3>>4)>;
+               prop = <(3&4)>;
+               prop = <(3^4)>;
+               prop = <(3|4)>;
+               prop = <(3&&4)>;
+               prop = <(3||4)>;
+               prop = <(4?5:3)>;
+               list = <&this_handle>, <0 0 0 0>;
+       };
+
+       &phandle {
+               pre-phandle = <&this_handle>;
+       };
+};
index e74a6d402255b0eaf1022863ba30305930d29b6f..86e3244e15ddc8beaf2fc6e6a0b4b0767c87f96c 100644 (file)
@@ -23,6 +23,14 @@ IPATTERN("ada",
         "[a-zA-Z][a-zA-Z0-9_]*"
         "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?"
         "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"),
+PATTERNS("dts",
+        "!;\n"
+        /* lines beginning with a word optionally preceded by '&' or the root */
+        "^[ \t]*((/|&?[a-zA-Z_]).*)",
+        /* -- */
+        /* Property names and math operators */
+        "[a-zA-Z0-9,._+?#-]+"
+        "|[-+*/%&^|!~]|>>|<<|&&|\\|\\|"),
 IPATTERN("fortran",
         "!^([C*]|[ \t]*!)\n"
         "!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"