On several occasions, I've accidentally put properties after subnodes
in a dts file.  I've then spent ages thinking that the resulting
syntax error was because of something else.

This patch arranges for this specific syntax error to generate a more
specific and useful error message.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/tests/prop-after-subnode.dts
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/prop-after-subnode.dts    2007-12-05 10:24:52.000000000 +1100
@@ -0,0 +1,9 @@
+/dts-v1/;
+
+/ {
+       node1 {
+       };
+       prop;
+       node2 {
+       };
+};
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y       2007-12-05 10:12:10.000000000 +1100
+++ dtc/dtc-parser.y    2007-12-05 10:18:26.000000000 +1100
@@ -276,6 +276,11 @@
                {
                        $$ = chain_node($1, $2);
                }
+       | subnode propdef
+               {
+                       yyerror("syntax error: properties must precede 
subnodes\n");
+                       YYERROR;
+               }
        ;
 
 subnode:

-- 
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
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to