]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* final.c (rest_of_clean_state): Use %m in errors instead of
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 May 2010 13:03:31 +0000 (13:03 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 May 2010 13:03:31 +0000 (13:03 +0000)
strerror (errno).
* gengtype.c (read_input_list, close_output_files): Use xstrerror
instead of strerror.
* toplev.c (process_options): Use %m in errors instead of strerror
(errno).
* tree-dump.c (dump_begin): Use %m in errors instead of strerror
(errno).

fortran:
* cpp.c (gfc_cpp_init_0): Use xstrerror instead of strerror.
* module.c (write_char, gfc_dump_module, gfc_use_module): Use
xstrerror instead of strerror.

lto:
* lto-coff.c (coff_errmsg): Remove.
(lto_coff_begin_section_with_type, lto_obj_append_data): Use %m in
errors instead of coff_errmsg (-1).
* lto-macho.c (mach_o_errmsg): Remove.
(lto_obj_begin_section, lto_obj_append_data): Use %m in errors
instead of mach_o_errmsg (-1).
* lto.c (read_cgraph_and_symbols): Use %m in errors instead of
xstrerror (errno).

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159969 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ChangeLog
gcc/final.c
gcc/fortran/ChangeLog
gcc/fortran/cpp.c
gcc/fortran/module.c
gcc/gengtype.c
gcc/lto/ChangeLog
gcc/lto/lto-coff.c
gcc/lto/lto-macho.c
gcc/lto/lto.c
gcc/toplev.c
gcc/tree-dump.c

index 5c51b843e20dd82926f3ff78fdcda4c16e89a075..9afbc7e09a8ab07f3671e9cd98cc980f3e803ce2 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-28  Joseph Myers  <joseph@codesourcery.com>
+
+       * final.c (rest_of_clean_state): Use %m in errors instead of
+       strerror (errno).
+       * gengtype.c (read_input_list, close_output_files): Use xstrerror
+       instead of strerror.
+       * toplev.c (process_options): Use %m in errors instead of strerror
+       (errno).
+       * tree-dump.c (dump_begin): Use %m in errors instead of strerror
+       (errno).
+
 2010-05-28  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.c (ix86_fn_abi_va_list): Make static.
index 93c2970b32023a52ada629c062d2552c06268c89..44f02adb0f43ebf1de173062fb5150eae140b239 100644 (file)
@@ -4363,8 +4363,8 @@ rest_of_clean_state (void)
       final_output = fopen (flag_dump_final_insns, "a");
       if (!final_output)
        {
-         error ("could not open final insn dump file %qs: %s",
-                flag_dump_final_insns, strerror (errno));
+         error ("could not open final insn dump file %qs: %m",
+                flag_dump_final_insns);
          flag_dump_final_insns = NULL;
        }
       else
@@ -4424,8 +4424,8 @@ rest_of_clean_state (void)
 
       if (fclose (final_output))
        {
-         error ("could not close final insn dump file %qs: %s",
-                flag_dump_final_insns, strerror (errno));
+         error ("could not close final insn dump file %qs: %m",
+                flag_dump_final_insns);
          flag_dump_final_insns = NULL;
        }
     }
index 1566d08f9b6fadfffd22f87630b58eba35be8a86..00fc06eff3ab9d16c6ff5f6de3d9d529b532a9ae 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-28  Joseph Myers  <joseph@codesourcery.com>
+
+       * cpp.c (gfc_cpp_init_0): Use xstrerror instead of strerror.
+       * module.c (write_char, gfc_dump_module, gfc_use_module): Use
+       xstrerror instead of strerror.
+
 2010-05-26  Joseph Myers  <joseph@codesourcery.com>
 
        * cpp.c (cb_cpp_error): Save and restore
index 6361085372e035030d35bf195b0bfa20bcd9b3ab..8dbd157deaa8867e76bed025c6fcee811ba08a0a 100644 (file)
@@ -523,7 +523,8 @@ gfc_cpp_init_0 (void)
          print.outf = fopen (gfc_cpp_option.output_filename, "w");
          if (print.outf == NULL)
            gfc_fatal_error ("opening output file %s: %s",
-                            gfc_cpp_option.output_filename, strerror(errno));
+                            gfc_cpp_option.output_filename,
+                            xstrerror (errno));
        }
       else
        print.outf = stdout;
@@ -533,7 +534,7 @@ gfc_cpp_init_0 (void)
       print.outf = fopen (gfc_cpp_option.temporary_filename, "w");
       if (print.outf == NULL)
        gfc_fatal_error ("opening output file %s: %s",
-                        gfc_cpp_option.temporary_filename, strerror(errno));
+                        gfc_cpp_option.temporary_filename, xstrerror (errno));
     }
 
   gcc_assert(cpp_in);
