platform_external_dtc/tests/reuse-label2.dts
David Gibson 329055dbbc Disallow re-use of the same label within a dts file
Currently, nothing will stop you from re-using the same label string
multiple times in a dts, e.g.:
	/ {
		samelabel: prop1 = "foo";
		samelabel: prop2 = "bar";
	};

or
	/ {
		samelabel: prop1 = "foo";
		samelabel: subnode {
		};
	};

When using node references by label, this could lead to confusing
results (with no warning), and in -Oasm mode will result in output
which the assembler will complain about (since it too will have
duplicate labels).

This patch, therefore, adds code to checks.c to give errors if you
attempt to re-use the same label.  It treats all labels (node,
property, and value) as residing in the same namespace, since the
assembler will treat them so for -Oasm mode.

Testcases for the new code are also added.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2010-02-23 09:04:48 -06:00

6 lines
72 B
Text

/dts-v1/;
/ {
label: property1 = "foo";
label: property2 = "bar";
};