[Crosstoolchain-logs] [device-tree-compiler] 212/357: dtc: Generate useful error message for properties after subnodes

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit c048102f5bcafb9a316bd7532fe3958c99af6b74
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Wed Dec 5 10:27:04 2007 +1100

    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 at gibson.dropbear.id.au>
---
 dtc-parser.y                 | 5 +++++
 tests/prop-after-subnode.dts | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/dtc-parser.y b/dtc-parser.y
index 2407af4..43182fd 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -276,6 +276,11 @@ subnodes:
 		{
 			$$ = chain_node($1, $2);
 		}
+	| subnode propdef
+		{
+			yyerror("syntax error: properties must precede subnodes\n");
+			YYERROR;
+		}
 	;
 
 subnode:
diff --git a/tests/prop-after-subnode.dts b/tests/prop-after-subnode.dts
new file mode 100644
index 0000000..6dd0b66
--- /dev/null
+++ b/tests/prop-after-subnode.dts
@@ -0,0 +1,9 @@
+/dts-v1/;
+
+/ {
+	node1 {
+	};
+	prop;
+	node2 {
+	};
+};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list