aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2008-12-25 14:20:38 -0800
committerChristopher Li <sparse@chrisli.org>2008-12-25 14:20:38 -0800
commiteb8559bf861c94ab7958105efa812b21e1da2d51 (patch)
treee0ec69d08b91a468f7c2838e61e8a7c8d013c162 /evaluate.c
parentRevert the context tracking code (diff)
downloadsparse-eb8559bf861c94ab7958105efa812b21e1da2d51.tar.gz
sparse-eb8559bf861c94ab7958105efa812b21e1da2d51.tar.bz2
sparse-eb8559bf861c94ab7958105efa812b21e1da2d51.zip
Teach classify_type to handle typeof
This change will fix Rusty Russel's test case: (*(typeof(v) __attribute__((address_space(0), force)) *)(&v)) Signed-Off-By: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'evaluate.c')
-rw-r--r--evaluate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/evaluate.c b/evaluate.c
index f976645..d99ae70 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -362,6 +362,11 @@ static inline int classify_type(struct symbol *type, struct symbol **base)
};
if (type->type == SYM_NODE)
type = type->ctype.base_type;
+ if (type->type == SYM_TYPEOF) {
+ type = evaluate_expression(type->initializer);
+ if (type->type == SYM_NODE)
+ type = type->ctype.base_type;
+ }
if (type->type == SYM_ENUM)
type = type->ctype.base_type;
*base = type;