diagnostic.c (output_format): Add support for %m.
authorZack Weinberg <zack@codesourcery.com>
Tue, 13 May 2003 18:06:52 +0000 (18:06 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 13 May 2003 18:06:52 +0000 (18:06 +0000)
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.

* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.

From-SVN: r66769

20 files changed:
gcc/ChangeLog
gcc/c-opts.c
gcc/c-pch.c
gcc/config/mips/mips.c
gcc/config/rs6000/host-darwin.c
gcc/diagnostic.c
gcc/diagnostic.h
gcc/dwarfout.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/ggc-common.c
gcc/ggc-page.c
gcc/graph.c
gcc/java/ChangeLog
gcc/java/jcf-parse.c
gcc/java/jcf-write.c
gcc/java/lex.c
gcc/objc/objc-act.c
gcc/toplev.c
gcc/toplev.h

index f3059a2298a040a94e2547b28b369acd28d5318b..c57fab37ae57b5e96d9d1698b375c93c4b31ba80 100644 (file)
@@ -1,3 +1,19 @@
+2003-05-13  Zack Weinberg  <zack@codesourcery.com>
+
+       * diagnostic.c (output_format): Add support for %m.
+       (output_printf, output_verbatim, diagnostic_set_info,
+       verbatim): Set err_no field of the text_info structure being
+       initialized.
+       (fatal_io_error): Delete function.
+       * diagnostic.h (text_info): Add err_no field.
+       * toplev.h (fatal_io_error): Delete prototype.
+
+       * c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
+       * toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
+       * objc/objc-act.c: Replace all calls to fatal_io_error with
+       calls to fatal_error; add ": %m" to the end of all the affected
+       error messages.
+
 2003-05-13  Zack Weinberg  <zack@codesourcery.com>
 
        * varasm.c (notice_rtl_inlining_of_deferred_constant): New function.
index 23ed899ae18d0db83bc1d8ffa940d2adbaa4ed5c..ea2cef42899cf6eb32425475216eb25ec2856184 100644 (file)
@@ -1556,7 +1556,7 @@ c_common_post_options (pfilename)
 
       if (out_stream == NULL)
        {
-         fatal_io_error ("opening output file %s", out_fname);
+         fatal_error ("opening output file %s: %m", out_fname);
          return false;
        }
 
@@ -1650,7 +1650,7 @@ c_common_finish ()
        {
          deps_stream = fopen (deps_file, deps_append ? "a": "w");
          if (!deps_stream)
-           fatal_io_error ("opening dependency file %s", deps_file);
+           fatal_error ("opening dependency file %s: %m", deps_file);
        }
     }
 
@@ -1660,10 +1660,10 @@ c_common_finish ()
 
   if (deps_stream && deps_stream != out_stream
       && (ferror (deps_stream) || fclose (deps_stream)))
-    fatal_io_error ("closing dependency file %s", deps_file);
+    fatal_error ("closing dependency file %s: %m", deps_file);
 
   if (out_stream && (ferror (out_stream) || fclose (out_stream)))
-    fatal_io_error ("when writing output to %s", out_fname);
+    fatal_error ("when writing output to %s: %m", out_fname);
 }
 
 /* Either of two environment variables can specify output of
index a7fa879fb88b374da3e7959844adfcfa68ed79d7..354fcc7849b9c23247c1f738eca5b7e6dee68f10 100644 (file)
@@ -86,13 +86,13 @@ pch_init ()
   
   f = fopen (pch_file, "w+b");
   if (f == NULL)
-    fatal_io_error ("can't open %s", pch_file);
+    fatal_error ("can't open %s: %m", pch_file);
   pch_outfile = f;
   
   v.debug_info_type = write_symbols;
   if (fwrite (get_ident(), IDENT_LENGTH, 1, f) != 1
       || fwrite (&v, sizeof (v), 1, f) != 1)
-    fatal_io_error ("can't write to %s", pch_file);
+    fatal_error ("can't write to %s: %m", pch_file);
 
   /* We need to be able to re-read the output.  */
   /* The driver always provides a valid -o option.  */
