Move type checks before bit-field width parsing
This commit is contained in:
parent
aaa0cf5448
commit
fb9b50ff9c
1 changed files with 4 additions and 4 deletions
|
@ -688,16 +688,16 @@ static int ParseFieldWidth (Declaration* Decl)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the width */
|
|
||||||
NextToken ();
|
|
||||||
ConstAbsIntExpr (hie1, &Expr);
|
|
||||||
|
|
||||||
if (SizeOf (Decl->Type) != SizeOf (type_uint)) {
|
if (SizeOf (Decl->Type) != SizeOf (type_uint)) {
|
||||||
/* Only int sized types may be used for bit-fields for now */
|
/* Only int sized types may be used for bit-fields for now */
|
||||||
Error ("cc65 currently only supports unsigned int bit-fields");
|
Error ("cc65 currently only supports unsigned int bit-fields");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read the width */
|
||||||
|
NextToken ();
|
||||||
|
ConstAbsIntExpr (hie1, &Expr);
|
||||||
|
|
||||||
if (Expr.IVal < 0) {
|
if (Expr.IVal < 0) {
|
||||||
Error ("Negative width in bit-field");
|
Error ("Negative width in bit-field");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue