linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* dtc: Generate useful error message for properties after subnodes
@ 2007-12-04 23:27 David Gibson
  2007-12-05 14:41 ` Jon Loeliger
  0 siblings, 1 reply; 2+ messages in thread
From: David Gibson @ 2007-12-04 23:27 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

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>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-05 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-04 23:27 dtc: Generate useful error message for properties after subnodes David Gibson
2007-12-05 14:41 ` Jon Loeliger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).