aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-14 09:55:39 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-12-15 20:41:37 +0100
commitcd18af40c57e6617c0e45bbdd3ec594ba99ccb74 (patch)
treef8a8afc0c1231a622e883d43fd1fbce1b5115909
parentc3845651306e50ab8b410accdeb322442d61e342 (diff)
downloadsparse-cd18af40c57e6617c0e45bbdd3ec594ba99ccb74.tar.gz
typeof: do not let classify_type() do its own SYM_TYPEOF expansion
SYM_TYPEOFs are expanded at examination time. However, classify_type() does its own expansion of SYM_TYPEOFs. Worse, it does this differently (address space & noderef are not removed).. So, to enforce the same expansion, also use examine_symbol_type() to do the expansion in classify_type(). Note: it's not sure that it's currently possible to have SYM_TYPEOFs to expand in classify_type(). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/evaluate.c b/evaluate.c
index 539ef803..038fd64a 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -383,10 +383,8 @@ 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 = &bad_ctype;
- else if (type->type == SYM_NODE)
+ type = examine_symbol_type(type);
+ if (type->type == SYM_NODE)
type = type->ctype.base_type;
}
if (type->type == SYM_ENUM)