Message ID | 20191215110425.76533-3-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | tidy-up of typeof expansion | expand |
On 15/12/2019 11:04, Luc Van Oostenryck wrote: > SYM_TYPEOFs are expanded at examination type. s/type/time/ ? ATB, Ramsay Jones > 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> > --- > evaluate.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/evaluate.c b/evaluate.c > index 539ef8038587..038fd64ace9e 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) >
On Sun, Dec 15, 2019 at 07:13:10PM +0000, Ramsay Jones wrote: > On 15/12/2019 11:04, Luc Van Oostenryck wrote: > > SYM_TYPEOFs are expanded at examination type. > > s/type/time/ ? Hehe, indeed it makes much more sense so :) Thanks. -- Luc
diff --git a/evaluate.c b/evaluate.c index 539ef8038587..038fd64ace9e 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)
SYM_TYPEOFs are expanded at examination type. 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> --- evaluate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)