@@ -127,13 +127,13 @@ c_common_write_pch ()
   h.asm_size = asm_file_end - asm_file_startpos;
   
   if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
-    fatal_io_error ("can't write %s", pch_file);
+    fatal_error ("can't write %s: %m", pch_file);
   
   buf = xmalloc (16384);
   fflush (asm_out_file);
 
   if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
-    fatal_io_error ("can't seek in %s", asm_file_name);
+    fatal_error ("can't seek in %s: %m", asm_file_name);
 
   for (written = asm_file_startpos; written < asm_file_end; )
     {
@@ -141,9 +141,9 @@ c_common_write_pch ()
       if (size > 16384)
        size = 16384;
       if (fread (buf, size, 1, asm_out_file) != 1)
-       fatal_io_error ("can't read %s", asm_file_name);
+       fatal_error ("can't read %s: %m", asm_file_name);
       if (fwrite (buf, size, 1, pch_outfile) != 1)
-       fatal_io_error ("can't write %s", pch_file);
+       fatal_error ("can't write %s: %m", pch_file);
       written += size;
     }
   free (buf);
@@ -177,10 +177,7 @@ c_common_valid_pch (pfile, name, fd)
 
   sizeread = read (fd, ident, IDENT_LENGTH);
   if (sizeread == -1)
-    {
-      fatal_io_error ("can't read %s", name);
-      return 2;
-    }
+    fatal_error ("can't read %s: %m", name);
   else if (sizeread != IDENT_LENGTH)
     return 2;
   
@@ -206,10 +203,7 @@ c_common_valid_pch (pfile, name, fd)
     }
 
   if (read (fd, &v, sizeof (v)) != sizeof (v))
-    {
-      fatal_io_error ("can't read %s", name);
-      return 2;
-    }
+    fatal_error ("can't read %s: %m", name);
 
   /* The allowable debug info combinations are that either the PCH file
      was built with the same as is being used now, or the PCH file was
index dd1f6a964faeb1c4dc7f83d3e0873475db766008..ecd6b734384ed9258800cc5147bc7b67d76600ea 100644 (file)
@@ -6871,17 +6871,17 @@ copy_file_data (to, from)
   size_t len;
   rewind (from);
   if (ferror (from))
-    fatal_io_error ("can't rewind temp file");
+    fatal_error ("can't rewind temp file: %m");
 
   while ((len = fread (buffer, 1, sizeof (buffer), from)) > 0)
     if (fwrite (buffer, 1, len, to) != len)
-      fatal_io_error ("can't write to output file");
+      fatal_error ("can't write to output file: %m");
 
   if (ferror (from))
-    fatal_io_error ("can't read from temp file");
+    fatal_error ("can't read from temp file: %m");
 
   if (fclose (from))
-    fatal_io_error ("can't close temp file");
+    fatal_error ("can't close temp file: %m");
 }
 
 /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
index 8b4eed22afbfd5e5068bd460a35e77fa41c67dfa..294a6544910ea825e49de957529271cb48d18424 100644 (file)
@@ -128,13 +128,13 @@ darwin_rs6000_extra_signals ()
   sigstk.ss_size = SIGSTKSZ;
   sigstk.ss_flags = 0;
   if (sigaltstack (&sigstk, NULL) < 0)
-    fatal_io_error ("While setting up signal stack");
+    fatal_error ("While setting up signal stack: %m");
 
   sigemptyset(&sact.sa_mask);
   sact.sa_flags = SA_ONSTACK | SA_SIGINFO;
   sact.sa_sigaction = segv_handler;
   if (sigaction (SIGSEGV, &sact, 0) < 0) 
-    fatal_io_error ("While setting up signal handler");
+    fatal_error ("While setting up signal handler: %m");
 }
 
 const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;
index 92e749f0b94ea52094d0617635f7238029c003bc..53399fcf4a8db67eb48ccb6d836d5a0bdfcc75a7 100644 (file)
@@ -502,6 +502,7 @@ output_buffer_to_stream (buffer)
    %c: character.
    %s: string.
    %p: pointer.
+   %m: strerror(text->err_no) - does not consume a value from args_ptr.
    %%: `%'.
    %*.s: a substring the length of which is specified by an integer.
    %H: location_t.  */
