mirror of
https://github.com/cc65/cc65.git
synced 2024-06-26 20:29:34 +00:00
Fixed an error.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3784 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7e44cdbd5f
commit
fd7e66f24c
|
@ -427,6 +427,12 @@ static void ParseOneDecl (const DeclSpec* Spec)
|
||||||
} else if ((SC & SC_AUTO) == SC_AUTO) {
|
} else if ((SC & SC_AUTO) == SC_AUTO) {
|
||||||
/* Auto variable */
|
/* Auto variable */
|
||||||
SymData = ParseAutoDecl (&Decl, &SC);
|
SymData = ParseAutoDecl (&Decl, &SC);
|
||||||
|
} else if ((SC & SC_EXTERN) == SC_EXTERN) {
|
||||||
|
/* External identifier - may not get initialized */
|
||||||
|
if (CurTok.Tok == TOK_ASSIGN) {
|
||||||
|
Error ("Cannot initialize externals");
|
||||||
|
}
|
||||||
|
SymData = 0;
|
||||||
} else if ((SC & SC_STATIC) == SC_STATIC) {
|
} else if ((SC & SC_STATIC) == SC_STATIC) {
|
||||||
/* Static variable */
|
/* Static variable */
|
||||||
SymData = ParseStaticDecl (&Decl, &SC);
|
SymData = ParseStaticDecl (&Decl, &SC);
|
||||||
|
@ -451,7 +457,7 @@ static void ParseOneDecl (const DeclSpec* Spec)
|
||||||
AddLocalSym (Decl.Ident, Decl.Type, SC, SymData);
|
AddLocalSym (Decl.Ident, Decl.Type, SC, SymData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DeclareLocals (void)
|
void DeclareLocals (void)
|
||||||
/* Declare local variables and types. */
|
/* Declare local variables and types. */
|
||||||
|
@ -462,38 +468,38 @@ void DeclareLocals (void)
|
||||||
/* Loop until we don't find any more variables */
|
/* Loop until we don't find any more variables */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
/* Check variable declarations. We need to distinguish between a
|
/* Check variable declarations. We need to distinguish between a
|
||||||
* default int type and the end of variable declarations. So we
|
* default int type and the end of variable declarations. So we
|
||||||
* will do the following: If there is no explicit storage class
|
* will do the following: If there is no explicit storage class
|
||||||
* specifier *and* no explicit type given, *and* no type qualifiers
|
* specifier *and* no explicit type given, *and* no type qualifiers
|
||||||
* have been read, it is assumed that we have reached the end of
|
* have been read, it is assumed that we have reached the end of
|
||||||
* declarations.
|
* declarations.
|
||||||
*/
|
*/
|
||||||
DeclSpec Spec;
|
DeclSpec Spec;
|
||||||
ParseDeclSpec (&Spec, SC_AUTO, T_INT);
|
ParseDeclSpec (&Spec, SC_AUTO, T_INT);
|
||||||
if ((Spec.Flags & DS_DEF_STORAGE) != 0 && /* No storage spec */
|
if ((Spec.Flags & DS_DEF_STORAGE) != 0 && /* No storage spec */
|
||||||
(Spec.Flags & DS_DEF_TYPE) != 0 && /* No type given */
|
(Spec.Flags & DS_DEF_TYPE) != 0 && /* No type given */
|
||||||
GetQualifier (Spec.Type) == T_QUAL_NONE) { /* No type qualifier */
|
GetQualifier (Spec.Type) == T_QUAL_NONE) { /* No type qualifier */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Accept type only declarations */
|
/* Accept type only declarations */
|
||||||
if (CurTok.Tok == TOK_SEMI) {
|
if (CurTok.Tok == TOK_SEMI) {
|
||||||
/* Type declaration only */
|
/* Type declaration only */
|
||||||
CheckEmptyDecl (&Spec);
|
CheckEmptyDecl (&Spec);
|
||||||
NextToken ();
|
NextToken ();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse a comma separated variable list */
|
/* Parse a comma separated variable list */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
/* Parse one declaration */
|
/* Parse one declaration */
|
||||||
ParseOneDecl (&Spec);
|
ParseOneDecl (&Spec);
|
||||||
|
|
||||||
/* Check if there is more */
|
/* Check if there is more */
|
||||||
if (CurTok.Tok == TOK_COMMA) {
|
if (CurTok.Tok == TOK_COMMA) {
|
||||||
/* More to come */
|
/* More to come */
|
||||||
NextToken ();
|
NextToken ();
|
||||||
} else {
|
} else {
|
||||||
/* Done */
|
/* Done */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user