aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/expression.c
diff options
authorAl Viro <viro@ftp.linux.org.uk>2007-07-01 08:48:48 +0100
committerJosh Triplett <josh@freedesktop.org>2007-07-08 18:44:09 -0700
commita722bf205788145338ea46f14ec0e66275026711 (patch)
treee1855abccaf4e8fa62b9458dbaeb76519f84cadc /expression.c
parentd8d87ca8f0fad00dcfdfc0499886b292ad794648 (diff)
downloadsparse-dev-a722bf205788145338ea46f14ec0e66275026711.tar.gz
fix the comma handling in integer constant expressions
Treat it as normal binary operation, taint the value, check the taint. We can do other kind of value tainting with the same infrastructure as well... Review and testing would be welcome; AFAICS, it works, but... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'expression.c')
-rw-r--r--expression.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/expression.c b/expression.c
index d36c3d2f..65f959e2 100644
--- a/expression.c
+++ b/expression.c
@@ -751,7 +751,7 @@ static struct token *cast_expression(struct token *token, struct expression **tr
* than create a data structure for it.
*/
-#define __LR_BINOP_EXPRESSION(__token, tree, type, inner, compare, is_const) \
+#define LR_BINOP_EXPRESSION(__token, tree, type, inner, compare) \
struct expression *left = NULL; \
struct token * next = inner(__token, &left); \
\
@@ -768,8 +768,7 @@ static struct token *cast_expression(struct token *token, struct expression **tr
sparse_error(next->pos, "No right hand side of '%s'-expression", show_special(op)); \
break; \
} \
- if (is_const) \
- top->flags = left->flags & right->flags \
+ top->flags = left->flags & right->flags \
& Int_const_expr; \
top->op = op; \
top->left = left; \
@@ -781,13 +780,6 @@ out: \
*tree = left; \
return next; \
-#define LR_BINOP_EXPRESSION(token, tree, type, inner, compare) \
- __LR_BINOP_EXPRESSION((token), (tree), (type), (inner), (compare), 1)
-
-#define LR_BINOP_EXPRESSION_NONCONST(token, tree, type, inner, compare) \
- __LR_BINOP_EXPRESSION((token), (tree), (type), (inner), (compare), 0)
-
-
static struct token *multiplicative_expression(struct token *token, struct expression **tree)
{
LR_BINOP_EXPRESSION(
@@ -918,7 +910,7 @@ struct token *assignment_expression(struct token *token, struct expression **tre
static struct token *comma_expression(struct token *token, struct expression **tree)
{
- LR_BINOP_EXPRESSION_NONCONST(
+ LR_BINOP_EXPRESSION(
token, tree, EXPR_COMMA, assignment_expression,
(op == ',')
);