X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-semantic-validator.c;h=5a5de793b7417abd00bef0b1fec8590875f5bb51;hp=da813e0a50acf6ce1b9eacde0e6caaaf81b15fde;hb=e2c76a4d53527de31408fea6535980755c389e68;hpb=6743f229982176bfc2bdd2b3ab5c75ca62f45b35 diff --git a/formats/ctf/metadata/ctf-visitor-semantic-validator.c b/formats/ctf/metadata/ctf-visitor-semantic-validator.c index da813e0a..5a5de793 100644 --- a/formats/ctf/metadata/ctf-visitor-semantic-validator.c +++ b/formats/ctf/metadata/ctf-visitor-semantic-validator.c @@ -107,6 +107,7 @@ int ctf_visitor_unary_expression(FILE *fd, int depth, struct ctf_node *node) case NODE_ROOT: case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: case NODE_CLOCK: case NODE_TYPEDEF: @@ -210,6 +211,7 @@ int ctf_visitor_type_specifier_list(FILE *fd, int depth, struct ctf_node *node) case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: case NODE_CLOCK: case NODE_UNARY_EXPRESSION: @@ -250,6 +252,7 @@ int ctf_visitor_type_specifier(FILE *fd, int depth, struct ctf_node *node) case NODE_ROOT: case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: case NODE_CLOCK: case NODE_UNARY_EXPRESSION: @@ -331,6 +334,7 @@ int ctf_visitor_type_declarator(FILE *fd, int depth, struct ctf_node *node) case NODE_ROOT: case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: case NODE_CLOCK: case NODE_CTF_EXPRESSION: @@ -470,6 +474,20 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) return ret; } break; + case NODE_ENV: + switch (node->parent->type) { + case NODE_ROOT: + break; /* OK */ + default: + goto errinval; + } + + cds_list_for_each_entry(iter, &node->u.env.declaration_list, siblings) { + ret = _ctf_visitor_semantic_check(fd, depth + 1, iter); + if (ret) + return ret; + } + break; case NODE_TRACE: switch (node->parent->type) { case NODE_ROOT: @@ -505,6 +523,7 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) case NODE_ROOT: case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: case NODE_CLOCK: case NODE_FLOATING_POINT: @@ -574,6 +593,7 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) case NODE_ENUMERATOR: case NODE_ENUM: case NODE_CLOCK: + case NODE_ENV: default: goto errinval; } @@ -679,6 +699,7 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) case NODE_ENUMERATOR: case NODE_ENUM: case NODE_CLOCK: + case NODE_ENV: default: goto errinval; }