[lttng-dev] [PATCH lttng-tools] Filter: Handle the unary bitwise not operator (~) with an unsupported op error
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Wed Aug 22 09:55:43 EDT 2012
* Christian Babeux (christian.babeux at efficios.com) wrote:
Acked-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>
> Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
> ---
> src/lib/lttng-ctl/filter-ast.h | 1 +
> src/lib/lttng-ctl/filter-parser.y | 5 +++++
> src/lib/lttng-ctl/filter-visitor-generate-ir.c | 12 ++++++++++++
> 3 files changed, 18 insertions(+)
>
> diff --git a/src/lib/lttng-ctl/filter-ast.h b/src/lib/lttng-ctl/filter-ast.h
> index 97793c0..1767164 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 4ee1d9a..d3be4be 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 899713e..d23372f 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
> --
> 1.7.11.4
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list