Fix line directive over consumption

This commit is contained in:
drmortalwombat 2023-10-15 12:26:32 +02:00
parent 3da58bf1ca
commit 6e6e3b2adb

View File

@ -600,6 +600,7 @@ void Scanner::NextPreToken(void)
} }
else if (mToken == TK_PREP_LINE) else if (mToken == TK_PREP_LINE)
{ {
mPreprocessorMode = true;
NextPreToken(); NextPreToken();
int l = mLocation.mLine; int l = mLocation.mLine;
int64 v = PrepParseConditional(); int64 v = PrepParseConditional();
@ -608,7 +609,8 @@ void Scanner::NextPreToken(void)
strcpy_s(mPreprocessor->mSource->mLocationFileName, mTokenString); strcpy_s(mPreprocessor->mSource->mLocationFileName, mTokenString);
NextRawToken(); NextRawToken();
} }
mPreprocessor->mLocation.mLine = v + mLocation.mLine - l - 1; mPreprocessor->mLocation.mLine = int(v) + mLocation.mLine - l;
mPreprocessorMode = false;
} }
else if (mToken == TK_PREP_FOR) else if (mToken == TK_PREP_FOR)
{ {