Implement parse of octal numbers

This commit is contained in:
drmortalwombat 2024-09-16 13:31:03 +02:00
parent 4423837888
commit e89aa11e86
4 changed files with 20 additions and 2 deletions

View File

@ -123,6 +123,7 @@ static const uint64 DTF_FUNC_THIS = (1ULL << 47);
static const uint64 DTF_VAR_ALIASING = (1ULL << 48);
static const uint64 DTF_FPARAM_UNUSED = (1ULL << 49);
static const uint64 DTF_DEPRECATED = (1ULL << 50);
class Declaration;

View File

@ -600,6 +600,13 @@ void GlobalAnalyzer::AnalyzeProcedure(Expression* cexp, Expression* exp, Declara
{
dec->mFlags |= DTF_FUNC_ANALYZING;
if (dec->mFlags & DTF_DEPRECATED)
{
mErrors->Error(dec->mLocation, EWARN_DEFAULT_COPY_DEPRECATED, "Using deprecated function", dec->mQualIdent->mString);
if (cexp)
mErrors->Error(cexp->mLocation, EINFO_CALLED_FROM, "Called from here");
}
mFunctions.Push(dec);
Declaration* pdec = dec->mBase->mParams;

View File

@ -2605,7 +2605,7 @@ void Parser::AddDefaultConstructors(Declaration* pthis)
cdec->mVarIndex = -1;
if (explicitDestructor)
mErrors->Error(pthis->mBase->mLocation, EWARN_DEFAULT_COPY_DEPRECATED, "Default copy constructor deprecated due to explicit destructor");
cdec->mFlags |= DTF_DEPRECATED;
cdec->mValue = new Expression(mScanner->mLocation, EX_VOID);
@ -2777,7 +2777,7 @@ void Parser::AddDefaultConstructors(Declaration* pthis)
cdec->mVarIndex = -1;
if (explicitDestructor)
mErrors->Error(pthis->mBase->mLocation, EWARN_DEFAULT_COPY_DEPRECATED, "Default copy constructor deprecated due to explicit destructor");
cdec->mFlags |= DTF_DEPRECATED;
Expression* pthisexp = new Expression(pthis->mLocation, EX_VARIABLE);
pthisexp->mDecType = pthis;

View File

@ -2362,14 +2362,21 @@ void Scanner::ParseNumberToken(void)
}
else
{
int64 moctal = 0;
bool zerostart = mant == 0;
int n = 0;
if (mTokenChar >= '0' && mTokenChar <= '9')
{
mant = mant * 10 + (int)mTokenChar - (int)'0';
moctal = moctal * 8 + (int)mTokenChar - (int)'0';
while (NextChar())
{
if (mTokenChar >= '0' && mTokenChar <= '9')
{
mant = mant * 10 + (int)mTokenChar - (int)'0';
moctal = moctal * 8 + (int)mTokenChar - (int)'0';
}
else
break;
n++;
@ -2378,6 +2385,9 @@ void Scanner::ParseNumberToken(void)
if (mTokenChar != '.')
{
if (zerostart)
mant = moctal;
if (mTokenChar == 'U' || mTokenChar == 'u')
{
NextChar();