diff --git a/src/scan-code.h b/src/scan-code.h index ec5579f3..2dfb1704 100644 --- a/src/scan-code.h +++ b/src/scan-code.h @@ -103,7 +103,7 @@ void code_props_none_init (code_props *self); } /** Initialized by \c CODE_PROPS_NONE_INIT with no further modification. */ -extern code_props const code_props_none; +extern code_props code_props_none; /** * \pre diff --git a/src/scan-code.l b/src/scan-code.l index 24ef5d92..cacd2561 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -890,7 +890,7 @@ code_props_none_init (code_props *self) *self = code_props_none; } -code_props const code_props_none = CODE_PROPS_NONE_INIT; +code_props code_props_none = CODE_PROPS_NONE_INIT; void code_props_plain_init (code_props *self, char const *code, diff --git a/src/symtab.c b/src/symtab.c index ab3f12e7..a502dfd1 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -274,9 +274,8 @@ semantic_type_code_props_set (semantic_type *type, | Get the computed %destructor or %printer for SYM. | `---------------------------------------------------*/ -code_props const * -symbol_code_props_get (symbol const *sym, - code_props_type kind) +code_props * +symbol_code_props_get (symbol *sym, code_props_type kind) { /* Per-symbol code props. */ if (sym->props[kind].code) @@ -285,7 +284,7 @@ symbol_code_props_get (symbol const *sym, /* Per-type code props. */ if (sym->type_name) { - code_props const *code = + code_props *code = &semantic_type_get (sym->type_name, NULL)->props[kind]; if (code->code) return code; @@ -421,13 +420,7 @@ symbol_check_defined (symbol *sym) } for (int i = 0; i < 2; ++i) - if (sym->props[i].kind == CODE_PROPS_NONE && sym->type_name) - { - semantic_type *sem_type = semantic_type_get (sym->type_name, NULL); - if (sem_type - && sem_type->props[i].kind != CODE_PROPS_NONE) - sem_type->props[i].is_used = true; - } + symbol_code_props_get (sym, i)->is_used = true; /* Set the semantic type status associated to the current symbol to 'declared' so that we could check semantic types unnecessary uses. */ diff --git a/src/symtab.h b/src/symtab.h index e2bf2d38..31c46960 100644 --- a/src/symtab.h +++ b/src/symtab.h @@ -181,8 +181,7 @@ void symbol_code_props_set (symbol *sym, code_props_type kind, /** Get the computed \c \%destructor or \c %printer for \c sym, which was initialized with \c code_props_none_init if there's no \c \%destructor or \c %printer. */ -code_props const *symbol_code_props_get (symbol const *sym, - code_props_type kind); +code_props *symbol_code_props_get (symbol *sym, code_props_type kind); /** Set the \c precedence associated with \c sym.