mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed warnings for hex literals
This commit is contained in:
parent
12ed915194
commit
6975d1ce40
2 changed files with 9 additions and 14 deletions
|
@ -3062,7 +3062,7 @@ void BfExprEvaluator::Visit(BfLiteralExpression* literalExpr)
|
|||
mModule->Warn(BfWarning_BF4201_Only7Hex, "Only 7 hex digits specified. Add a leading zero to clarify intention.", literalExpr);
|
||||
break;
|
||||
case BfWarning_BF4202_TooManyHexForInt:
|
||||
mModule->Warn(BfWarning_BF4202_TooManyHexForInt, "Too many hex digits for an int, but too few for a long. Use 'L' suffix if a long was intended.", literalExpr);
|
||||
mModule->Warn(BfWarning_BF4202_TooManyHexForInt, "Nine hex digits specified. If an 8-digit hex literal was not intended then add a leading zero to clarify.", literalExpr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2440,6 +2440,12 @@ void BfParser::NextToken(int endIdx)
|
|||
mLiteral.mInt64 = val;
|
||||
mLiteral.mTypeCode = BfTypeCode_IntUnknown;
|
||||
|
||||
|
||||
if ((numberBase == 0x10) && (hexDigits == 7))
|
||||
mLiteral.mWarnType = BfWarning_BF4201_Only7Hex;
|
||||
if ((numberBase == 0x10) && (hexDigits == 9))
|
||||
mLiteral.mWarnType = BfWarning_BF4202_TooManyHexForInt;
|
||||
|
||||
if (hadOverflow)
|
||||
{
|
||||
mPassInstance->FailAt("Value doesn't fit into int64", mSourceData, mTokenStart, mSrcIdx - mTokenStart);
|
||||
|
@ -2449,17 +2455,6 @@ void BfParser::NextToken(int endIdx)
|
|||
{
|
||||
mLiteral.mTypeCode = BfTypeCode_Int64;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((numberBase == 0x10) && (hexDigits == 7))
|
||||
mLiteral.mWarnType = BfWarning_BF4201_Only7Hex;
|
||||
//mPassInstance->WarnAt(0, "Only 7 hex digits specified. Add a leading zero to clarify intention.", this, mTokenStart, mSrcIdx - mTokenStart);
|
||||
if ((numberBase == 0x10) && (hexDigits > 8))
|
||||
mLiteral.mWarnType = BfWarning_BF4202_TooManyHexForInt;
|
||||
//mPassInstance->FailAt("Too many hex digits for an int, but too few for a long. Use 'L' suffix if a long was intended.", this, mTokenStart, mSrcIdx - mTokenStart);
|
||||
/*if (val > 0x7FFFFFFF)
|
||||
mLiteral.mTypeCode = BfTypeCode_UIntUnknown;*/
|
||||
}
|
||||
}
|
||||
|
||||
mSyntaxToken = BfSyntaxToken_Literal;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue