mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 04:30:43 +00:00
find the rest (I hope!) of the mis-tested scopes
This commit is contained in:
parent
a771beed74
commit
7a13e6b362
4 changed files with 9 additions and 8 deletions
|
@ -82,7 +82,7 @@ check_for_name (type_t *type, const char *name, scope_t *scope, int allocate)
|
|||
}
|
||||
if (!name)
|
||||
return 0;
|
||||
if (!scope && (find_struct (name) || get_enum (name))) {
|
||||
if (scope->type == sc_static && (find_struct (name) || get_enum (name))) {
|
||||
error (0, "%s redeclared", name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ get_def (type_t *type, const char *name, scope_t *scope, int allocate)
|
|||
size = type_size (type->aux_type);
|
||||
scope->space->size += type->num_parms * size;
|
||||
|
||||
if (scope->parent) {
|
||||
if (scope->type != sc_static) {
|
||||
expr_t *e1 = new_expr ();
|
||||
expr_t *e2 = new_expr ();
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ convert_name (expr_t *e)
|
|||
}
|
||||
d = get_def (NULL, name, current_scope, 0);
|
||||
if (d) {
|
||||
if (!d->scope) {
|
||||
if (d->scope->type == sc_static) {
|
||||
new = class_ivar_expr (current_class, name);
|
||||
if (new)
|
||||
goto convert;
|
||||
|
@ -569,7 +569,7 @@ print_expr (expr_t *e)
|
|||
case ex_def:
|
||||
if (e->e.def->name)
|
||||
printf ("%s", e->e.def->name);
|
||||
if (e->e.def->scope) {
|
||||
if (e->e.def->scope->type != sc_static) {
|
||||
printf ("<%d>", e->e.def->ofs);
|
||||
} else {
|
||||
printf ("[%d]", e->e.def->ofs);
|
||||
|
@ -1790,7 +1790,7 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
|||
case ex_def:
|
||||
type = e1->e.def->type;
|
||||
if (type->type == ev_struct) {
|
||||
int abs = !e1->e.def->scope;
|
||||
int abs = e1->e.def->scope->type == sc_static;
|
||||
def_t *def = e1->e.def;
|
||||
|
||||
e = e1;
|
||||
|
|
|
@ -297,7 +297,7 @@ emit_methods (methodlist_t *_methods, const char *name, int instance)
|
|||
for (i = 0; i < count; i++)
|
||||
new_struct_field (method_list, type_Method.aux_type, 0, vis_public);
|
||||
methods_def = get_def (method_list, va ("_OBJ_%s_METHODS_%s", type, name),
|
||||
pr.scope, 1);
|
||||
pr.scope, 1);
|
||||
methods_def->initialized = methods_def->constant = 1;
|
||||
methods = &G_STRUCT (pr_method_list_t, methods_def->ofs);
|
||||
methods->method_next = 0;
|
||||
|
|
|
@ -153,7 +153,7 @@ WriteData (int crc)
|
|||
|
||||
if (!def->constant
|
||||
&& def->type->type != ev_func
|
||||
&& def->type->type != ev_field && def->scope == NULL)
|
||||
&& def->type->type != ev_field && def->scope->type == sc_static)
|
||||
dd->type |= DEF_SAVEGLOBAL;
|
||||
dd->s_name = ReuseString (def->name);
|
||||
dd->ofs = def->ofs;
|
||||
|
@ -322,7 +322,8 @@ finish_compilation (void)
|
|||
// check to make sure all functions prototyped have code
|
||||
if (options.warnings.undefined_function)
|
||||
for (d = pr.scope->head; d; d = d->def_next) {
|
||||
if (d->type->type == ev_func && !d->scope) { // function args ok
|
||||
if (d->type->type == ev_func && d->scope->type == sc_static) {
|
||||
// function args ok
|
||||
if (d->used) {
|
||||
if (!d->initialized) {
|
||||
warning (0, "function %s was called but not defined\n",
|
||||
|
|
Loading…
Reference in a new issue