diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2007-07-10 17:54:27 -0400 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2007-07-14 12:16:53 -0700 |
commit | 2d709c36c9d0598fbd4ea39f6153a35162115994 (patch) | |
tree | fe7e14c42ad8b08ce92e6a0d5013796162148307 /expand.c | |
parent | [PATCH] fix the sanity check in evaluate_ptr_sub() (diff) | |
download | sparse-2d709c36c9d0598fbd4ea39f6153a35162115994.tar.gz sparse-2d709c36c9d0598fbd4ea39f6153a35162115994.tar.bz2 sparse-2d709c36c9d0598fbd4ea39f6153a35162115994.zip |
[PATCH] rewrite type_difference()
a) qualifiers should not be ignored beyond the top layer
b) qualifiers *should* be ignored in top layer of function arguments
c) change prototype - pass ctype * instead of symbol * and pass
"what to add to modifiers in that ctype" instead of "what to ignore".
We are still not quite done (there are incomplete types, there
are array size comparisons, there is lifting of signedness logics
into compatible_assignment_types()), but it's a much better approximation.
BTW, it's already good enough for kernel ARRAY_SIZE(), which
has become a major source of noise lately...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[Josh: prototype fix]
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'expand.c')
-rw-r--r-- | expand.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -460,11 +460,13 @@ static int expand_comma(struct expression *expr) static int compare_types(int op, struct symbol *left, struct symbol *right) { + struct ctype c1 = {.base_type = left}; + struct ctype c2 = {.base_type = right}; switch (op) { case SPECIAL_EQUAL: - return !type_difference(left, right, MOD_IGN, MOD_IGN); + return !type_difference(&c1, &c2, MOD_IGN, MOD_IGN); case SPECIAL_NOTEQUAL: - return type_difference(left, right, MOD_IGN, MOD_IGN) != NULL; + return type_difference(&c1, &c2, MOD_IGN, MOD_IGN) != NULL; case '<': return left->bit_size < right->bit_size; case '>': |