From: Christian Babeux Date: Wed, 22 Aug 2012 13:34:03 +0000 (-0400) Subject: Filter: Handle the unary bitwise not operator (~) with an unsupported op error X-Git-Tag: v2.1.0-rc2~3 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ab78f161f9a86f7fa4aad5de770499f52b452439;p=lttng-tools.git Filter: Handle the unary bitwise not operator (~) with an unsupported op error Acked-by: Mathieu Desnoyers Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- diff --git a/src/lib/lttng-ctl/filter-ast.h b/src/lib/lttng-ctl/filter-ast.h index 97793c00b..176716474 100644 --- a/src/lib/lttng-ctl/filter-ast.h +++ b/src/lib/lttng-ctl/filter-ast.h @@ -91,6 +91,7 @@ enum unary_op_type { AST_UNARY_PLUS, AST_UNARY_MINUS, AST_UNARY_NOT, + AST_UNARY_BIN_NOT, }; enum ast_link_type { diff --git a/src/lib/lttng-ctl/filter-parser.y b/src/lib/lttng-ctl/filter-parser.y index 4ee1d9a5d..d3be4be5b 100644 --- a/src/lib/lttng-ctl/filter-parser.y +++ b/src/lib/lttng-ctl/filter-parser.y @@ -481,6 +481,11 @@ unary_operator $$ = make_node(parser_ctx, NODE_UNARY_OP); $$->u.unary_op.type = AST_UNARY_NOT; } + | NOT_BIN + { + $$ = make_node(parser_ctx, NODE_UNARY_OP); + $$->u.unary_op.type = AST_UNARY_BIN_NOT; + } ; multiplicative_expression diff --git a/src/lib/lttng-ctl/filter-visitor-generate-ir.c b/src/lib/lttng-ctl/filter-visitor-generate-ir.c index 899713ee6..d23372f4b 100644 --- a/src/lib/lttng-ctl/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter-visitor-generate-ir.c @@ -652,6 +652,8 @@ static struct ir_op *make_unary_op(struct filter_parser_ctx *ctx, struct filter_node *node, enum ir_side side) { + const char *op_str = "?"; + switch (node->u.unary_op.type) { case AST_UNARY_UNKNOWN: default: @@ -703,7 +705,17 @@ struct ir_op *make_unary_op(struct filter_parser_ctx *ctx, } return op; } + case AST_UNARY_BIN_NOT: + { + op_str = "~"; + goto error_not_supported; + } } + +error_not_supported: + fprintf(stderr, "[error] %s: unary operation '%s' not supported\n", + __func__, op_str); + return NULL; } static