aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorbellard <bellard>2002-11-23 22:35:28 +0000
committerbellard <bellard>2002-11-23 22:35:28 +0000
commit0adc5a8921578d6d9c63841b1e3d401f6fce2140 (patch)
tree92e8561fde36ead67c1300029e17079622f83676 /tcc.c
parenta9f08655aceedfee66bf7c1b840f386c54f2dd82 (diff)
downloadtinycc-0adc5a8921578d6d9c63841b1e3d401f6fce2140.tar.gz
tinycc-0adc5a8921578d6d9c63841b1e3d401f6fce2140.tar.bz2
fixed line numbering
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tcc.c b/tcc.c
index 240dc5c..6b85c1d 100644
--- a/tcc.c
+++ b/tcc.c
@@ -2314,7 +2314,7 @@ static inline void add_cached_include(TCCState *s1, int type,
static void preprocess(int is_bof)
{
TCCState *s1 = tcc_state;
- int size, i, c, n, line_num;
+ int size, i, c, n;
char buf[1024], *q, *p;
char buf1[1024];
BufferedFile *f;
@@ -2529,7 +2529,7 @@ static void preprocess(int is_bof)
next();
if (tok != TOK_CINT)
error("#line");
- line_num = tokc.i;
+ file->line_num = tokc.i - 1; /* the line number will be incremented after */
next();
if (tok != TOK_LINEFEED) {
if (tok != TOK_STR)
@@ -2537,8 +2537,6 @@ static void preprocess(int is_bof)
pstrcpy(file->filename, sizeof(file->filename),
(char *)tokc.cstr->data);
}
- /* NOTE: we do it there to avoid problems with linefeed */
- file->line_num = line_num;
break;
case TOK_ERROR:
case TOK_WARNING:
@@ -3044,7 +3042,6 @@ static inline void next_nomacro1(void)
tcc_close(file);
s1->include_stack_ptr--;
file = *s1->include_stack_ptr;
- inp();
p = file->buf_ptr;
goto redo_no_start;
}