diff options
Diffstat (limited to 'gcc/fortran/error.c')
| -rw-r--r-- | gcc/fortran/error.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 260733c8af4..b7b0fdb1bf6 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -118,8 +118,9 @@ error_string (const char *p) static void error_printf (const char *, ...) ATTRIBUTE_PRINTF_1; static void -show_locus (int offset, locus * l) +show_locus (int offset, locus * loc) { + gfc_linebuf *lb; gfc_file *f; char c, *p; int i, m; @@ -127,20 +128,25 @@ show_locus (int offset, locus * l) /* TODO: Either limit the total length and number of included files displayed or add buffering of arbitrary number of characters in error messages. */ - f = l->file; - error_printf ("In file %s:%d\n", f->filename, l->lp->start_line + l->line); - f = f->included_by; - while (f != NULL) + lb = loc->lb; + f = lb->file; + error_printf ("In file %s:%d\n", f->filename, lb->linenum); + + for (;;) { - error_printf (" Included at %s:%d\n", f->filename, - f->loc.lp->start_line + f->loc.line); + i = f->inclusion_line; + f = f->included_by; + if (f == NULL) break; + + error_printf (" Included at %s:%d\n", f->filename, i); } /* Show the line itself, taking care not to print more than what can show up on the terminal. Tabs are converted to spaces. */ - p = l->lp->line[l->line] + offset; + + p = lb->line + offset; i = strlen (p); if (i > terminal_width) i = terminal_width - 1; @@ -190,12 +196,12 @@ show_loci (locus * l1, locus * l2) return; } - c1 = l1->nextc - l1->lp->line[l1->line]; + c1 = l1->nextc - l1->lb->line; c2 = 0; if (l2 == NULL) goto separate; - c2 = l2->nextc - l2->lp->line[l2->line]; + c2 = l2->nextc - l2->lb->line; if (c1 < c2) m = c2 - c1; @@ -203,7 +209,7 @@ show_loci (locus * l1, locus * l2) m = c1 - c2; - if (l1->lp != l2->lp || l1->line != l2->line || m > terminal_width - 10) + if (l1->lb != l2->lb || m > terminal_width - 10) goto separate; offset = 0; |

