mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
linker.c:
don't seg on uninitialized fields qc-parse.y: support @extern and @static blocks (eg, @extern { ... };)
This commit is contained in:
parent
774b0adc2b
commit
842a9d2eb0
2 changed files with 15 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue