linker.c:

don't seg on uninitialized fields
qc-parse.y:
	support @extern and @static blocks (eg, @extern { ... };)
This commit is contained in:
Bill Currie 2002-09-12 17:13:19 +00:00
parent 774b0adc2b
commit 842a9d2eb0
2 changed files with 15 additions and 4 deletions

View file

@ -410,7 +410,8 @@ fixup_relocs ()
case rel_def_field:
field_def = Hash_Find (field_defs,
strings->strings + def->name);
data->data[reloc->ofs].integer_var = field_def->ofs;
if (field_def) // null if not initialized
data->data[reloc->ofs].integer_var = field_def->ofs;
break;
}
}

View file

@ -193,7 +193,9 @@ defs
;
def
: storage_class type { current_type = $2; } def_list
: type { current_storage = st_global; current_type = $1; } def_list
| storage_class type { current_type = $2; } def_list
| storage_class '{' simple_defs '}'
| STRUCT NAME
{ struct_type = new_struct ($2); } '=' '{' struct_defs '}'
| UNION NAME
@ -209,9 +211,17 @@ def
}
;
simple_defs
: /* empty */
| simple_defs simple_def ';'
;
simple_def
: type { current_type = $1; } def_list
;
storage_class
: /* empty */ { current_storage = st_global; }
| EXTERN { current_storage = st_extern; }
: EXTERN { current_storage = st_extern; }
| STATIC { current_storage = st_static; }
;