Rename the storage_class_t enum values.

With the intoduction of the statement type enum came a prefix clash. As
"st" makes sense for "statement type", I decided that "storage class"
should be "sc". Although there haven't been any problems as of yet, I
decided it would be a good idea to clean up the clash now. It also helps
avoid confusion (I was a bit surprised after working with st_assign etc to
be reminded of st_extern etc).
This commit is contained in:
Bill Currie 2012-12-02 10:11:30 +09:00
parent 4c65d9f2a4
commit 5725c5124c
17 changed files with 77 additions and 77 deletions

View File

@ -66,12 +66,12 @@ typedef struct def_s {
} def_t; } def_t;
typedef enum storage_class_e { typedef enum storage_class_e {
st_global, sc_global,
st_system, sc_system,
st_extern, sc_extern,
st_static, sc_static,
st_param, sc_param,
st_local sc_local
} storage_class_t; } storage_class_t;
extern storage_class_t current_storage; extern storage_class_t current_storage;

View File

@ -228,7 +228,7 @@ class_symbol (class_type_t *class_type, int external)
return 0; // probably in error recovery return 0; // probably in error recovery
} }
sym = make_symbol (name, type, pr.far_data, sym = make_symbol (name, type, pr.far_data,
external ? st_extern : st_global); external ? sc_extern : sc_global);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
return sym; return sym;
@ -432,7 +432,7 @@ emit_ivars (symtab_t *ivars, const char *name)
ivar_list_struct[1].type = array_type (&type_obj_ivar, ivar_data.count); ivar_list_struct[1].type = array_type (&type_obj_ivar, ivar_data.count);
def = emit_structure (va ("_OBJ_INSTANCE_VARIABLES_%s", name), 's', def = emit_structure (va ("_OBJ_INSTANCE_VARIABLES_%s", name), 's',
ivar_list_struct, 0, &ivar_data, st_static); ivar_list_struct, 0, &ivar_data, sc_static);
dstring_delete (ivar_data.encoding); dstring_delete (ivar_data.encoding);
return def; return def;
@ -449,7 +449,7 @@ begin_class (class_t *class)
defspace_t *space; defspace_t *space;
sym = make_symbol (va ("_OBJ_METACLASS_%s", class->name), sym = make_symbol (va ("_OBJ_METACLASS_%s", class->name),
&type_obj_class, pr.far_data, st_static); &type_obj_class, pr.far_data, sc_static);
meta_def = sym->s.def; meta_def = sym->s.def;
meta_def->initialized = meta_def->constant = meta_def->nosave = 1; meta_def->initialized = meta_def->constant = meta_def->nosave = 1;
space = meta_def->space; space = meta_def->space;
@ -511,7 +511,7 @@ emit_class_ref (const char *class_name)
def_t *name_def; def_t *name_def;
ref_sym = make_symbol (va (".obj_class_ref_%s", class_name), &type_pointer, ref_sym = make_symbol (va (".obj_class_ref_%s", class_name), &type_pointer,
pr.far_data, st_static); pr.far_data, sc_static);
if (!ref_sym->table) if (!ref_sym->table)
symtab_addsymbol (pr.symtab, ref_sym); symtab_addsymbol (pr.symtab, ref_sym);
ref_def = ref_sym->s.def; ref_def = ref_sym->s.def;
@ -519,7 +519,7 @@ emit_class_ref (const char *class_name)
return; return;
ref_def->initialized = ref_def->constant = ref_def->nosave = 1; ref_def->initialized = ref_def->constant = ref_def->nosave = 1;
name_sym = make_symbol (va (".obj_class_name_%s", class_name), name_sym = make_symbol (va (".obj_class_name_%s", class_name),
&type_pointer, pr.far_data, st_extern); &type_pointer, pr.far_data, sc_extern);
if (!name_sym->table) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym); symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def; name_def = name_sym->s.def;
@ -535,7 +535,7 @@ emit_class_name (const char *class_name)
def_t *name_def; def_t *name_def;
name_sym = make_symbol (va (".obj_class_name_%s", class_name), name_sym = make_symbol (va (".obj_class_name_%s", class_name),
&type_pointer, pr.far_data, st_global); &type_pointer, pr.far_data, sc_global);
if (!name_sym->table) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym); symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def; name_def = name_sym->s.def;
@ -556,7 +556,7 @@ emit_category_ref (const char *class_name, const char *category_name)
ref_sym = make_symbol (va (".obj_category_ref_%s_%s", ref_sym = make_symbol (va (".obj_category_ref_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_static); &type_pointer, pr.far_data, sc_static);
if (!ref_sym->table) if (!ref_sym->table)
symtab_addsymbol (pr.symtab, ref_sym); symtab_addsymbol (pr.symtab, ref_sym);
ref_def = ref_sym->s.def; ref_def = ref_sym->s.def;
@ -566,7 +566,7 @@ emit_category_ref (const char *class_name, const char *category_name)
ref_def->nosave = 1; ref_def->nosave = 1;
name_sym = make_symbol (va (".obj_category_name_%s_%s", name_sym = make_symbol (va (".obj_category_name_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_extern); &type_pointer, pr.far_data, sc_extern);
if (!name_sym->table) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym); symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def; name_def = name_sym->s.def;
@ -583,7 +583,7 @@ emit_category_name (const char *class_name, const char *category_name)
name_sym = make_symbol (va (".obj_category_name_%s_%s", name_sym = make_symbol (va (".obj_category_name_%s_%s",
class_name, category_name), class_name, category_name),
&type_pointer, pr.far_data, st_global); &type_pointer, pr.far_data, sc_global);
if (!name_sym->table) if (!name_sym->table)
symtab_addsymbol (pr.symtab, name_sym); symtab_addsymbol (pr.symtab, name_sym);
name_def = name_sym->s.def; name_def = name_sym->s.def;
@ -959,7 +959,7 @@ class_pointer_symbol (class_t *class)
sym = make_symbol (va ("_OBJ_CLASS_POINTER_%s", class->name), sym = make_symbol (va ("_OBJ_CLASS_POINTER_%s", class->name),
&type_Class, &type_Class,
pr.near_data, st_static); pr.near_data, sc_static);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
def = sym->s.def; def = sym->s.def;
@ -1100,12 +1100,12 @@ class_finish_module (void)
symtab_struct[4].type = array_type (&type_pointer, symtab_struct[4].type = array_type (&type_pointer,
data.cls_def_cnt + data.cat_def_cnt); data.cls_def_cnt + data.cat_def_cnt);
symtab_def = emit_structure ("_OBJ_SYMTAB", 's', symtab_struct, 0, &data, symtab_def = emit_structure ("_OBJ_SYMTAB", 's', symtab_struct, 0, &data,
st_static); sc_static);
free (data.classes); free (data.classes);
free (data.categories); free (data.categories);
module_sym = make_symbol ("_OBJ_MODULE", &type_obj_module, pr.far_data, module_sym = make_symbol ("_OBJ_MODULE", &type_obj_module, pr.far_data,
st_static); sc_static);
symtab_addsymbol (current_symtab, module_sym); symtab_addsymbol (current_symtab, module_sym);
module = &D_STRUCT (pr_module_t, module_sym->s.def); module = &D_STRUCT (pr_module_t, module_sym->s.def);
module->size = type_size (&type_obj_module); module->size = type_size (&type_obj_module);
@ -1119,7 +1119,7 @@ class_finish_module (void)
&type_obj_exec_class); &type_obj_exec_class);
exec_class_sym = function_symbol (exec_class_sym, 0, 1); exec_class_sym = function_symbol (exec_class_sym, 0, 1);
make_function (exec_class_sym, 0, exec_class_sym->table->space, make_function (exec_class_sym, 0, exec_class_sym->table->space,
st_extern); sc_extern);
} }
init_sym = new_symbol_type (".ctor", &type_function); init_sym = new_symbol_type (".ctor", &type_function);
@ -1133,7 +1133,7 @@ class_finish_module (void)
0, 0))); 0, 0)));
save_storage = current_storage; save_storage = current_storage;
current_storage = st_static; current_storage = sc_static;
current_func = begin_function (init_sym, 0, current_symtab, 1); current_func = begin_function (init_sym, 0, current_symtab, 1);
build_code_function (init_sym, 0, init_expr);; build_code_function (init_sym, 0, init_expr);;
current_func = 0; current_func = 0;
@ -1184,7 +1184,7 @@ def_t *
protocol_def (protocol_t *protocol) protocol_def (protocol_t *protocol)
{ {
return make_symbol (protocol->name, &type_obj_protocol, return make_symbol (protocol->name, &type_obj_protocol,
pr.far_data, st_static)->s.def; pr.far_data, sc_static)->s.def;
} }
protocollist_t * protocollist_t *
@ -1221,7 +1221,7 @@ emit_protocol (protocol_t *protocol)
defspace_t *space; defspace_t *space;
proto_def = make_symbol (va ("_OBJ_PROTOCOL_%s", protocol->name), proto_def = make_symbol (va ("_OBJ_PROTOCOL_%s", protocol->name),
&type_obj_protocol, pr.far_data, st_static)->s.def; &type_obj_protocol, pr.far_data, sc_static)->s.def;
if (proto_def->initialized) if (proto_def->initialized)
return proto_def; return proto_def;
proto_def->initialized = proto_def->constant = 1; proto_def->initialized = proto_def->constant = 1;
@ -1263,7 +1263,7 @@ emit_protocol_list (protocollist_t *protocols, const char *name)
proto_list_type = make_structure (0, 's', proto_list_struct, 0)->type; proto_list_type = make_structure (0, 's', proto_list_struct, 0)->type;
proto_list_def = make_symbol (va ("_OBJ_PROTOCOLS_%s", name), proto_list_def = make_symbol (va ("_OBJ_PROTOCOLS_%s", name),
proto_list_type, proto_list_type,
pr.far_data, st_static)->s.def; pr.far_data, sc_static)->s.def;
proto_list_def->initialized = proto_list_def->constant = 1; proto_list_def->initialized = proto_list_def->constant = 1;
proto_list_def->nosave = 1; proto_list_def->nosave = 1;
space = proto_list_def->space; space = proto_list_def->space;