index a419d6bdd042b2962d2c2094b8badd1c8496da51..9bdee2a60f0ebdd45cb0959dc5523d0886cbc8e3 100644 (file)
@@ -1299,7 +1299,7 @@ static void
 write_char (char out)
 {
   if (putc (out, module_fp) == EOF)
-    gfc_fatal_error ("Error writing modules file: %s", strerror (errno));
+    gfc_fatal_error ("Error writing modules file: %s", xstrerror (errno));
 
   /* Add this to our MD5.  */
   md5_process_bytes (&out, sizeof (out), &ctx);
@@ -5124,7 +5124,7 @@ gfc_dump_module (const char *name, int dump_flag)
   module_fp = fopen (filename_tmp, "w");
   if (module_fp == NULL)
     gfc_fatal_error ("Can't open module file '%s' for writing at %C: %s",
-                    filename_tmp, strerror (errno));
+                    filename_tmp, xstrerror (errno));
 
   /* Write the header, including space reserved for the MD5 sum.  */
   now = time (NULL);
@@ -5162,7 +5162,7 @@ gfc_dump_module (const char *name, int dump_flag)
 
   if (fclose (module_fp))
     gfc_fatal_error ("Error writing module file '%s' for writing: %s",
-                    filename_tmp, strerror (errno));
+                    filename_tmp, xstrerror (errno));
 
   /* Read the MD5 from the header of the old module file and compare.  */
   if (read_md5_from_module_file (filename, md5_old) != 0
@@ -5171,16 +5171,16 @@ gfc_dump_module (const char *name, int dump_flag)
       /* Module file have changed, replace the old one.  */
       if (unlink (filename) && errno != ENOENT)
        gfc_fatal_error ("Can't delete module file '%s': %s", filename,
-                        strerror (errno));
+                        xstrerror (errno));
       if (rename (filename_tmp, filename))
        gfc_fatal_error ("Can't rename module file '%s' to '%s': %s",
-                        filename_tmp, filename, strerror (errno));
+                        filename_tmp, filename, xstrerror (errno));
     }
   else
     {
       if (unlink (filename_tmp))
        gfc_fatal_error ("Can't delete temporary module file '%s': %s",
-                        filename_tmp, strerror (errno));
+                        filename_tmp, xstrerror (errno));
     }
 }
 
@@ -5530,7 +5530,7 @@ gfc_use_module (void)
 
   if (module_fp == NULL)
     gfc_fatal_error ("Can't open module file '%s' for reading at %C: %s",
-                    filename, strerror (errno));
+                    filename, xstrerror (errno));
 
   /* Check that we haven't already USEd an intrinsic module with the
      same name.  */
index cb3d9bbf2211e87ec844e6a1f0571d836890a071..65bb8d1cfc8ad9ccdf02aa491816010d611e3f3f 100644 (file)
@@ -1,5 +1,5 @@
 /* Process source files and output type information.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -392,7 +392,7 @@ read_input_list (const char *listname)
 {
   FILE *list = fopen (listname, "r");
   if (!list)
-    fatal ("cannot open %s: %s", listname, strerror (errno));
+    fatal ("cannot open %s: %s", listname, xstrerror (errno));
   else
     {
       struct fileloc epos;
@@ -508,7 +508,7 @@ read_input_list (const char *listname)
   }
 
   if (ferror (list))
-    fatal ("error reading %s: %s", listname, strerror (errno));
+    fatal ("error reading %s: %s", listname, xstrerror (errno));
 
   fclose (list);
 }
@@ -1838,11 +1838,11 @@ close_output_files (void)
       {
         FILE *newfile = fopen (of->name, "w");
         if (newfile == NULL)
-          fatal ("opening output file %s: %s", of->name, strerror (errno));
+          fatal ("opening output file %s: %s", of->name, xstrerror (errno));
         if (fwrite (of->buf, 1, of->bufused, newfile) != of->bufused)
-          fatal ("writing output file %s: %s", of->name, strerror (errno));
+          fatal ("writing output file %s: %s", of->name, xstrerror (errno));
         if (fclose (newfile) != 0)
-          fatal ("closing output file %s: %s", of->name, strerror (errno));
+          fatal ("closing output file %s: %s", of->name, xstrerror (errno));
       }
       free(of->buf);
       of->buf = NULL;
index fb71dc30c73d2ec799bc1799469f31651a18108b..fd70eff732113d0355780b58250fc7c7aa4c157e 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-28  Joseph Myers  <joseph@codesourcery.com>
+
+       * lto-coff.c (coff_errmsg): Remove.
+       (lto_coff_begin_section_with_type, lto_obj_append_data): Use %m in
+       errors instead of coff_errmsg (-1).
+       * lto-macho.c (mach_o_errmsg): Remove.
+       (lto_obj_begin_section, lto_obj_append_data): Use %m in errors
+       instead of mach_o_errmsg (-1).
+       * lto.c (read_cgraph_and_symbols): Use %m in errors instead of
+       xstrerror (errno).
+
 2010-05-28  Richard Guenther  <rguenther@suse.de>
 
        * lto.c (prefix_name_with_star): Removed.
index 1b87cbbe7641535a857f7b963cdeb946db0c750b..0eca8936d205b5c72d530fa4886462e2e10696f5 100644 (file)
@@ -1,5 +1,5 @@
 /* LTO routines for COFF object files.
-   Copyright 2009 Free Software Foundation, Inc.
+   Copyright 2009, 2010 Free Software Foundation, Inc.
    Contributed by Dave Korn.
 
 This file is part of GCC.
@@ -133,15 +133,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset)
   file->offset = offset;
 }
 
-/* Return an error string after an error, or a predetermined one
-   if ERRCODE is not -1.  */
-
-static const char *
-coff_errmsg (int errcode)
-{
-  return strerror (errcode == -1 ? errno : errcode);
-}
-
 /* Returns a hash code for P.  */
 
 static hashval_t
