diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2010-02-23 19:56:41 +1100 |
---|---|---|
committer | Jon Loeliger <jdl@jdl.com> | 2010-02-23 09:04:48 -0600 |
commit | 329055dbbc3c09e21386ceae788256991f4c8aec (patch) | |
tree | 92d2c0fee03699a262080183cc2f4c756972a24e /tests/reuse-label3.dts | |
parent | 15ad6d862ec7f66dc00783798705a8db1c5d9aca (diff) | |
download | dtc-329055dbbc3c09e21386ceae788256991f4c8aec.tar.gz |
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>
Diffstat (limited to 'tests/reuse-label3.dts')
-rw-r--r-- | tests/reuse-label3.dts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/reuse-label3.dts b/tests/reuse-label3.dts new file mode 100644 index 0000000..fa3d2c7 --- /dev/null +++ b/tests/reuse-label3.dts @@ -0,0 +1,9 @@ +/dts-v1/; + +/ { + label: property = "foo"; + + label: node { + property = "foo"; + }; +}; |