@@ -534,7 +535,7 @@ output_format (buffer, text)
          ++text->format_spec;
        }
 
-      /* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %o, %s, %u,
+      /* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %m, %o, %s, %u,
          %x, %p, %.*s; %%.  And nothing else.  Front-ends should install
          printers to grok language specific format specifiers.  */
       switch (*text->format_spec)
@@ -585,6 +586,10 @@ output_format (buffer, text)
               (buffer, va_arg (*text->args_ptr, unsigned int));
          break;
 
+       case 'm':
+         output_add_string (buffer, xstrerror (text->err_no));
+         break;
+
        case '%':
          output_add_character (buffer, '%');
          break;
@@ -662,6 +667,7 @@ output_printf VPARAMS ((struct output_buffer *buffer, const char *msgid, ...))
   VA_FIXEDARG (ap, output_buffer *, buffer);
   VA_FIXEDARG (ap, const char *, msgid);
 
+  text.err_no = errno;
   text.args_ptr = &ap;
   text.format_spec = _(msgid);
   output_format (buffer, &text);
@@ -757,8 +763,9 @@ output_verbatim VPARAMS ((output_buffer *buffer, const char *msgid, ...))
   VA_FIXEDARG (ap, output_buffer *, buffer);
   VA_FIXEDARG (ap, const char *, msgid);
 
-  text.format_spec = msgid;
+  text.err_no = errno;
   text.args_ptr = &ap;
+  text.format_spec = _(msgid);
   output_do_verbatim (buffer, &text);
   VA_CLOSE (ap);
 }
@@ -816,8 +823,9 @@ diagnostic_set_info (diagnostic, msgid, args, file, line, kind)
      int line;
      diagnostic_t kind;
 {
-  diagnostic->message.format_spec = _(msgid);
+  diagnostic->message.err_no = errno;
   diagnostic->message.args_ptr = args;
+  diagnostic->message.format_spec = _(msgid);
   /* If the diagnostic message doesn't specify a location,
      use FILE and LINE.  */
   if (!text_specifies_location (&diagnostic->message, &diagnostic->location))
@@ -1182,8 +1190,9 @@ verbatim VPARAMS ((const char *msgid, ...))
   VA_OPEN (ap, msgid);
   VA_FIXEDARG (ap, const char *, msgid);
 
-  text.format_spec = _(msgid);
+  text.err_no = errno;
   text.args_ptr = &ap;
+  text.format_spec = _(msgid);
   output_do_verbatim (&global_dc->buffer, &text);
   output_buffer_to_stream (&global_dc->buffer);
   VA_CLOSE (ap);
@@ -1430,24 +1439,6 @@ warn_deprecated_use (node)
     }
 }
 
-/* Print a fatal I/O error message.  Argument are like printf.
-   Also include a system error message based on `errno'.  */
-void
-fatal_io_error VPARAMS ((const char *msgid, ...))
-{
-  text_info text;
-  VA_OPEN (ap, msgid);
-  VA_FIXEDARG (ap, const char *, msgid);
-
-  text.format_spec = _(msgid);
-  text.args_ptr = &ap;
-  output_printf (&global_dc->buffer, "%s: %s: ", progname, xstrerror (errno));
-  output_format (&global_dc->buffer, &text);
-  output_flush (&global_dc->buffer);
-  VA_CLOSE (ap);
-  exit (FATAL_EXIT_CODE);
-}
-
 /* Inform the user that an error occurred while trying to report some
    other error.  This indicates catastrophic internal inconsistencies,
    so give up now.  But do try to flush out the previous error.
index 1d697f485bb8c890599be0c6b1c1b0f74bb8d856..24fe2fe6a2e165d7b9102fa7b9fe3664df63800f 100644 (file)
@@ -31,6 +31,7 @@ typedef struct
 {
   const char *format_spec;
   va_list *args_ptr;
+  int err_no;  /* for %m */
 } text_info;
 
 /* Contants used to discriminate diagnostics.  */
