From 104147cd176d0b6f635777f34a7df15a33a45c15 Mon Sep 17 00:00:00 2001 From: Etienne Bergeron Date: Thu, 4 Apr 2013 13:12:31 -0400 Subject: [PATCH] Remove nested expressions Those are useless: the priorities are already known within the data structure without those extra nodes. Signed-off-by: Etienne Bergeron Signed-off-by: Mathieu Desnoyers --- formats/ctf/metadata/ctf-ast.h | 2 -- formats/ctf/metadata/ctf-parser.y | 4 +--- formats/ctf/metadata/ctf-visitor-parent-links.c | 7 ------- formats/ctf/metadata/ctf-visitor-xml.c | 10 ---------- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/formats/ctf/metadata/ctf-ast.h b/formats/ctf/metadata/ctf-ast.h index 20ed6ccc..4f4b8aba 100644 --- a/formats/ctf/metadata/ctf-ast.h +++ b/formats/ctf/metadata/ctf-ast.h @@ -148,7 +148,6 @@ struct ctf_node { UNARY_SIGNED_CONSTANT, UNARY_UNSIGNED_CONSTANT, UNARY_SBRAC, - UNARY_NESTED, } type; union { /* @@ -159,7 +158,6 @@ struct ctf_node { int64_t signed_constant; uint64_t unsigned_constant; struct ctf_node *sbrac_exp; - struct ctf_node *nested_exp; } u; enum { UNARY_LINK_UNKNOWN = 0, diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y index 4d101739..1ccc718a 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -1199,9 +1199,7 @@ postfix_expression: } | LPAREN unary_expression RPAREN { - $$ = make_node(scanner, NODE_UNARY_EXPRESSION); - $$->u.unary_expression.type = UNARY_NESTED; - $$->u.unary_expression.u.nested_exp = $2; + $$ = $2; } | postfix_expression LSBRAC unary_expression RSBRAC { diff --git a/formats/ctf/metadata/ctf-visitor-parent-links.c b/formats/ctf/metadata/ctf-visitor-parent-links.c index 953727e8..104afb71 100644 --- a/formats/ctf/metadata/ctf-visitor-parent-links.c +++ b/formats/ctf/metadata/ctf-visitor-parent-links.c @@ -69,13 +69,6 @@ int ctf_visitor_unary_expression(FILE *fd, int depth, struct ctf_node *node) if (ret) return ret; break; - case UNARY_NESTED: - node->u.unary_expression.u.nested_exp->parent = node; - ret = ctf_visitor_unary_expression(fd, depth + 1, - node->u.unary_expression.u.nested_exp); - if (ret) - return ret; - break; case UNARY_UNKNOWN: default: diff --git a/formats/ctf/metadata/ctf-visitor-xml.c b/formats/ctf/metadata/ctf-visitor-xml.c index 0276f836..3c1d37e7 100644 --- a/formats/ctf/metadata/ctf-visitor-xml.c +++ b/formats/ctf/metadata/ctf-visitor-xml.c @@ -104,16 +104,6 @@ int ctf_visitor_print_unary_expression(FILE *fd, int depth, struct ctf_node *nod print_tabs(fd, depth); fprintf(fd, "\n"); break; - case UNARY_NESTED: - print_tabs(fd, depth); - fprintf(fd, "\n"); - ret = ctf_visitor_print_unary_expression(fd, depth + 1, - node->u.unary_expression.u.nested_exp); - if (ret) - return ret; - print_tabs(fd, depth); - fprintf(fd, "\n"); - break; case UNARY_UNKNOWN: default: -- 2.34.1