@@ -273,7 +264,7 @@ lto_coff_begin_section_with_type (const char *name, size_t type)
   /* Create a new section.  */
   file->scn = coff_newsection (file, name, type);
   if (!file->scn)
-    fatal_error ("could not create a new COFF section: %s", coff_errmsg (-1));
+    fatal_error ("could not create a new COFF section: %m");
 
   /* Add a string table entry and record the offset.  */
   gcc_assert (file->shstrtab_stream);
@@ -312,7 +303,7 @@ lto_obj_append_data (const void *data, size_t len, void *block)
 
   coff_data = coff_newdata (file->scn);
   if (!coff_data)
-    fatal_error ("could not append data to COFF section: %s", coff_errmsg (-1));
+    fatal_error ("could not append data to COFF section: %m");
 
   coff_data->d_buf = CONST_CAST (void *, data);
   coff_data->d_size = len;
index d5573a06a810de27754114534df4173efa909f4d..1ba74c0a3a0d281a986dc140ea96454a71c7f185 100644 (file)
@@ -140,15 +140,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset)
   file->offset = offset;
 }
 
-/* Return an error string after an error, or a predetermined one
-   if ERRCODE is not -1.  */
-
-static const char *
-mach_o_errmsg (int errcode)
-{
-  return strerror (errcode == -1 ? errno : errcode);
-}
-
 /* Returns a hash code for P.  */
 
 static hashval_t
@@ -321,7 +312,7 @@ lto_obj_begin_section (const char *name)
   /* Create a new section.  */
   file->scn = mach_o_new_section (file, name);
   if (!file->scn)
-    fatal_error ("could not create a new Mach-O section: %s", mach_o_errmsg (-1));
+    fatal_error ("could not create a new Mach-O section: %m");
 }
 
 
@@ -343,7 +334,7 @@ lto_obj_append_data (const void *data, size_t len, void *block)
 
   mach_o_data = mach_o_new_data (file->scn);
   if (!mach_o_data)
-    fatal_error ("could not append data to Mach-O section: %s", mach_o_errmsg (-1));
+    fatal_error ("could not append data to Mach-O section: %m");
 
   mach_o_data->d_buf = CONST_CAST (void *, data);
   mach_o_data->d_size = len;
index 37d57bbc58ff18d61065249b1cec4850a4ea76ff..4ed6e20f690e9238d9c4d5f4091b876caa5866a2 100644 (file)
@@ -1481,8 +1481,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
 
       resolution = fopen (resolution_file_name, "r");
       if (resolution == NULL)
-       fatal_error ("could not open symbol resolution file: %s",
-                    xstrerror (errno));
+       fatal_error ("could not open symbol resolution file: %m");
 
       t = fscanf (resolution, "%u", &num_objects);
       gcc_assert (t == 1);
index 6c20b3ca642232a9a165e17ce4074e2aaa298b54..dc677a3080c86649d9b92cd4e1ca64bfbad689ba 100644 (file)
@@ -1948,14 +1948,14 @@ process_options (void)
       FILE *final_output = fopen (flag_dump_final_insns, "w");
       if (!final_output)
        {
-         error ("could not open final insn dump file %qs: %s",
-                flag_dump_final_insns, strerror (errno));
+         error ("could not open final insn dump file %qs: %m",
+                flag_dump_final_insns);
          flag_dump_final_insns = NULL;
        }
       else if (fclose (final_output))
        {
-         error ("could not close zeroed insn dump file %qs: %s",
-                flag_dump_final_insns, strerror (errno));
+         error ("could not close zeroed insn dump file %qs: %m",
+                flag_dump_final_insns);
          flag_dump_final_insns = NULL;
        }
     }
index 90b899039d2568827aa5e3a5a674f3a5ac3b98aa..c159fcadca828b4bd12f13ce4e0216f99111c342 100644 (file)
@@ -1,6 +1,6 @@
 /* Tree-dumping functionality for intermediate representation.
-   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+   2010 Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>
 
 This file is part of GCC.
@@ -926,7 +926,7 @@ dump_begin (int phase, int *flag_ptr)
   dfi = get_dump_file_info (phase);
   stream = fopen (name, dfi->state < 0 ? "w" : "a");
   if (!stream)
-    error ("could not open dump file %qs: %s", name, strerror (errno));
+    error ("could not open dump file %qs: %m", name);
   else
     dfi->state = 1;
   free (name);