1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Move type checks before bit-field width parsing

This commit is contained in:
Jesse Rosenstock 2020-07-29 22:45:59 +02:00 committed by Oliver Schmidt
parent aaa0cf5448
commit fb9b50ff9c

View File

@ -688,16 +688,16 @@ static int ParseFieldWidth (Declaration* Decl)
return -1;
}
/* Read the width */
NextToken ();
ConstAbsIntExpr (hie1, &Expr);
if (SizeOf (Decl->Type) != SizeOf (type_uint)) {
/* Only int sized types may be used for bit-fields for now */
Error ("cc65 currently only supports unsigned int bit-fields");
return -1;
}
/* Read the width */
NextToken ();
ConstAbsIntExpr (hie1, &Expr);
if (Expr.IVal < 0) {
Error ("Negative width in bit-field");
return -1;