mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 19:01:06 +00:00
Give functions their own defspace.
The defspace is propogated through the function's sub-scopes.
This commit is contained in:
parent
27c5139612
commit
a648f043de
4 changed files with 9 additions and 4 deletions
|
@ -89,6 +89,7 @@ typedef struct symtab_s {
|
|||
struct hashtab_s *tab; ///< symbols defined in this table
|
||||
symbol_t *symbols; ///< chain of symbols in this table
|
||||
symbol_t **symtail; ///< keep chain in declaration order
|
||||
struct defspace_s *space; ///< storage for vars in scope symtabs
|
||||
} symtab_t;
|
||||
|
||||
/** Create a new, empty named symbol.
|
||||
|
|
|
@ -424,6 +424,7 @@ build_scope (symbol_t *fsym, symtab_t *parent)
|
|||
|
||||
symtab = new_symtab (parent, stab_local);
|
||||
fsym->s.func->symtab = symtab;
|
||||
symtab->space = new_defspace ();
|
||||
|
||||
if (fsym->type->t.func.num_params < 0) {
|
||||
args = new_symbol_type (".args", &type_va_list);
|
||||
|
|
|
@ -508,7 +508,7 @@ def_list
|
|||
def_item
|
||||
: def_name opt_initializer
|
||||
{
|
||||
initialize_def ($1, $<type>0, $2, pr.near_data, //FIXME right space
|
||||
initialize_def ($1, $<type>0, $2, current_symtab->space,
|
||||
current_storage);
|
||||
}
|
||||
;
|
||||
|
@ -636,8 +636,10 @@ opt_comma
|
|||
statement_block
|
||||
: '{'
|
||||
{
|
||||
if (!options.traditional)
|
||||
if (!options.traditional) {
|
||||
current_symtab = new_symtab (current_symtab, stab_local);
|
||||
current_symtab->space = current_symtab->parent->space;
|
||||
}
|
||||
}
|
||||
statements '}'
|
||||
{
|
||||
|
|
|
@ -141,7 +141,9 @@ InitData (void)
|
|||
pr.near_data->data = calloc (65536, sizeof (pr_type_t));
|
||||
pr.near_data->max_size = 65536;
|
||||
pr.near_data->grow = 0;
|
||||
//FIXME pr.scope = new_scope (sc_global, pr.near_data, 0);
|
||||
|
||||
pr.symtab = new_symtab (0, stab_global);
|
||||
pr.symtab->space = pr.near_data;
|
||||
|
||||
pr.entity_data = new_defspace ();
|
||||
|
||||
|
@ -360,7 +362,6 @@ setup_param_block (void)
|
|||
size_t i;
|
||||
symbol_t *sym;
|
||||
|
||||
pr.symtab = new_symtab (0, stab_global);
|
||||
for (i = 0; i < sizeof (defs) / sizeof (defs[0]); i++) {
|
||||
sym = new_symbol_type (defs[i].name, defs[i].type);
|
||||
symtab_addsymbol (pr.symtab, sym);
|
||||
|
|
Loading…
Reference in a new issue