[lttng-dev] [PATCH lttng-tools] Filter: Handle the unary bitwise not operator (~) with an unsupported op error

David Goulet david.goulet at polymtl.ca
Wed Aug 22 11:04:41 EDT 2012


Merged!

Thanks!

On 22/08/12 09:34 AM, Christian Babeux wrote:
> 
> 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



More information about the lttng-dev mailing list