parse_call_math: silence "internal bug: pop_val popping empty list"
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 6 Feb 2013 15:14:20 +0000 (6 18:14 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 6 Feb 2013 15:14:20 +0000 (6 18:14 +0300)
There is a bogus warning message printed when the parameter passed is not
a known fixed number.  I've created a version of pop_until() to clear the
stacks without printing a warning message.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_parse_call_math.c

index 59fe1cc..ab4fb30 100644 (file)
@@ -125,6 +125,14 @@ static void pop_until(char c)
        }
 }
 
+static void discard_stacks()
+{
+       while (op_list)
+               pop_op();
+       while (num_list)
+               pop_val();
+}
+
 static int get_implied_param(struct expression *call, int param, sval_t *sval)
 {
        struct expression *arg;
@@ -210,7 +218,7 @@ int parse_call_math(struct expression *call, char *math, sval_t *sval)
        *sval = pop_val();
        return 1;
 fail:
-       pop_until(0);  /* discard stack */
+       discard_stacks();
        return 0;
 }