OSDN Git Service

Set TARGET_ASM_FILE_END to file_end_indicate_exec_stack.
[pf3gnuchains/gcc-fork.git] / gcc / fortran / error.c
index 260733c..084f0ef 100644 (file)
@@ -52,8 +52,7 @@ static gfc_error_buf error_buffer, warning_buffer;
 void
 gfc_error_init_1 (void)
 {
-
-  terminal_width = gfc_terminal_width();
+  terminal_width = gfc_terminal_width ();
   errors = 0;
   warnings = 0;
   buffer_flag = 0;
@@ -65,7 +64,6 @@ gfc_error_init_1 (void)
 void
 gfc_buffer_error (int flag)
 {
-
   buffer_flag = flag;
 }
 
@@ -76,7 +74,6 @@ gfc_buffer_error (int flag)
 static void
 error_char (char c)
 {
-
   if (buffer_flag)
     {
       if (use_warning_buffer)
@@ -105,21 +102,21 @@ error_char (char c)
 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;
@@ -127,20 +124,31 @@ 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,
+#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;
@@ -190,12 +198,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 +211,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;
@@ -332,7 +340,7 @@ error_print (const char *type, const char *format0, va_list argp)
 
            case 'C':
              if (c == 'C')
-               loc = gfc_current_locus ();
+               loc = &gfc_current_locus;
 
              if (have_l1)
                {
@@ -549,7 +557,6 @@ gfc_warning_now (const char *format, ...)
 void
 gfc_clear_warning (void)
 {
-
   warning_buffer.flag = 0;
 }
 
@@ -560,7 +567,6 @@ gfc_clear_warning (void)
 void
 gfc_warning_check (void)
 {
-
   if (warning_buffer.flag)
     {
       warnings++;
@@ -646,7 +652,7 @@ gfc_internal_error (const char *format, ...)
 
   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);
@@ -661,7 +667,6 @@ gfc_internal_error (const char *format, ...)
 void
 gfc_clear_error (void)
 {
-
   error_buffer.flag = 0;
 }
 
@@ -692,7 +697,6 @@ gfc_error_check (void)
 void
 gfc_push_error (gfc_error_buf * err)
 {
-
   err->flag = error_buffer.flag;
   if (error_buffer.flag)
     strcpy (err->message, error_buffer.message);
@@ -706,7 +710,6 @@ gfc_push_error (gfc_error_buf * err)
 void
 gfc_pop_error (gfc_error_buf * err)
 {
-
   error_buffer.flag = err->flag;
   if (error_buffer.flag)
     strcpy (error_buffer.message, err->message);
@@ -738,12 +741,11 @@ gfc_status_char (char c)
 }
 
 
-/* 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)