Fixed a bug that occurred when using // comments at the end of an #if

line.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1735 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-12-11 15:28:09 +00:00
parent 2f8c281b89
commit 11306120ea

View File

@@ -428,7 +428,7 @@ static int MacroCall (Macro* M)
ArgStart = B; ArgStart = B;
NextChar (); NextChar ();
} else { } else {
/* Comma or right paren inside nested parenthesis */ /* Comma or right paren inside nested parenthesis */
if (CurC == ')') { if (CurC == ')') {
--ParCount; --ParCount;
} }
@@ -772,16 +772,14 @@ static int DoIf (int Skip)
UseLineInfo (sv2.LI); UseLineInfo (sv2.LI);
} }
/* Remove the #if from the line and add two semicolons as sentinels */ /* Remove the #if from the line */
SkipBlank (); SkipBlank ();
S = line; S = line;
while (CurC != '\0') { while (CurC != '\0') {
*S++ = CurC; *S++ = CurC;
NextChar (); NextChar ();
} }
*S++ = ';'; *S = '\0';
*S++ = ';';
*S = '\0';
/* Start over parsing from line */ /* Start over parsing from line */
InitLine (line); InitLine (line);
@@ -792,6 +790,12 @@ static int DoIf (int Skip)
/* Expand macros in this line */ /* Expand macros in this line */
PreprocessLine (); PreprocessLine ();
/* Add two semicolons as sentinels to the line, so the following
* expression evaluation will eat these two tokens but nothing from
* the following line.
*/
strcat (line, ";;");
/* Prime the token pump (remove old tokens from the stream) */ /* Prime the token pump (remove old tokens from the stream) */
NextToken (); NextToken ();
NextToken (); NextToken ();