Filter: Handle the unary bitwise not operator (~) with an unsupported op error
authorChristian Babeux <christian.babeux@efficios.com>
Wed, 22 Aug 2012 13:34:03 +0000 (09:34 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 22 Aug 2012 15:00:13 +0000 (11:00 -0400)
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/lib/lttng-ctl/filter-ast.h
src/lib/lttng-ctl/filter-parser.y
src/lib/lttng-ctl/filter-visitor-generate-ir.c

index 97793c00bf7f199fea49aa508282552b6ce4bf84..176716474c850b297a6858d31aded176422f8e55 100644 (file)
@@ -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 {
index 4ee1d9a5d460fee74338aaa98dbee1cbdd2fa28f..d3be4be5b03e2d5ff3d3215e6a19092743dae2df 100644 (file)
@@ -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
index 899713ee6aab6ff27870ce70bb7ce8020290ad4a..d23372f4b0eb672abf15f0c08bffb73c7e3212ab 100644 (file)
@@ -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
This page took 0.026585 seconds and 4 git commands to generate.