mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-08 12:45:29 -05:00
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>
This commit is contained in:
parent
15ad6d862e
commit
329055dbbc
11 changed files with 175 additions and 0 deletions
|
|
@ -318,6 +318,13 @@ dtc_tests () {
|
|||
run_sh_test dtc-checkfails.sh node_name_format -- -I dtb -O dtb bad_node_format.dtb
|
||||
run_sh_test dtc-checkfails.sh prop_name_chars -- -I dtb -O dtb bad_prop_char.dtb
|
||||
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label1.dts
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label2.dts
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label3.dts
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label4.dts
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label5.dts
|
||||
run_sh_test dtc-checkfails.sh duplicate_label -- -I dts -O dtb reuse-label6.dts
|
||||
|
||||
# Check for proper behaviour reading from stdin
|
||||
run_dtc_test -I dts -O dtb -o stdin_dtc_tree1.test.dtb - < test_tree1.dts
|
||||
run_wrap_test cmp stdin_dtc_tree1.test.dtb dtc_tree1.test.dtb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue