The number of rows to display warning is wrong
For example: #define TOK_ASM_weak TOK_WEAK1 #define TOK_ASM_weak TOK_WEAK Output: C8.c:3: warning: TOK_ASM_weak redefined
This commit is contained in:
parent
9c78da8a32
commit
bcf60562e0
1 changed files with 5 additions and 2 deletions
7
libtcc.c
7
libtcc.c
|
@ -576,12 +576,15 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap)
|
|||
for (f = file; f && f->filename[0] == ':'; f = f->prev)
|
||||
;
|
||||
if (f) {
|
||||
int line_num = f->line_num;
|
||||
for(pf = s1->include_stack; pf < s1->include_stack_ptr; pf++)
|
||||
strcat_printf(buf, sizeof(buf), "In file included from %s:%d:\n",
|
||||
(*pf)->filename, (*pf)->line_num);
|
||||
if (f->line_num > 0) {
|
||||
if (line_num > 0) {
|
||||
if(tok == TOK_LINEFEED)
|
||||
line_num--;
|
||||
strcat_printf(buf, sizeof(buf), "%s:%d: ",
|
||||
f->filename, f->line_num);
|
||||
f->filename, line_num);
|
||||
} else {
|
||||
strcat_printf(buf, sizeof(buf), "%s: ",
|
||||
f->filename);
|
||||
|
|
Loading…
Reference in a new issue