allow modification on retrieved code_props.

The logic to compute the %printer or %destructor to used (i.e., a
code_props) is implemented twice: one, of course, in
symbol_code_props_get, and another time in symbol_check_defined to
record the fact that a code_props is used (so that we can reported
unused ones).  Let the former use the latter.

I would probably use "mutable" in C++ and keep these guys const,
but this is C.  And casting away constness triggers warnings.

* src/scan-code.h, src/scan-code.l (code_props_none): Is not const.
* src/symtab.h, src/symtab.c (symbol_code_props_get): The symbol
is not const.
(symbol_check_defined): Use it.
This commit is contained in:
Akim Demaille
2012-07-22 17:46:34 +02:00
parent a943967010
commit 70946cff5e
4 changed files with 7 additions and 15 deletions

View File

@@ -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.