From 0adc5a8921578d6d9c63841b1e3d401f6fce2140 Mon Sep 17 00:00:00 2001 From: bellard Date: Sat, 23 Nov 2002 22:35:28 +0000 Subject: [PATCH] fixed line numbering --- tcc.c | 7 ++----- 1 file 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; }