index b6d150f04a9a8fdafd9494c5d6a695b36a61c5c8..8555443803eee7b2e198983a34327d3edba1de1a 100644 (file)
@@ -6285,7 +6285,7 @@ dwarfout_init (main_input_filename)
            char *dirname;
 
            if (!pwd)
-             fatal_io_error ("can't get current directory");
+             fatal_error ("can't get current directory: %m");
 
            dirname = concat (pwd, "/", NULL);
            ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname);
index 94d1eb107802c33b514d105e07465b632c4f7eae..c016f31901ec581d8668ca855ce7d5441ba8755c 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-13  Zack Weinberg  <zack@codesourcery.com>
+
+       * com.c: Replace all calls to fatal_io_error with calls to
+       fatal_error; add ": %m" to the end of all the affected error
+       messages.
+
 2003-05-12  Zack Weinberg  <zack@codesourcery.com>
 
        * bad.c: Don't call diagnostic_count_diagnostic.
index bb093e3b20182d156d9c074c720ea217b5f014c4..951ef448d4bd84f4c4b9721413c3adf8d6733ac4 100644 (file)
@@ -14269,7 +14269,7 @@ ffe_post_options (pfilename)
     finput = fopen (filename, "r");
 
   if (finput == 0)
-    fatal_io_error ("can't open %s", filename);
+    fatal_error ("can't open %s: %m", filename);
 
   return false;
 }
index db8cbd03207bf9476a57ab521e0473bec9cb7909..adf2fd0decb410222bdeb545c86b7702ade5c120 100644 (file)
@@ -411,7 +411,7 @@ write_pch_globals (tab, state)
            {
              if (fwrite (&ptr, sizeof (void *), 1, state->f) 
                  != 1)
-               fatal_io_error ("can't write PCH file");
+               fatal_error ("can't write PCH file: %m");
            }
          else
            {
@@ -419,7 +419,7 @@ write_pch_globals (tab, state)
                                             POINTER_HASH (ptr));
              if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f) 
                  != 1)
-               fatal_io_error ("can't write PCH file");
+               fatal_error ("can't write PCH file: %m");
            }
        }
 }
@@ -496,7 +496,7 @@ gt_pch_save (f)
   for (rt = gt_pch_scalar_rtab; *rt; rt++)
     for (rti = *rt; rti->base != NULL; rti++)
       if (fwrite (rti->base, rti->stride, 1, f) != 1)
-       fatal_io_error ("can't write PCH file");
+       fatal_error ("can't write PCH file: %m");
 
   /* Write out all the global pointers, after translation.  */
   write_pch_globals (gt_ggc_rtab, &state);
@@ -509,17 +509,17 @@ gt_pch_save (f)
     long o;
     o = ftell (state.f) + sizeof (mmi);
     if (o == -1)
-      fatal_io_error ("can't get position in PCH file");
+      fatal_error ("can't get position in PCH file: %m");
     mmi.offset = page_size - o % page_size;
     if (mmi.offset == page_size)
       mmi.offset = 0;
     mmi.offset += o;
   }
   if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
-    fatal_io_error ("can't write PCH file");
+    fatal_error ("can't write PCH file: %m");
   if (mmi.offset != 0
       && fseek (state.f, mmi.offset, SEEK_SET) != 0)
-    fatal_io_error ("can't write padding to PCH file");
+    fatal_error ("can't write padding to PCH file: %m");
 
   /* Actually write out the objects.  */
   for (i = 0; i < state.count; i++)
@@ -572,7 +572,7 @@ gt_pch_restore (f)
   for (rt = gt_pch_scalar_rtab; *rt; rt++)
     for (rti = *rt; rti->base != NULL; rti++)
       if (fread (rti->base, rti->stride, 1, f) != 1)
-       fatal_io_error ("can't read PCH file");
+       fatal_error ("can't read PCH file: %m");
 
   /* Read in all the global pointers, in 6 easy loops.  */
   for (rt = gt_ggc_rtab; *rt; rt++)
