1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

fix tab, braces for 1-line if, Expr->Ival is signed

This commit is contained in:
bbbradsmith 2023-05-03 16:46:59 -04:00
parent 409235aee6
commit 9a502c69dc
3 changed files with 8 additions and 5 deletions

View File

@ -103,7 +103,7 @@ static WarnMapEntry WarnMap[] = {
{ &WarnUnusedLabel, "unused-label" },
{ &WarnUnusedParam, "unused-param" },
{ &WarnUnusedVar, "unused-var" },
{ &WarnConstOverflow, "const-overflow" },
{ &WarnConstOverflow, "const-overflow" },
};
Collection DiagnosticStrBufs;

View File

@ -584,17 +584,20 @@ static void NumericConst (void)
SB_Clear (&Src);
break;
}
if ((((unsigned long)(IVal * Base)) / Base) != IVal)
if ((((unsigned long)(IVal * Base)) / Base) != IVal) {
Overflow = 1;
}
IVal = IVal * Base;
if (((unsigned long)(IVal + DigitVal)) < IVal)
if (((unsigned long)(IVal + DigitVal)) < IVal) {
Overflow = 1;
}
IVal += DigitVal;
SB_Skip (&Src);
}
if (Overflow)
if (Overflow) {
Error ("Numerical constant \"%s\" too large for internal 32-bit representation",
SB_GetConstBuf (&Src));
}
/* Distinguish between integer and floating point constants */
if (!IsFloat) {

View File

@ -128,7 +128,7 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType)
** internally already represented by a long.
*/
if (NewBits <= OldBits) {
unsigned long OldVal = Expr->IVal;
long OldVal = Expr->IVal;
/* Cut the value to the new size */
Expr->IVal &= (0xFFFFFFFFUL >> (32 - NewBits));