mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-01 04:20:09 +08:00
fixed line numbering
This commit is contained in:
parent
a9f08655ac
commit
0adc5a8921
7
tcc.c
7
tcc.c
@ -2314,7 +2314,7 @@ static inline void add_cached_include(TCCState *s1, int type,
|
|||||||
static void preprocess(int is_bof)
|
static void preprocess(int is_bof)
|
||||||
{
|
{
|
||||||
TCCState *s1 = tcc_state;
|
TCCState *s1 = tcc_state;
|
||||||
int size, i, c, n, line_num;
|
int size, i, c, n;
|
||||||
char buf[1024], *q, *p;
|
char buf[1024], *q, *p;
|
||||||
char buf1[1024];
|
char buf1[1024];
|
||||||
BufferedFile *f;
|
BufferedFile *f;
|
||||||
@ -2529,7 +2529,7 @@ static void preprocess(int is_bof)
|
|||||||
next();
|
next();
|
||||||
if (tok != TOK_CINT)
|
if (tok != TOK_CINT)
|
||||||
error("#line");
|
error("#line");
|
||||||
line_num = tokc.i;
|
file->line_num = tokc.i - 1; /* the line number will be incremented after */
|
||||||
next();
|
next();
|
||||||
if (tok != TOK_LINEFEED) {
|
if (tok != TOK_LINEFEED) {
|
||||||
if (tok != TOK_STR)
|
if (tok != TOK_STR)
|
||||||
@ -2537,8 +2537,6 @@ static void preprocess(int is_bof)
|
|||||||
pstrcpy(file->filename, sizeof(file->filename),
|
pstrcpy(file->filename, sizeof(file->filename),
|
||||||
(char *)tokc.cstr->data);
|
(char *)tokc.cstr->data);
|
||||||
}
|
}
|
||||||
/* NOTE: we do it there to avoid problems with linefeed */
|
|
||||||
file->line_num = line_num;
|
|
||||||
break;
|
break;
|
||||||
case TOK_ERROR:
|
case TOK_ERROR:
|
||||||
case TOK_WARNING:
|
case TOK_WARNING:
|
||||||
@ -3044,7 +3042,6 @@ static inline void next_nomacro1(void)
|
|||||||
tcc_close(file);
|
tcc_close(file);
|
||||||
s1->include_stack_ptr--;
|
s1->include_stack_ptr--;
|
||||||
file = *s1->include_stack_ptr;
|
file = *s1->include_stack_ptr;
|
||||||
inp();
|
|
||||||
p = file->buf_ptr;
|
p = file->buf_ptr;
|
||||||
goto redo_no_start;
|
goto redo_no_start;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user