dtc: Generate useful error message for properties after subnodes
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]>
tests/prop-after-subnode.dts new file +9 -0
@@ -0,0 +1,9 @@ +/dts-v1/; + +/ { + node1 { + }; + prop; + node2 { + }; +};
dtc-parser.y +5 -0
@@ -276,6 +276,11 @@ { $$ = chain_node($1, $2); } + | subnode propdef + { + yyerror("syntax error: properties must precede subnodes\n"); + YYERROR; + } ; subnode:
Signature · 4 lines
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
Jon Loeliger
AppliedSo, like, the other day David Gibson mumbled:
Quoted 8 lines
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]>
Applied.
jdl