Commit a6e8021e by Per Bothner

Fix line number counting.

From-SVN: r7036
parent 058acefd
...@@ -220,7 +220,7 @@ get_token (fp, s) ...@@ -220,7 +220,7 @@ get_token (fp, s)
c = get_token (fp, s); c = get_token (fp, s);
if (c == INT_TOKEN) if (c == INT_TOKEN)
{ {
source_lineno = atoi (s->base); source_lineno = atoi (s->base) - 1; /* '\n' will add 1 */
get_token (fp, &source_filename); get_token (fp, &source_filename);
} }
for (;;) for (;;)
...@@ -229,7 +229,11 @@ get_token (fp, s) ...@@ -229,7 +229,11 @@ get_token (fp, s)
if (c == EOF) if (c == EOF)
return EOF; return EOF;
if (c == '\n') if (c == '\n')
{
source_lineno++;
lineno++;
goto retry; goto retry;
}
} }
} }
if (c == EOF) if (c == EOF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment