2 * filter-visitor-ir-check-binary-op-nesting.c
4 * LTTng filter IR check binary op nesting
6 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License, version 2.1 only,
10 * as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "filter-ast.h"
30 #include "filter-parser.h"
31 #include "filter-ir.h"
33 #include <common/macros.h>
36 int check_bin_op_nesting_recursive(struct ir_op
*node
, int nesting
)
41 fprintf(stderr
, "[error] %s: unknown op type\n", __func__
);
45 return check_bin_op_nesting_recursive(node
->u
.root
.child
,
50 return check_bin_op_nesting_recursive(node
->u
.unary
.child
,
57 fprintf(stderr
, "[error] Nesting of binary operators is not allowed, except for logical operators.\n");
60 ret
= check_bin_op_nesting_recursive(node
->u
.binary
.left
,
64 return check_bin_op_nesting_recursive(node
->u
.binary
.right
,
71 ret
= check_bin_op_nesting_recursive(node
->u
.logical
.left
,
75 return check_bin_op_nesting_recursive(node
->u
.logical
.right
,
82 int filter_visitor_ir_check_binary_op_nesting(struct filter_parser_ctx
*ctx
)
84 return check_bin_op_nesting_recursive(ctx
->ir_root
, 0);
This page took 0.032354 seconds and 5 git commands to generate.