void
gfc_error_init_1 (void)
{
-
- terminal_width = gfc_terminal_width();
+ terminal_width = gfc_terminal_width ();
errors = 0;
warnings = 0;
buffer_flag = 0;
void
gfc_buffer_error (int flag)
{
-
buffer_flag = flag;
}
static void
error_char (char c)
{
-
if (buffer_flag)
{
if (use_warning_buffer)
static void
error_string (const char *p)
{
-
while (*p)
error_char (*p++);
}
-/* Show the file, where it was included and the source line give a
+/* Show the file, where it was included and the source line, give a
locus. Calls error_printf() recursively, but the recursion is at
most one level deep. */
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;
/* 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,
+#ifdef USE_MAPPED_LOCATION
+ LOCATION_LINE (lb->location)
+#else
+ lb->linenum
+#endif
+ );
+
+ 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;
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;
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;
case 'C':
if (c == 'C')
- loc = gfc_current_locus ();
+ loc = &gfc_current_locus;
if (have_l1)
{
void
gfc_clear_warning (void)
{
-
warning_buffer.flag = 0;
}
void
gfc_warning_check (void)
{
-
if (warning_buffer.flag)
{
warnings++;
va_start (argp, format);
- show_loci (gfc_current_locus (), NULL);
+ show_loci (&gfc_current_locus, NULL);
error_printf ("Internal Error at (1):");
error_print ("", format, argp);
void
gfc_clear_error (void)
{
-
error_buffer.flag = 0;
}
void
gfc_push_error (gfc_error_buf * err)
{
-
err->flag = error_buffer.flag;
if (error_buffer.flag)
strcpy (err->message, error_buffer.message);
void
gfc_pop_error (gfc_error_buf * err)
{
-
error_buffer.flag = err->flag;
if (error_buffer.flag)
strcpy (error_buffer.message, err->message);
}
-/* Report the number of warnings and errors that occored to the caller. */
+/* Report the number of warnings and errors that occurred to the caller. */
void
gfc_get_errors (int *w, int *e)
{
-
if (w != NULL)
*w = warnings;
if (e != NULL)