@@ -580,17 +580,17 @@ gt_pch_restore (f)
       for (i = 0; i < rti->nelt; i++)
        if (fread ((char *)rti->base + rti->stride * i,
                   sizeof (void *), 1, f) != 1)
-         fatal_io_error ("can't read PCH file");
+         fatal_error ("can't read PCH file: %m");
 
   for (rt = gt_pch_cache_rtab; *rt; rt++)
     for (rti = *rt; rti->base != NULL; rti++)
       for (i = 0; i < rti->nelt; i++)
        if (fread ((char *)rti->base + rti->stride * i,
                   sizeof (void *), 1, f) != 1)
-         fatal_io_error ("can't read PCH file");
+         fatal_error ("can't read PCH file: %m");
 
   if (fread (&mmi, sizeof (mmi), 1, f) != 1)
-    fatal_io_error ("can't read PCH file");
+    fatal_error ("can't read PCH file: %m");
   
 #if HAVE_MMAP_FILE
   addr = mmap (mmi.preferred_base, mmi.size, 
@@ -604,10 +604,10 @@ gt_pch_restore (f)
       addr = xmalloc (mmi.size);
       if (fseek (f, mmi.offset, SEEK_SET) != 0
          || fread (&mmi, mmi.size, 1, f) != 1)
-       fatal_io_error ("can't read PCH file");
+       fatal_error ("can't read PCH file: %m");
     }
   else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
-    fatal_io_error ("can't read PCH file");
+    fatal_error ("can't read PCH file: %m");
 
   ggc_pch_read (f, addr);
 
index 569e5191e9cb691865c4391e961c5318a9de97c1..51ea7f0d437d799453157fc5457328790363e20f 100644 (file)
@@ -1954,20 +1954,20 @@ ggc_pch_write_object (d, f, x, newx, size)
     }
   
   if (fwrite (x, size, 1, f) != 1)
-    fatal_io_error ("can't write PCH file");
+    fatal_error ("can't write PCH file: %m");
 
   /* In the current implementation, SIZE is always equal to
      OBJECT_SIZE (order) and so the fseek is never executed.  */
   if (size != OBJECT_SIZE (order)
       && fseek (f, OBJECT_SIZE (order) - size, SEEK_CUR) != 0)
-    fatal_io_error ("can't write PCH file");
+    fatal_error ("can't write PCH file: %m");
 
   d->written[order]++;
   if (d->written[order] == d->d.totals[order]
       && fseek (f, ROUND_UP_VALUE (d->d.totals[order] * OBJECT_SIZE (order),
                                   G.pagesize),
                SEEK_CUR) != 0)
-    fatal_io_error ("can't write PCH file");
+    fatal_error ("can't write PCH file: %m");
 }
 
 void
@@ -1976,7 +1976,7 @@ ggc_pch_finish (d, f)
      FILE *f;
 {
   if (fwrite (&d->d, sizeof (d->d), 1, f) != 1)
-    fatal_io_error ("can't write PCH file");
+    fatal_error ("can't write PCH file: %m");
   free (d);
 }
 
@@ -2068,7 +2068,7 @@ ggc_pch_read (f, addr)
   /* Allocate the appropriate page-table entries for the pages read from
      the PCH file.  */
   if (fread (&d, sizeof (d), 1, f) != 1)
