mirror of
https://github.com/cc65/cc65.git
synced 2025-01-18 11:29:45 +00:00
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:
parent
bf2fa975bd
commit
f80a5148bd
@ -175,7 +175,7 @@ static void Parse (void)
|
|||||||
if (Size == 0) {
|
if (Size == 0) {
|
||||||
if (!IsTypeVoid (Decl.Type)) {
|
if (!IsTypeVoid (Decl.Type)) {
|
||||||
if (!IsTypeArray (Decl.Type)) {
|
if (!IsTypeArray (Decl.Type)) {
|
||||||
/* Size is unknown and not an array */
|
/* Size is unknown and not an array */
|
||||||
Error ("Variable `%s' has unknown size", Decl.Ident);
|
Error ("Variable `%s' has unknown size", Decl.Ident);
|
||||||
}
|
}
|
||||||
} else if (ANSI) {
|
} else if (ANSI) {
|
||||||
@ -204,19 +204,27 @@ static void Parse (void)
|
|||||||
if (IsTypeVoid (Decl.Type)) {
|
if (IsTypeVoid (Decl.Type)) {
|
||||||
/* We cannot declare variables of type void */
|
/* We cannot declare variables of type void */
|
||||||
Error ("Illegal type for variable `%s'", Decl.Ident);
|
Error ("Illegal type for variable `%s'", Decl.Ident);
|
||||||
} else if (Size == 0) {
|
Entry->Flags &= ~(SC_STORAGE | SC_DEF);
|
||||||
/* Size is unknown */
|
} else if (Size == 0) {
|
||||||
Error ("Variable `%s' has unknown size", Decl.Ident);
|
/* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the BSS segment */
|
/* Allocate storage if it is still needed */
|
||||||
g_usebss ();
|
if (Entry->Flags & SC_STORAGE) {
|
||||||
|
|
||||||
/* Define a label */
|
/* Switch to the BSS segment */
|
||||||
g_defgloblabel (Entry->Name);
|
g_usebss ();
|
||||||
|
|
||||||
/* Allocate space for uninitialized variable */
|
/* Define a label */
|
||||||
g_res (SizeOf (Entry->Type));
|
g_defgloblabel (Entry->Name);
|
||||||
|
|
||||||
|
/* Allocate space for uninitialized variable */
|
||||||
|
g_res (Size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user