mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 15:30:50 +00:00
Handle incomplete types gracefully.
This commit is contained in:
parent
ed3f98eab4
commit
c336aaeb80
2 changed files with 10 additions and 1 deletions
|
@ -113,7 +113,12 @@ new_def (const char *name, type_t *type, defspace_t *space,
|
||||||
def->type = type;
|
def->type = type;
|
||||||
|
|
||||||
if (storage != st_extern) {
|
if (storage != st_extern) {
|
||||||
def->offset = defspace_new_loc (space, type_size (type));
|
int size = type_size (type);
|
||||||
|
if (!size) {
|
||||||
|
error (0, "%s has incomplete type", name);
|
||||||
|
size = 1;
|
||||||
|
}
|
||||||
|
def->offset = defspace_new_loc (space, size);
|
||||||
}
|
}
|
||||||
if (space) {
|
if (space) {
|
||||||
def->space = space;
|
def->space = space;
|
||||||
|
|
|
@ -890,9 +890,13 @@ type_size (type_t *type)
|
||||||
case ev_invalid:
|
case ev_invalid:
|
||||||
switch (type->ty) {
|
switch (type->ty) {
|
||||||
case ty_enum:
|
case ty_enum:
|
||||||
|
if (!type->t.symtab)
|
||||||
|
return 0;
|
||||||
return type_size (&type_integer);
|
return type_size (&type_integer);
|
||||||
case ty_struct:
|
case ty_struct:
|
||||||
case ty_union:
|
case ty_union:
|
||||||
|
if (!type->t.symtab)
|
||||||
|
return 0;
|
||||||
return type->t.symtab->size;
|
return type->t.symtab->size;
|
||||||
case ty_class:
|
case ty_class:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue