X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-semantic-validator.c;h=5a5de793b7417abd00bef0b1fec8590875f5bb51;hb=82ace6d6d97ecb15d093232c76c5d4a3c31e6948;hp=b89f7bd7660d0d363faf4dab4dd77d009bb57320;hpb=01c76b246be85b5d9c8e99813950fb194c9f714f;p=babeltrace.git diff --git a/formats/ctf/metadata/ctf-visitor-semantic-validator.c b/formats/ctf/metadata/ctf-visitor-semantic-validator.c index b89f7bd7..5a5de793 100644 --- a/formats/ctf/metadata/ctf-visitor-semantic-validator.c +++ b/formats/ctf/metadata/ctf-visitor-semantic-validator.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "ctf-scanner.h" #include "ctf-parser.h" @@ -107,7 +107,9 @@ 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: case NODE_TYPEALIAS_TARGET: case NODE_TYPEALIAS_ALIAS: @@ -209,7 +211,9 @@ 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: case NODE_TYPEALIAS: case NODE_TYPE_SPECIFIER: @@ -248,7 +252,9 @@ 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: case NODE_TYPEALIAS: case NODE_TYPE_SPECIFIER: @@ -328,7 +334,9 @@ 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: case NODE_UNARY_EXPRESSION: case NODE_TYPEALIAS: @@ -466,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: @@ -480,13 +502,30 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) return ret; } break; + case NODE_CLOCK: + switch (node->parent->type) { + case NODE_ROOT: + break; /* OK */ + default: + goto errinval; + } + + cds_list_for_each_entry(iter, &node->u.clock.declaration_list, siblings) { + ret = _ctf_visitor_semantic_check(fd, depth + 1, iter); + if (ret) + return ret; + } + break; + case NODE_CTF_EXPRESSION: switch (node->parent->type) { case NODE_ROOT: case NODE_EVENT: case NODE_STREAM: + case NODE_ENV: case NODE_TRACE: + case NODE_CLOCK: case NODE_FLOATING_POINT: case NODE_INTEGER: case NODE_STRING: @@ -553,6 +592,8 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) case NODE_STRING: case NODE_ENUMERATOR: case NODE_ENUM: + case NODE_CLOCK: + case NODE_ENV: default: goto errinval; } @@ -657,6 +698,8 @@ int _ctf_visitor_semantic_check(FILE *fd, int depth, struct ctf_node *node) case NODE_STRING: case NODE_ENUMERATOR: case NODE_ENUM: + case NODE_CLOCK: + case NODE_ENV: default: goto errinval; }