-    fatal_io_error ("can't read PCH file");
+    fatal_error ("can't read PCH file: %m");
   
   for (i = 0; i < NUM_ORDERS; i++)
     {
index e56ef93809fe2937b8b8bc7936650555d94665ef..5b660be00df2e667bf55d3ff9bce8cce5cfcdd7d 100644 (file)
@@ -419,7 +419,7 @@ clean_graph_dump_file (base, suffix)
   fp = fopen (buf, "w");
 
   if (fp == NULL)
-    fatal_io_error ("can't open %s", buf);
+    fatal_error ("can't open %s: %m", buf);
 
   switch (graph_dump_format)
     {
index b4e13f3579000196c6e968c3fe022c3682fea49e..679636f7bb1f83c63f2702bc0f00f4a21427e965 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-13  Zack Weinberg  <zack@codesourcery.com>
+
+       * jcf-parse.c, jcf-write.c, lex.c: Replace all calls to
+       fatal_io_error with calls to fatal_error; add ": %m" to the end of
+       all the affected error messages.
+
 2003-05-13  Richard Henderson  <rth@redhat.com>
 
        * class.c (layout_class_method): Set DECL_EXTERNAL.
index e3e60cb20c6a3fe6301c7af54bfab9cf58fb50fe..2b20537a1376350af387d1b05dd96f230fafa612 100644 (file)
@@ -513,12 +513,12 @@ read_class (tree name)
       if (!HAS_BEEN_ALREADY_PARSED_P (file))
        {
          if (!(finput = fopen (input_filename, "r")))
-           fatal_io_error ("can't reopen %s", input_filename);
+           fatal_error ("can't reopen %s: %m", input_filename);
          parse_source_file_1 (file, finput);
          parse_source_file_2 ();
          parse_source_file_3 ();
          if (fclose (finput))
-           fatal_io_error ("can't close %s", input_filename);
+           fatal_error ("can't close %s: %m", input_filename);
        }
       JCF_FINISH (current_jcf);
       java_pop_parser_context (generate);
@@ -888,7 +888,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
       int avail = 2000;
       finput = fopen (input_filename, "r");
       if (finput == NULL)
-       fatal_io_error ("can't open %s", input_filename);
+       fatal_error ("can't open %s: %m", input_filename);
       list = xmalloc(avail);
       next = list;
       for (;;)
@@ -907,7 +907,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
          if (count == 0)
            {
              if (! feof (finput))
-               fatal_io_error ("error closing %s", input_filename);
+               fatal_error ("error closing %s: %m", input_filename);
              *next = '\0';
              break;
            }
@@ -1030,11 +1030,11 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
       
       /* Close previous descriptor, if any */
       if (finput && fclose (finput))
-       fatal_io_error ("can't close input file %s", main_input_filename);
+       fatal_error ("can't close input file %s: %m", main_input_filename);
       
       finput = fopen (IDENTIFIER_POINTER (name), "rb");
       if (finput == NULL)
-       fatal_io_error ("can't open %s", IDENTIFIER_POINTER (name));
+       fatal_error ("can't open %s: %m", IDENTIFIER_POINTER (name));
 
 #ifdef IO_BUFFER_SIZE
       setvbuf (finput, xmalloc (IO_BUFFER_SIZE),
index 59ef514edb41af3311fdc2c1ba566c293ee25d5a..0d8f73ee13e2d637df20dc1c3d4035eabff3965a 100644 (file)
@@ -3341,7 +3341,7 @@ make_class_file_name (tree clas)
       if (stat (r, &sb) == -1
          /* Try to make it.  */
          && mkdir (r, 0755) == -1)
-       fatal_io_error ("can't create directory %s", r);
+       fatal_error ("can't create directory %s: %m", r);
 
       *s = sep;
       /* Skip consecutive separators.  */
@@ -3374,14 +3374,14 @@ write_classfile (tree clas)
       temporary_file_name = concat (class_file_name, ".tmp", NULL);
       stream = fopen (temporary_file_name, "wb");
       if (stream == NULL)
-       fatal_io_error ("can't open %s for writing", temporary_file_name);
+       fatal_error ("can't open %s for writing: %m", temporary_file_name);
 
       jcf_dependency_add_target (class_file_name);
       init_jcf_state (state, work);
       chunks = generate_classfile (clas, state);
       write_chunks (stream, chunks);
       if (fclose (stream))
-       fatal_io_error ("error closing %s", temporary_file_name);
+       fatal_error ("error closing %s: %m", temporary_file_name);
 
       /* If a file named by the string pointed to by `new' exists
          prior to the call to the `rename' function, the bahaviour
@@ -3394,7 +3394,7 @@ write_classfile (tree clas)
       if (rename (temporary_file_name, class_file_name) == -1)
        {
          remove (temporary_file_name);
-         fatal_io_error ("can't create %s", class_file_name);
+         fatal_error ("can't create %s: %m", class_file_name);
        }
       free (temporary_file_name);
       free (class_file_name);
index e21bfd649af9ccc83dd3bc01962847b5525b159c..b2655facec15f436e926f39e2aabd6c82b6647a4 100644 (file)
@@ -1825,7 +1825,7 @@ java_get_line_col (const char *filename ATTRIBUTE_UNUSED,
   char *base;
 
   if (!(fp = fopen (filename, "r")))
-    fatal_io_error ("can't open %s", filename);
+    fatal_error ("can't open %s: %m", filename);
 
   while (cline != line)
     {
index dd6b87e15b042e93b95ca553b85476a28464ee7a..06259580ab4f519b584d974b2fdd8bbd2f485f5d 100644 (file)
@@ -449,7 +449,7 @@ objc_init ()
       register char * const dumpname = concat (dump_base_name, ".decl", NULL);
       gen_declaration_file = fopen (dumpname, "w");
       if (gen_declaration_file == 0)
-       fatal_io_error ("can't open %s", dumpname);
+       fatal_error ("can't open %s: %m", dumpname);
       free (dumpname);
     }
 
index 22cd711798a5f4e7bb11db58d220b46ffc4711b0..800b72a9e3990d0830ee29a5505f749f02674fc9 100644 (file)
@@ -1764,10 +1764,10 @@ setup_core_dumping ()
   {
     struct rlimit rlim;
     if (getrlimit (RLIMIT_CORE, &rlim) != 0)
-      fatal_io_error ("getting core file size maximum limit");
+      fatal_error ("getting core file size maximum limit: %m");
     rlim.rlim_cur = rlim.rlim_max;
     if (setrlimit (RLIMIT_CORE, &rlim) != 0)
-      fatal_io_error ("setting core file size limit to maximum");
+      fatal_error ("setting core file size limit to maximum: %m");
   }
 #endif
   diagnostic_abort_on_error (global_dc);
@@ -1913,7 +1913,7 @@ open_dump_file (index, decl)
 
   rtl_dump_file = fopen (dump_name, open_arg);
   if (rtl_dump_file == NULL)
-    fatal_io_error ("can't open %s", dump_name);
+    fatal_error ("can't open %s: %m", dump_name);
 
   free (dump_name);
 
@@ -4878,7 +4878,7 @@ init_asm_output (name)
       else
        asm_out_file = fopen (asm_file_name, "w+");
       if (asm_out_file == 0)
-       fatal_io_error ("can't open %s for writing", asm_file_name);
+       fatal_error ("can't open %s for writing: %m", asm_file_name);
     }
 
 #ifdef IO_BUFFER_SIZE
@@ -5367,7 +5367,7 @@ process_options ()
     {
       aux_info_file = fopen (aux_info_file_name, "w");
       if (aux_info_file == 0)
-       fatal_io_error ("can't open %s", aux_info_file_name);
+       fatal_error ("can't open %s: %m", aux_info_file_name);
     }
 
   if (! targetm.have_named_sections)
@@ -5519,9 +5519,9 @@ finalize ()
   if (asm_out_file)
     {
       if (ferror (asm_out_file) != 0)
-       fatal_io_error ("error writing to %s", asm_file_name);
+       fatal_error ("error writing to %s: %m", asm_file_name);
       if (fclose (asm_out_file) != 0)
-       fatal_io_error ("error closing %s", asm_file_name);
+       fatal_error ("error closing %s: %m", asm_file_name);
     }
 
   /* Do whatever is necessary to finish printing the graphs.  */
index a55e73016bb0cce91eb50183dc1fe5ea02eb212f..9271b6d77eae368c940d75562cdc2667eaa65902 100644 (file)
@@ -34,8 +34,6 @@ extern void print_time                        PARAMS ((const char *, long));
 extern const char *trim_filename       PARAMS ((const char *));
 extern void internal_error             PARAMS ((const char *, ...))
                                               ATTRIBUTE_NORETURN;
-extern void fatal_io_error             PARAMS ((const char *, ...))
-                                              ATTRIBUTE_NORETURN;
 extern void _fatal_insn_not_found      PARAMS ((struct rtx_def *,
                                                const char *, int,
                                                const char *))