View File

@ -65,34 +65,34 @@ static void
set_storage_bits (def_t *def, storage_class_t storage) set_storage_bits (def_t *def, storage_class_t storage)
{ {
switch (storage) { switch (storage) {
case st_system: case sc_system:
def->system = 1; def->system = 1;
// fall through // fall through
case st_global: case sc_global:
def->global = 1; def->global = 1;
def->external = 0; def->external = 0;
def->local = 0; def->local = 0;
def->param = 0; def->param = 0;
break; break;
case st_extern: case sc_extern:
def->global = 1; def->global = 1;
def->external = 1; def->external = 1;
def->local = 0; def->local = 0;
def->param = 0; def->param = 0;
break; break;
case st_static: case sc_static:
def->external = 0; def->external = 0;
def->global = 0; def->global = 0;
def->local = 0; def->local = 0;
def->param = 0; def->param = 0;
break; break;
case st_local: case sc_local:
def->external = 0; def->external = 0;
def->global = 0; def->global = 0;
def->local = 1; def->local = 1;
def->param = 0; def->param = 0;
break; break;
case st_param: case sc_param:
def->external = 0; def->external = 0;
def->global = 0; def->global = 0;
def->local = 1; def->local = 1;
@ -129,10 +129,10 @@ new_def (const char *name, type_t *type, defspace_t *space,
if (!type) if (!type)
return def; return def;
if (!space && storage != st_extern) if (!space && storage != sc_extern)
internal_error (0, "non-external def with no storage space"); internal_error (0, "non-external def with no storage space");
if (storage != st_extern) { if (storage != sc_extern) {
int size = type_size (type); int size = type_size (type);
if (!size) { if (!size) {
error (0, "%s has incomplete type", name); error (0, "%s has incomplete type", name);
@ -186,7 +186,7 @@ temp_def (etype_t type, int size)
temp->type = ev_types[type]; temp->type = ev_types[type];
temp->file = pr.source_file; temp->file = pr.source_file;
temp->line = pr.source_line; temp->line = pr.source_line;
set_storage_bits (temp, st_local); set_storage_bits (temp, sc_local);
temp->space = space; temp->space = space;
return temp; return temp;
} }
@ -420,7 +420,7 @@ init_field_def (def_t *def, expr_t *init, storage_class_t storage)
field_def = field_sym->s.def; field_def = field_sym->s.def;
if (!field_sym->table) if (!field_sym->table)
symtab_addsymbol (pr.entity_fields, field_sym); symtab_addsymbol (pr.entity_fields, field_sym);
if (storage != st_extern) { if (storage != sc_extern) {
D_INT (def) = field_def->offset; D_INT (def) = field_def->offset;
reloc_def_field (field_def, def); reloc_def_field (field_def, def);
def->constant = 1; def->constant = 1;
@ -459,7 +459,7 @@ initialize_def (symbol_t *sym, type_t *type, expr_t *init, defspace_t *space,
// is var and same type // is var and same type
if (!check->s.def) if (!check->s.def)
internal_error (0, "half defined var"); internal_error (0, "half defined var");
if (storage == st_extern) { if (storage == sc_extern) {
if (init) if (init)
warning (0, "initializing external variable"); warning (0, "initializing external variable");
return; return;
@ -474,7 +474,7 @@ initialize_def (symbol_t *sym, type_t *type, expr_t *init, defspace_t *space,
sym->type = type; sym->type = type;
if (!sym->table) if (!sym->table)
symtab_addsymbol (current_symtab, sym); symtab_addsymbol (current_symtab, sym);
// if (storage == st_global && init && is_scalar (type)) { // if (storage == sc_global && init && is_scalar (type)) {
// sym->sy_type = sy_const; // sym->sy_type = sy_const;
// memset (&sym->s.value, 0, sizeof (&sym->s.value)); // memset (&sym->s.value, 0, sizeof (&sym->s.value));
// if (init->type != ex_value) { //FIXME arrays/structs // if (init->type != ex_value) { //FIXME arrays/structs
@ -497,9 +497,9 @@ initialize_def (symbol_t *sym, type_t *type, expr_t *init, defspace_t *space,
} }
if (type == &type_vector && options.code.vector_components) if (type == &type_vector && options.code.vector_components)
init_vector_components (sym, 0); init_vector_components (sym, 0);
if (type->type == ev_field && storage != st_local && storage != st_param) if (type->type == ev_field && storage != sc_local && storage != sc_param)
init_field_def (sym->s.def, init, storage); init_field_def (sym->s.def, init, storage);
if (storage == st_extern) { if (storage == sc_extern) {
if (init) if (init)
warning (0, "initializing external variable"); warning (0, "initializing external variable");
return; return;

View File

@ -66,7 +66,7 @@ get_value_def (ex_value_t *value, etype_t type)
def_t *def; def_t *def;
if (type == ev_short) { if (type == ev_short) {
def = new_def (0, &type_short, 0, st_extern); def = new_def (0, &type_short, 0, sc_extern);
def->offset = value->v.short_val; def->offset = value->v.short_val;
return def; return def;
} }

View File

@ -844,7 +844,7 @@ new_self_expr (void)
{ {
symbol_t *sym; symbol_t *sym;
sym = make_symbol (".self", &type_entity, pr.near_data, st_extern); sym = make_symbol (".self", &type_entity, pr.near_data, sc_extern);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
return new_symbol_expr (sym); return new_symbol_expr (sym);
@ -855,7 +855,7 @@ new_this_expr (void)
{ {
symbol_t *sym; symbol_t *sym;
sym = make_symbol (".this", field_type (&type_id), pr.near_data, st_extern); sym = make_symbol (".this", field_type (&type_id), pr.near_data, sc_extern);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
return new_symbol_expr (sym); return new_symbol_expr (sym);
@ -881,7 +881,7 @@ param_expr (const char *name, type_t *type)
symbol_t *sym; symbol_t *sym;
expr_t *sym_expr; expr_t *sym_expr;
sym = make_symbol (name, &type_param, pr.symtab->space, st_extern); sym = make_symbol (name, &type_param, pr.symtab->space, sc_extern);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
sym_expr = new_symbol_expr (sym); sym_expr = new_symbol_expr (sym);
@ -2702,12 +2702,12 @@ selector_expr (keywordarg_t *selector)
index = selector_index (sel_id->str); index = selector_index (sel_id->str);
index *= type_size (type_SEL.t.fldptr.type); index *= type_size (type_SEL.t.fldptr.type);
sel_sym = make_symbol ("_OBJ_SELECTOR_TABLE_PTR", &type_SEL, sel_sym = make_symbol ("_OBJ_SELECTOR_TABLE_PTR", &type_SEL,
pr.near_data, st_static); pr.near_data, sc_static);
if (!sel_sym->table) { if (!sel_sym->table) {
symtab_addsymbol (pr.symtab, sel_sym); symtab_addsymbol (pr.symtab, sel_sym);
sel_table = make_symbol ("_OBJ_SELECTOR_TABLE", sel_table = make_symbol ("_OBJ_SELECTOR_TABLE",
array_type (type_SEL.t.fldptr.type, 0), array_type (type_SEL.t.fldptr.type, 0),
pr.far_data, st_extern); pr.far_data, sc_extern);
if (!sel_table->table) if (!sel_table->table)
symtab_addsymbol (pr.symtab, sel_table); symtab_addsymbol (pr.symtab, sel_table);
reloc_def_def (sel_table->s.def, sel_sym->s.def); reloc_def_def (sel_table->s.def, sel_sym->s.def);
@ -2758,7 +2758,7 @@ super_expr (class_type_t *class_type)
if (!sym || sym->table != current_symtab) { if (!sym || sym->table != current_symtab) {
sym = new_symbol (".super"); sym = new_symbol (".super");
initialize_def (sym, &type_obj_super, 0, current_symtab->space, initialize_def (sym, &type_obj_super, 0, current_symtab->space,
st_local); sc_local);
} }
super = new_symbol_expr (sym); super = new_symbol_expr (sym);

View File

@ -305,7 +305,7 @@ static symbol_t *
param_symbol (const char *name) param_symbol (const char *name)
{ {
symbol_t *sym; symbol_t *sym;
sym = make_symbol (name, &type_param, pr.symtab->space, st_extern); sym = make_symbol (name, &type_param, pr.symtab->space, sc_extern);
if (!sym->table) if (!sym->table)
symtab_addsymbol (pr.symtab, sym); symtab_addsymbol (pr.symtab, sym);
return sym; return sym;

View File

@ -456,7 +456,7 @@ build_scope (symbol_t *fsym, symtab_t *parent)
if (fsym->type->t.func.num_params < 0) { if (fsym->type->t.func.num_params < 0) {
args = new_symbol_type (".args", &type_va_list); args = new_symbol_type (".args", &type_va_list);
initialize_def (args, args->type, 0, symtab->space, st_param); initialize_def (args, args->type, 0, symtab->space, sc_param);
} }
for (p = fsym->params, i = 0; p; p = p->next) { for (p = fsym->params, i = 0; p; p = p->next) {
@ -465,14 +465,14 @@ build_scope (symbol_t *fsym, symtab_t *parent)
if (!p->type) if (!p->type)
continue; // non-param selector continue; // non-param selector
param = new_symbol_type (p->name, p->type); param = new_symbol_type (p->name, p->type);
initialize_def (param, param->type, 0, symtab->space, st_param); initialize_def (param, param->type, 0, symtab->space, sc_param);
i++; i++;
} }
if (args) { if (args) {
while (i < MAX_PARMS) { while (i < MAX_PARMS) {
param = new_symbol_type (va (".par%d", i), &type_param); param = new_symbol_type (va (".par%d", i), &type_param);
initialize_def (param, &type_param, 0, symtab->space, st_param); initialize_def (param, &type_param, 0, symtab->space, sc_param);
i++; i++;
} }
} }
@ -499,14 +499,14 @@ make_function (symbol_t *sym, const char *nice_name, defspace_t *space,
reloc_t *relocs = 0; reloc_t *relocs = 0;
if (sym->sy_type != sy_func) if (sym->sy_type != sy_func)
internal_error (0, "%s is not a function", sym->name); internal_error (0, "%s is not a function", sym->name);
if (storage == st_extern && sym->s.func) if (storage == sc_extern && sym->s.func)
return; return;
if (!sym->s.func) { if (!sym->s.func) {
sym->s.func = new_function (sym->name, nice_name); sym->s.func = new_function (sym->name, nice_name);
sym->s.func->sym = sym; sym->s.func->sym = sym;
} }
if (sym->s.func->def && sym->s.func->def->external if (sym->s.func->def && sym->s.func->def->external
&& storage != st_extern) { && storage != sc_extern) {
//FIXME this really is not the right way //FIXME this really is not the right way
relocs = sym->s.func->def->relocs; relocs = sym->s.func->def->relocs;
free_def (sym->s.func->def); free_def (sym->s.func->def);

View File

@ -260,7 +260,7 @@ send_message (int super)
current_symtab = pr.symtab; current_symtab = pr.symtab;
sym = new_symbol_type (sm_name, sm_type); sym = new_symbol_type (sm_name, sm_type);
sym = function_symbol (sym, 0, 1); sym = function_symbol (sym, 0, 1);
make_function (sym, 0, sym->table->space, st_extern); make_function (sym, 0, sym->table->space, sc_extern);
current_symtab = save; current_symtab = save;
} }
return new_symbol_expr (sym); return new_symbol_expr (sym);
@ -387,7 +387,7 @@ emit_selectors (void)
sel_type = array_type (type_SEL.t.fldptr.type, sel_index); sel_type = array_type (type_SEL.t.fldptr.type, sel_index);
sel_sym = make_symbol ("_OBJ_SELECTOR_TABLE", sel_type, sel_sym = make_symbol ("_OBJ_SELECTOR_TABLE", sel_type,
pr.far_data, st_static); pr.far_data, sc_static);
if (!sel_sym->table) if (!sel_sym->table)
symtab_addsymbol (pr.symtab, sel_sym); symtab_addsymbol (pr.symtab, sel_sym);
sel_def = sel_sym->s.def; sel_def = sel_sym->s.def;
@ -489,7 +489,7 @@ emit_methods (methodlist_t *methods, const char *name, int instance)
methods_struct[2].type = array_type (&type_obj_method, count); methods_struct[2].type = array_type (&type_obj_method, count);
return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's', return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's',
methods_struct, 0, methods, st_static); methods_struct, 0, methods, sc_static);
} }
static void static void
@ -556,7 +556,7 @@ emit_method_descriptions (methodlist_t *methods, const char *name,
method_list_struct[1].type = array_type (&type_obj_method_description, method_list_struct[1].type = array_type (&type_obj_method_description,
count); count);
return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's', return emit_structure (va ("_OBJ_%s_METHODS_%s", type, name), 's',
method_list_struct, 0, methods, st_static); method_list_struct, 0, methods, sc_static);
} }
void void

View File

@ -84,7 +84,7 @@ qfo_new_encoding (type_t *type, int size)
size += sizeof (qfot_type_t) - sizeof (enc->t); size += sizeof (qfot_type_t) - sizeof (enc->t);
size /= sizeof (pr_type_t); size /= sizeof (pr_type_t);
def = new_def (type->encoding, 0, pr.type_data, st_static); def = new_def (type->encoding, 0, pr.type_data, sc_static);
def->offset = defspace_alloc_loc (pr.type_data, size); def->offset = defspace_alloc_loc (pr.type_data, size);
enc = D_POINTER (qfot_type_t, def); enc = D_POINTER (qfot_type_t, def);
@ -176,7 +176,7 @@ qfo_encode_struct (type_t *type)
if (type->meta == ty_enum) if (type->meta == ty_enum)
sy = sy_const; sy = sy_const;
if (!type->t.symtab) { if (!type->t.symtab) {
def = new_def (type->encoding, 0, pr.type_data, st_extern); def = new_def (type->encoding, 0, pr.type_data, sc_extern);
return def; return def;
} }
for (num_fields = 0, sym = type->t.symtab->symbols; sym; sym = sym->next) { for (num_fields = 0, sym = type->t.symtab->symbols; sym; sym = sym->next) {

View File

@ -333,7 +333,7 @@ function_body
$<symtab>$ = current_symtab; $<symtab>$ = current_symtab;
current_func = begin_function ($<symbol>2, 0, current_symtab, 0); current_func = begin_function ($<symbol>2, 0, current_symtab, 0);
current_symtab = current_func->symtab; current_symtab = current_func->symtab;
current_storage = st_local; current_storage = sc_local;
} }
compound_statement compound_statement
{ {
@ -413,10 +413,10 @@ external_decl
; ;
storage_class storage_class
: EXTERN { $$ = make_spec (0, st_extern, 0, 0); } : EXTERN { $$ = make_spec (0, sc_extern, 0, 0); }
| STATIC { $$ = make_spec (0, st_static, 0, 0); } | STATIC { $$ = make_spec (0, sc_static, 0, 0); }
| SYSTEM { $$ = make_spec (0, st_system, 0, 0); } | SYSTEM { $$ = make_spec (0, sc_system, 0, 0); }
| TYPEDEF { $$ = make_spec (0, st_global, 1, 0); } | TYPEDEF { $$ = make_spec (0, sc_global, 1, 0); }
| OVERLOAD { $$ = make_spec (0, current_storage, 0, 1); } | OVERLOAD { $$ = make_spec (0, current_storage, 0, 1); }
; ;
@ -939,7 +939,7 @@ code_func
$<symtab>$ = current_symtab; $<symtab>$ = current_symtab;
current_func = begin_function ($<symbol>0, 0, current_symtab, 0); current_func = begin_function ($<symbol>0, 0, current_symtab, 0);
current_symtab = current_func->symtab; current_symtab = current_func->symtab;
current_storage = st_local; current_storage = sc_local;
} }
compound_statement compound_statement
{ {
@ -1034,7 +1034,7 @@ local_def
: local_specifiers : local_specifiers
{ {
if (!$1.storage) if (!$1.storage)
$1.storage = st_local; $1.storage = sc_local;
$<spec>$ = $1; $<spec>$ = $1;
local_expr = new_block_expr (); local_expr = new_block_expr ();
} }
@ -1614,7 +1614,7 @@ methoddef
method->func = sym->s.func; method->func = sym->s.func;
method->def = sym->s.func->def; method->def = sym->s.func->def;
current_symtab = current_func->symtab; current_symtab = current_func->symtab;
current_storage = st_local; current_storage = sc_local;
} }
compound_statement compound_statement
{ {

View File

@ -239,7 +239,7 @@ subprogram_declaration
$<storage>$ = current_storage; $<storage>$ = current_storage;
current_func = begin_function ($1, 0, current_symtab, 0); current_func = begin_function ($1, 0, current_symtab, 0);
current_symtab = current_func->symtab; current_symtab = current_func->symtab;
current_storage = st_local; current_storage = sc_local;
} }
declarations compound_statement ';' declarations compound_statement ';'
{ {

View File

@ -44,7 +44,7 @@ function_t *current_func;
class_type_t *current_class; class_type_t *current_class;
expr_t *local_expr; expr_t *local_expr;
vis_t current_visibility; vis_t current_visibility;
storage_class_t current_storage = st_global; storage_class_t current_storage = sc_global;
symtab_t *current_symtab; symtab_t *current_symtab;
/* When defining a new symbol, already existing symbols must be in a /* When defining a new symbol, already existing symbols must be in a

View File

@ -1484,7 +1484,7 @@ check_final_block (sblock_t *sblock)
warning (0, "control reaches end of non-void function"); warning (0, "control reaches end of non-void function");
if (options.traditional || options.code.progsversion == PROG_ID_VERSION) { if (options.traditional || options.code.progsversion == PROG_ID_VERSION) {
return_symbol = make_symbol (".return", &type_param, pr.symtab->space, return_symbol = make_symbol (".return", &type_param, pr.symtab->space,
st_extern); sc_extern);
return_opcode = "<RETURN>"; return_opcode = "<RETURN>";
} }
if (return_symbol) { if (return_symbol) {

View File

@ -281,7 +281,7 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
} }
if (defs[i].name) if (defs[i].name)
internal_error (0, "structure %s too many defs", name); internal_error (0, "structure %s too many defs", name);
if (storage != st_global && storage != st_static) if (storage != sc_global && storage != sc_static)
internal_error (0, "structure %s must be global or static", name); internal_error (0, "structure %s must be global or static", name);
struct_sym = make_symbol (name, type, pr.far_data, storage); struct_sym = make_symbol (name, type, pr.far_data, storage);

View File

@ -343,7 +343,7 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val,
} }
table_sym = new_symbol (table_name); table_sym = new_symbol (table_name);
initialize_def (table_sym, array_type (&type_integer, high - low + 1), initialize_def (table_sym, array_type (&type_integer, high - low + 1),
table_init, pr.near_data, st_static); table_init, pr.near_data, sc_static);
table_expr = new_symbol_expr (table_sym); table_expr = new_symbol_expr (table_sym);
table_expr = new_alias_expr (&type_integer, table_expr); table_expr = new_alias_expr (&type_integer, table_expr);

View File

@ -189,9 +189,9 @@ make_symbol (const char *name, type_t *type, defspace_t *space,
symbol_t *sym; symbol_t *sym;
struct reloc_s *relocs = 0; struct reloc_s *relocs = 0;
if (storage != st_extern && storage != st_global && storage != st_static) if (storage != sc_extern && storage != sc_global && storage != sc_static)
internal_error (0, "invalid storage class for %s", __FUNCTION__); internal_error (0, "invalid storage class for %s", __FUNCTION__);
if (storage != st_extern && !space) if (storage != sc_extern && !space)
internal_error (0, "null space for non-external storage"); internal_error (0, "null space for non-external storage");
sym = symtab_lookup (pr.symtab, name); sym = symtab_lookup (pr.symtab, name);
if (!sym) { if (!sym) {
@ -206,7 +206,7 @@ make_symbol (const char *name, type_t *type, defspace_t *space,
sym = new_symbol_type (name, type); sym = new_symbol_type (name, type);
} }
} }
if (sym->s.def && sym->s.def->external && storage != st_extern) { if (sym->s.def && sym->s.def->external && storage != sc_extern) {
//FIXME this really is not the right way //FIXME this really is not the right way
relocs = sym->s.def->relocs; relocs = sym->s.def->relocs;
free_def (sym->s.def); free_def (sym->s.def);

View File

@ -481,7 +481,7 @@ emit_value (ex_value_t *value, def_t *def)
imm = 0; //FIXME do full def aliasing imm = 0; //FIXME do full def aliasing
} else { } else {
symbol_t *sym; symbol_t *sym;
sym = make_symbol (".zero", &type_zero, 0, st_extern); sym = make_symbol (".zero", &type_zero, 0, sc_extern);
return sym->s.def; return sym->s.def;
} }
} }
@ -496,7 +496,7 @@ emit_value (ex_value_t *value, def_t *def)
cn = def; cn = def;
} else { } else {
if (cn->type != type) { if (cn->type != type) {
def = new_def (".imm", type, pr.near_data, st_static); def = new_def (".imm", type, pr.near_data, sc_static);
def->offset = cn->offset; def->offset = cn->offset;
cn = def; cn = def;
} }
@ -507,13 +507,13 @@ emit_value (ex_value_t *value, def_t *def)
// always share immediates // always share immediates
if (def) { if (def) {
if (def->type != type) { if (def->type != type) {
cn = new_def (".imm", type, pr.near_data, st_static); cn = new_def (".imm", type, pr.near_data, sc_static);
cn->offset = def->offset; cn->offset = def->offset;
} else { } else {
cn = def; cn = def;
} }
} else { } else {
cn = new_def (".imm", type, pr.near_data, st_static); cn = new_def (".imm", type, pr.near_data, sc_static);
} }
cn->initialized = cn->constant = 1; cn->initialized = cn->constant = 1;
cn->nosave = 1; cn->nosave = 1;
@ -603,7 +603,7 @@ clear_immediates (void)
Hash_SetHashCompare (integer_imm_defs, imm_get_hash, imm_compare); Hash_SetHashCompare (integer_imm_defs, imm_get_hash, imm_compare);
} }
def = make_symbol (".zero", &type_zero, 0, st_extern)->s.def; def = make_symbol (".zero", &type_zero, 0, sc_extern)->s.def;
make_def_imm (def, string_imm_defs); make_def_imm (def, string_imm_defs);
make_def_imm (def, float_imm_defs); make_def_imm (def, float_imm_defs);