diff options
author | 2007-07-01 08:49:22 +0100 | |
---|---|---|
committer | 2007-07-08 18:57:32 -0700 | |
commit | c3aac8e1fd7cbfab1f4c87baeb4b57453720d77a (patch) | |
tree | 2edc01916eaf2c8964a5587df5ea1c2af225c484 /expression.h | |
parent | fix the comma handling in integer constant expressions (diff) | |
download | sparse-c3aac8e1fd7cbfab1f4c87baeb4b57453720d77a.tar.gz sparse-c3aac8e1fd7cbfab1f4c87baeb4b57453720d77a.tar.bz2 sparse-c3aac8e1fd7cbfab1f4c87baeb4b57453720d77a.zip |
first pass at null pointer constants
AFAICS, that should do null pointer constants right. We assign
special instance of void * (&null_ctype) to (void *)<zero integer
constant expression> and replace it with normal void * when we
don't want null pointer constant. is_zero_constant() checks if
we have an integer constant expression, does conservative expand
(i.e. instead of generating an error on 1/0, etc. leaves the
node unreplaced) and checks if we have reduced the sucker to
EXPR_VALUE[0] without comma taint.
Implemented all (AFAICS) special cases involving null pointer
constants; most changes in evaluate_compare() and evaluate_conditional().
Both are still incomplete; handling of qualifiers is still missing,
but that's a separate story.
Note that we get two new sets of warnings on the kernel build; one is
due to wrong size_t (handled in the next patch; didn't show up until
now since we didn't warn on comparison of pointers to incompatible
types) and another is a pile of warnings about integer 0 used as NULL
on
if (p == 0)
where p is a pointer. Additionally, there's an idiotic
(p>0)
in one place (again, p is a pointer). Bugger if I know how gcc doesn't
warn on that one, it's certainly a standard violation and bloody pointless
even as extension...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'expression.h')
-rw-r--r-- | expression.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/expression.h b/expression.h index 23ca408..02eec02 100644 --- a/expression.h +++ b/expression.h @@ -154,6 +154,7 @@ struct expression { }; /* Constant expression values */ +int is_zero_constant(struct expression *); long long get_expression_value(struct expression *); long long const_expression_value(struct expression *); |