Unified · Split
| @@ -576,12 +576,15 @@ static void error1(TCCState *s1, int is_warning, const char *fmt, va_list ap) · 575 unmodified lines | ||
| 576 | 576 | for (f = file; f && f->filename[0] == ':'; f = f->prev) |
| 577 | 577 | ; |
| 578 | 578 | if (f) { |
| 579 | + int line_num = f->line_num; | |
| 579 | 580 | for(pf = s1->include_stack; pf < s1->include_stack_ptr; pf++) |
| 580 | 581 | strcat_printf(buf, sizeof(buf), "In file included from %s:%d:\n", |
| 581 | 582 | (*pf)->filename, (*pf)->line_num); |
| 582 | − if (f->line_num > 0) { | |
| 583 | + if (line_num > 0) { | |
| 584 | + if(tok == TOK_LINEFEED) | |
| 585 | + line_num--; | |
| 583 | 586 | strcat_printf(buf, sizeof(buf), "%s:%d: ", |
| 584 | − f->filename, f->line_num); | |
| 587 | + f->filename, line_num); | |
| 585 | 588 | } else { |
| 586 | 589 | strcat_printf(buf, sizeof(buf), "%s: ", |
| 587 | 590 | f->filename); |