Fixed problem with array forward decl

git-svn-id: svn://svn.cc65.org/cc65/trunk@1994 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-02-19 22:58:13 +00:00
parent bf2fa975bd
commit f80a5148bd

View file

@ -204,10 +204,17 @@ static void Parse (void)
if (IsTypeVoid (Decl.Type)) {
/* We cannot declare variables of type void */
Error ("Illegal type for variable `%s'", Decl.Ident);
Entry->Flags &= ~(SC_STORAGE | SC_DEF);
} else if (Size == 0) {
/* Size is unknown */
/* Size is unknown. Is it an array? */
if (!IsTypeArray (Decl.Type)) {
Error ("Variable `%s' has unknown size", Decl.Ident);
}
Entry->Flags &= ~(SC_STORAGE | SC_DEF);
}
/* Allocate storage if it is still needed */
if (Entry->Flags & SC_STORAGE) {
/* Switch to the BSS segment */
g_usebss ();
@ -216,7 +223,8 @@ static void Parse (void)
g_defgloblabel (Entry->Name);
/* Allocate space for uninitialized variable */
g_res (SizeOf (Entry->Type));
g_res (Size);
}
}
}