diff options
-rw-r--r-- | epan/dfilter/semcheck.c | 12 | ||||
-rw-r--r-- | test/suite_dfilter/group_syntax.py | 6 |
2 files changed, 7 insertions, 11 deletions
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index cf697ebd6e..a769ac4ed5 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -42,7 +42,7 @@ typedef gboolean (*FtypeCanFunc)(enum ftenum); static ftenum_t check_arithmetic_LHS(dfwork_t *dfw, stnode_op_t st_op, stnode_t *st_node, stnode_t *st_arg1, stnode_t *st_arg2, - ftenum_t lhs_ftype, int commute); + ftenum_t lhs_ftype); static void check_relation(dfwork_t *dfw, stnode_op_t st_op, @@ -1384,17 +1384,13 @@ op_to_error_msg(stnode_op_t st_op) static ftenum_t check_arithmetic_LHS(dfwork_t *dfw, stnode_op_t st_op, stnode_t *st_node, stnode_t *st_arg1, stnode_t *st_arg2, - ftenum_t lhs_ftype, int commute) + ftenum_t lhs_ftype) { ftenum_t ftype1, ftype2; FtypeCanFunc can_func = NULL; LOG_NODE(st_node); - if (commute < 0) { - return FT_NONE; - } - if (st_op == STNODE_OP_UNARY_MINUS) { ftype1 = check_arithmetic(dfw, st_arg1, lhs_ftype); if (ftype1 == FT_NONE) @@ -1444,7 +1440,7 @@ check_arithmetic_LHS(dfwork_t *dfw, stnode_op_t st_op, ftype1 = check_arithmetic(dfw, st_arg1, lhs_ftype); if (ftype1 == FT_NONE) { - return check_arithmetic_LHS(dfw, st_op, st_node, st_arg2, st_arg1, lhs_ftype, commute - 1); + FAIL(dfw, st_arg1, "Unknown type for left side of %s", stnode_todisplay(st_node)); } if (!can_func(ftype1)) { FAIL(dfw, st_arg1, "%s %s.", @@ -1510,7 +1506,7 @@ check_arithmetic(dfwork_t *dfw, stnode_t *st_node, ftenum_t lhs_ftype) case STTYPE_ARITHMETIC: sttype_oper_get(st_node, &st_op, &st_arg1, &st_arg2); - ftype = check_arithmetic_LHS(dfw, st_op, st_node, st_arg1, st_arg2, lhs_ftype, 1); + ftype = check_arithmetic_LHS(dfw, st_op, st_node, st_arg1, st_arg2, lhs_ftype); break; default: diff --git a/test/suite_dfilter/group_syntax.py b/test/suite_dfilter/group_syntax.py index 86e351928a..003aa142a5 100644 --- a/test/suite_dfilter/group_syntax.py +++ b/test/suite_dfilter/group_syntax.py @@ -268,17 +268,17 @@ class case_arithmetic(unittest.TestCase): checkDFilterCount(dfilter, 2) def test_add_4(self, checkDFilterFail): - error = 'Constant expression is invalid on the LHS' + error = 'Unknown type for left side of +' dfilter = "1 + 2 == frame.number" checkDFilterFail(dfilter, error) def test_add_5(self, checkDFilterFail): - error = 'Constant expression is invalid' + error = 'Unknown type for left side of +' dfilter = "1 + 2 == 2 + 1" checkDFilterFail(dfilter, error) def test_add_6(self, checkDFilterFail): - error = 'Constant expression is invalid' + error = 'Unknown type for left side of -' dfilter = "1 - 2" checkDFilterFail(dfilter, error) |