summaryrefslogtreecommitdiff
path: root/dtc.h
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2018-10-26 17:44:33 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2018-11-13 15:29:27 +1100
commitbaa1d2cf7894a32bf2f640ef40ebce561b2df565 (patch)
tree375454c91eef6ff64df067a1aef86896ae7dd09e /dtc.h
parentff2ad38f6a5a87603c519096fd7066082c4c6f75 (diff)
downloaddevice-tree-compiler-baa1d2cf7894a32bf2f640ef40ebce561b2df565.tar.gz
annotations: add positions
Extend the parser to record positions, in build_node, build_node_delete, and build_property. srcpos structures are added to the property and node types, and to the parameter lists of the above functions that construct these types. Nodes and properties that are created by the compiler rather than from parsing source code have NULL as the srcpos value. merge_nodes, defined in livetree.c, uses srcpos_extend to combine multiple positions, resulting in a list of positions. srcpos_extend is defined in srcpos.c. New elements are added at the end. The srcpos type, define in srcpos.h, is now a list structure with a next field. Another change to srcpos.c is to make srcpos_copy always do a full copy, including a copy of the file substructure. This is required because when dtc is used on the output of cpp, the successive detected file names overwrite the file name in the file structure. The next field does not need to be deep copied, because it is only updated in newly copied positions and the positions to which it points have also been copied. File names are only updated in uncopied position structures. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.h')
-rw-r--r--dtc.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/dtc.h b/dtc.h
index cbe5415..8722cbc 100644
--- a/dtc.h
+++ b/dtc.h
@@ -158,6 +158,7 @@ struct property {
struct property *next;
struct label *labels;
+ struct srcpos *srcpos;
};
struct node {
@@ -177,6 +178,7 @@ struct node {
struct label *labels;
const struct bus_type *bus;
+ struct srcpos *srcpos;
bool omit_if_unused, is_referenced;
};
@@ -205,13 +207,15 @@ struct node {
void add_label(struct label **labels, char *label);
void delete_labels(struct label **labels);
-struct property *build_property(char *name, struct data val);
+struct property *build_property(char *name, struct data val,
+ struct srcpos *srcpos);
struct property *build_property_delete(char *name);
struct property *chain_property(struct property *first, struct property *list);
struct property *reverse_properties(struct property *first);
-struct node *build_node(struct property *proplist, struct node *children);
-struct node *build_node_delete(void);
+struct node *build_node(struct property *proplist, struct node *children,
+ struct srcpos *srcpos);
+struct node *build_node_delete(struct srcpos *srcpos);
struct node *name_node(struct node *node, char *name);
struct node *omit_node_if_unused(struct node *node);
struct node *reference_node(struct node *node);