diff --git a/tools/qfcc/include/symtab.h b/tools/qfcc/include/symtab.h index 626d7a484..f338077eb 100644 --- a/tools/qfcc/include/symtab.h +++ b/tools/qfcc/include/symtab.h @@ -48,6 +48,7 @@ typedef enum vis_e { } vis_t; typedef enum { + sy_name, ///< just a name (referent tbd) sy_var, ///< symbol refers to a variable sy_const, ///< symbol refers to a constant sy_type, ///< symbol refers to a type diff --git a/tools/qfcc/source/expr_assign.c b/tools/qfcc/source/expr_assign.c index 730396dfa..f6071a9f4 100644 --- a/tools/qfcc/source/expr_assign.c +++ b/tools/qfcc/source/expr_assign.c @@ -87,6 +87,8 @@ check_valid_lvalue (expr_t *expr) switch (expr->type) { case ex_symbol: switch (expr->e.symbol->sy_type) { + case sy_name: + break; case sy_var: return 0; case sy_const: diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 5ec3ad2f2..3e05a55e5 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -650,6 +650,7 @@ struct_decl $0.type = type_default; $1->type = append_type ($1->type, $0.type); $1->type = find_type ($1->type); + $1->sy_type = sy_var; symtab_addsymbol (current_symtab, $1); } | var_decl @@ -658,6 +659,7 @@ struct_decl $0.type = type_default; $1->type = append_type ($1->type, $0.type); $1->type = find_type ($1->type); + $1->sy_type = sy_var; symtab_addsymbol (current_symtab, $1); } | var_decl ':' expr %prec COMMA {} diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index 4cb81fa74..ddf30f8ea 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -246,6 +246,7 @@ make_structure (const char *name, int su, struct_def_t *defs, type_t *type) strct = new_symtab (0, stab_struct); while (defs->name) { field = new_symbol_type (defs->name, defs->type); + field->sy_type = sy_var; if (!symtab_addsymbol (strct, field)) internal_error (0, "duplicate symbol: %s", defs->name); defs++; diff --git a/tools/qfcc/source/symtab.c b/tools/qfcc/source/symtab.c index 3e18cf615..f26a690e7 100644 --- a/tools/qfcc/source/symtab.c +++ b/tools/qfcc/source/symtab.c @@ -52,6 +52,7 @@ static symtab_t *symtabs_freelist; static symbol_t *symbols_freelist; static const char *sy_type_names[] = { + "sy_name", "sy_var", "sy_const", "sy_type", @@ -234,5 +235,6 @@ make_symbol (const char *name, type_t *type, defspace_t *space, sym->s.def = new_def (name, type, space, storage); reloc_attach_relocs (relocs, &sym->s.def->relocs); } + sym->sy_type = sy_var; return sym; }