Browse Source

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 <david@gibson.dropbear.id.au>
main
David Gibson 17 years ago committed by Jon Loeliger
parent
commit
c048102f5b
  1. 5
      dtc-parser.y
  2. 9
      tests/prop-after-subnode.dts

5
dtc-parser.y

@ -276,6 +276,11 @@ subnodes:
{ {
$$ = chain_node($1, $2); $$ = chain_node($1, $2);
} }
| subnode propdef
{
yyerror("syntax error: properties must precede subnodes\n");
YYERROR;
}
; ;


subnode: subnode:

9
tests/prop-after-subnode.dts

@ -0,0 +1,9 @@
/dts-v1/;

/ {
node1 {
};
prop;
node2 {
};
};
Loading…
Cancel
Save