aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2010-05-28 14:03:31 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2010-05-28 14:03:31 +0100
commit7ca92787862d1b6cae3fbda685c1ddf2009e73b3 (patch)
tree065aff3d1d01e48c7777eadaa47358832eb00cb5
parent8bf85f21b3a0180e286e2e32de3dd7f266729baf (diff)
downloadgcc-7ca92787862d1b6cae3fbda685c1ddf2009e73b3.zip
gcc-7ca92787862d1b6cae3fbda685c1ddf2009e73b3.tar.gz
gcc-7ca92787862d1b6cae3fbda685c1ddf2009e73b3.tar.bz2
final.c (rest_of_clean_state): Use %m in errors instead of strerror (errno).
* 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). 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). From-SVN: r159969
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/final.c8
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/cpp.c5
-rw-r--r--gcc/fortran/module.c14
-rw-r--r--gcc/gengtype.c12
-rw-r--r--gcc/lto/ChangeLog11
-rw-r--r--gcc/lto/lto-coff.c15
-rw-r--r--gcc/lto/lto-macho.c13
-rw-r--r--gcc/lto/lto.c3
-rw-r--r--gcc/toplev.c8
-rw-r--r--gcc/tree-dump.c6
12 files changed, 61 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c51b84..9afbc7e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/final.c b/gcc/final.c
index 93c2970..44f02ad 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -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;
}
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 1566d08..00fc06e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 6361085..8dbd157 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -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);
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index a419d6b..9bdee2a 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -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. */
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index cb3d9bb..65bb8d1 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -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;
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index fb71dc3..fd70eff 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -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.
diff --git a/gcc/lto/lto-coff.c b/gcc/lto/lto-coff.c
index 1b87cbb..0eca893 100644
--- a/gcc/lto/lto-coff.c
+++ b/gcc/lto/lto-coff.c
@@ -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;
diff --git a/gcc/lto/lto-macho.c b/gcc/lto/lto-macho.c
index d5573a0..1ba74c0 100644
--- a/gcc/lto/lto-macho.c
+++ b/gcc/lto/lto-macho.c
@@ -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;
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 37d57bb..4ed6e20 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -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);
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 6c20b3c..dc677a3 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -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;
}
}
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index 90b8990..c159fca 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -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);