mirror of
https://github.com/cc65/cc65.git
synced 2025-01-24 04:34:35 +00:00
More accurate diagnostic messages on empty declarations without any type specifiers.
This commit is contained in:
parent
b1c1502494
commit
befc9533c6
@ -2087,10 +2087,13 @@ static void DirectDecl (DeclSpec* Spec, Declarator* D, declmode_t Mode)
|
||||
NextToken ();
|
||||
} else {
|
||||
D->Ident[0] = '\0';
|
||||
if ((Spec->Flags & DS_NO_EMPTY_DECL) != 0 &&
|
||||
CurTok.Tok != TOK_LBRACK &&
|
||||
if (CurTok.Tok != TOK_LBRACK &&
|
||||
((Spec->Flags & DS_ALLOW_BITFIELD) == 0 || CurTok.Tok != TOK_COLON)) {
|
||||
Error ("Identifier expected");
|
||||
if ((Spec->Flags & DS_TYPE_MASK) == DS_DEF_TYPE) {
|
||||
Error ("Declaration specifier or identifier expected");
|
||||
} else if ((Spec->Flags & DS_NO_EMPTY_DECL) != 0) {
|
||||
Error ("Identifier expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1412,7 +1412,7 @@ static void Primary (ExprDesc* E)
|
||||
} else {
|
||||
/* Let's see if this is a C99-style declaration */
|
||||
DeclSpec Spec;
|
||||
ParseDeclSpec (&Spec, TS_DEFAULT_TYPE_NONE, SC_AUTO);
|
||||
ParseDeclSpec (&Spec, TS_DEFAULT_TYPE_INT, SC_AUTO);
|
||||
|
||||
if ((Spec.Flags & DS_TYPE_MASK) != DS_NONE) {
|
||||
Error ("Mixed declarations and code are not supported in cc65");
|
||||
|
@ -1,3 +1,3 @@
|
||||
bug1889-missing-identifier.c:3: Error: Identifier or ';' expected after declaration specifiers
|
||||
bug1889-missing-identifier.c:3: Warning: Implicit 'int' is an obsolete feature
|
||||
bug1889-missing-identifier.c:4: Error: Identifier expected
|
||||
bug1889-missing-identifier.c:4: Error: Declaration specifier or identifier expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user