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