summaryrefslogtreecommitdiff
path: root/checks.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2010-02-24 18:22:17 +1100
committerJon Loeliger <jdl@jdl.com>2010-02-24 08:48:51 -0600
commit05898c67c15d73fe50bd87fc939bd9ee6a4275ce (patch)
treea8ea4e24ccdd0e8a21dc028e2b55a1226d6d3bc2 /checks.c
parent49c2da308534a4bffb67d53b5a7f8e5f05c305b9 (diff)
downloaddtc-05898c67c15d73fe50bd87fc939bd9ee6a4275ce.tar.gz
dtc: Allow multiple labels on nodes and properties
At present, both the grammar and our internal data structures mean that there can be only one label on a node or property. This is a fairly arbitrary constraint, given that any number of value labels can appear at the same point, and that in C you can have any number of labels on the same statement. This is pretty much a non-issue now, but it may become important with some of the extensions that Grant and I have in mind. It's not that hard to change, so this patch does so, allowing an arbitrary number of labels on any given node or property. As usual a testcase is added too. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'checks.c')
-rw-r--r--checks.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/checks.c b/checks.c
index 1f35cb9..a662a00 100644
--- a/checks.c
+++ b/checks.c
@@ -314,16 +314,19 @@ static void check_duplicate_label(struct check *c, struct node *dt,
static void check_duplicate_label_node(struct check *c, struct node *dt,
struct node *node)
{
- if (node->label)
- check_duplicate_label(c, dt, node->label, node, NULL, NULL);
+ struct label *l;
+
+ for_each_label(node->labels, l)
+ check_duplicate_label(c, dt, l->label, node, NULL, NULL);
}
static void check_duplicate_label_prop(struct check *c, struct node *dt,
struct node *node, struct property *prop)
{
struct marker *m = prop->val.markers;
+ struct label *l;
- if (prop->label)
- check_duplicate_label(c, dt, prop->label, node, prop, NULL);
+ for_each_label(prop->labels, l)
+ check_duplicate_label(c, dt, l->label, node, prop, NULL);
for_each_marker_of_type(m, LABEL)
check_duplicate_label(c, dt, m->ref, node, prop, m);