Commit 7ca92787 by Joseph Myers Committed by Joseph Myers

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
parent 8bf85f21
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> 2010-05-28 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_fn_abi_va_list): Make static. * config/i386/i386.c (ix86_fn_abi_va_list): Make static.
......
...@@ -4363,8 +4363,8 @@ rest_of_clean_state (void) ...@@ -4363,8 +4363,8 @@ rest_of_clean_state (void)
final_output = fopen (flag_dump_final_insns, "a"); final_output = fopen (flag_dump_final_insns, "a");
if (!final_output) if (!final_output)
{ {
error ("could not open final insn dump file %qs: %s", error ("could not open final insn dump file %qs: %m",
flag_dump_final_insns, strerror (errno)); flag_dump_final_insns);
flag_dump_final_insns = NULL; flag_dump_final_insns = NULL;
} }
else else
...@@ -4424,8 +4424,8 @@ rest_of_clean_state (void) ...@@ -4424,8 +4424,8 @@ rest_of_clean_state (void)
if (fclose (final_output)) if (fclose (final_output))
{ {
error ("could not close final insn dump file %qs: %s", error ("could not close final insn dump file %qs: %m",
flag_dump_final_insns, strerror (errno)); flag_dump_final_insns);
flag_dump_final_insns = NULL; flag_dump_final_insns = NULL;
} }
} }
......
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> 2010-05-26 Joseph Myers <joseph@codesourcery.com>
* cpp.c (cb_cpp_error): Save and restore * cpp.c (cb_cpp_error): Save and restore
......
...@@ -523,7 +523,8 @@ gfc_cpp_init_0 (void) ...@@ -523,7 +523,8 @@ gfc_cpp_init_0 (void)
print.outf = fopen (gfc_cpp_option.output_filename, "w"); print.outf = fopen (gfc_cpp_option.output_filename, "w");
if (print.outf == NULL) if (print.outf == NULL)
gfc_fatal_error ("opening output file %s: %s", gfc_fatal_error ("opening output file %s: %s",
gfc_cpp_option.output_filename, strerror(errno)); gfc_cpp_option.output_filename,
xstrerror (errno));
} }
else else
print.outf = stdout; print.outf = stdout;
...@@ -533,7 +534,7 @@ gfc_cpp_init_0 (void) ...@@ -533,7 +534,7 @@ gfc_cpp_init_0 (void)
print.outf = fopen (gfc_cpp_option.temporary_filename, "w"); print.outf = fopen (gfc_cpp_option.temporary_filename, "w");
if (print.outf == NULL) if (print.outf == NULL)
gfc_fatal_error ("opening output file %s: %s", 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); gcc_assert(cpp_in);
......
...@@ -1299,7 +1299,7 @@ static void ...@@ -1299,7 +1299,7 @@ static void
write_char (char out) write_char (char out)
{ {
if (putc (out, module_fp) == EOF) 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. */ /* Add this to our MD5. */
md5_process_bytes (&out, sizeof (out), &ctx); md5_process_bytes (&out, sizeof (out), &ctx);
...@@ -5124,7 +5124,7 @@ gfc_dump_module (const char *name, int dump_flag) ...@@ -5124,7 +5124,7 @@ gfc_dump_module (const char *name, int dump_flag)
module_fp = fopen (filename_tmp, "w"); module_fp = fopen (filename_tmp, "w");
if (module_fp == NULL) if (module_fp == NULL)
gfc_fatal_error ("Can't open module file '%s' for writing at %C: %s", 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. */ /* Write the header, including space reserved for the MD5 sum. */
now = time (NULL); now = time (NULL);
...@@ -5162,7 +5162,7 @@ gfc_dump_module (const char *name, int dump_flag) ...@@ -5162,7 +5162,7 @@ gfc_dump_module (const char *name, int dump_flag)
if (fclose (module_fp)) if (fclose (module_fp))
gfc_fatal_error ("Error writing module file '%s' for writing: %s", 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. */ /* Read the MD5 from the header of the old module file and compare. */
if (read_md5_from_module_file (filename, md5_old) != 0 if (read_md5_from_module_file (filename, md5_old) != 0
...@@ -5171,16 +5171,16 @@ gfc_dump_module (const char *name, int dump_flag) ...@@ -5171,16 +5171,16 @@ gfc_dump_module (const char *name, int dump_flag)
/* Module file have changed, replace the old one. */ /* Module file have changed, replace the old one. */
if (unlink (filename) && errno != ENOENT) if (unlink (filename) && errno != ENOENT)
gfc_fatal_error ("Can't delete module file '%s': %s", filename, gfc_fatal_error ("Can't delete module file '%s': %s", filename,
strerror (errno)); xstrerror (errno));
if (rename (filename_tmp, filename)) if (rename (filename_tmp, filename))
gfc_fatal_error ("Can't rename module file '%s' to '%s': %s", gfc_fatal_error ("Can't rename module file '%s' to '%s': %s",
filename_tmp, filename, strerror (errno)); filename_tmp, filename, xstrerror (errno));
} }
else else
{ {
if (unlink (filename_tmp)) if (unlink (filename_tmp))
gfc_fatal_error ("Can't delete temporary module file '%s': %s", 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) ...@@ -5530,7 +5530,7 @@ gfc_use_module (void)
if (module_fp == NULL) if (module_fp == NULL)
gfc_fatal_error ("Can't open module file '%s' for reading at %C: %s", 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 /* Check that we haven't already USEd an intrinsic module with the
same name. */ same name. */
......
/* Process source files and output type information. /* 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. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -392,7 +392,7 @@ read_input_list (const char *listname) ...@@ -392,7 +392,7 @@ read_input_list (const char *listname)
{ {
FILE *list = fopen (listname, "r"); FILE *list = fopen (listname, "r");
if (!list) if (!list)
fatal ("cannot open %s: %s", listname, strerror (errno)); fatal ("cannot open %s: %s", listname, xstrerror (errno));
else else
{ {
struct fileloc epos; struct fileloc epos;
...@@ -508,7 +508,7 @@ read_input_list (const char *listname) ...@@ -508,7 +508,7 @@ read_input_list (const char *listname)
} }
if (ferror (list)) if (ferror (list))
fatal ("error reading %s: %s", listname, strerror (errno)); fatal ("error reading %s: %s", listname, xstrerror (errno));
fclose (list); fclose (list);
} }
...@@ -1838,11 +1838,11 @@ close_output_files (void) ...@@ -1838,11 +1838,11 @@ close_output_files (void)
{ {
FILE *newfile = fopen (of->name, "w"); FILE *newfile = fopen (of->name, "w");
if (newfile == NULL) 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) 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) 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); free(of->buf);
of->buf = NULL; of->buf = NULL;
......
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> 2010-05-28 Richard Guenther <rguenther@suse.de>
* lto.c (prefix_name_with_star): Removed. * lto.c (prefix_name_with_star): Removed.
......
/* LTO routines for COFF object files. /* LTO routines for COFF object files.
Copyright 2009 Free Software Foundation, Inc. Copyright 2009, 2010 Free Software Foundation, Inc.
Contributed by Dave Korn. Contributed by Dave Korn.
This file is part of GCC. This file is part of GCC.
...@@ -133,15 +133,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset) ...@@ -133,15 +133,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset)
file->offset = 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. */ /* Returns a hash code for P. */
static hashval_t static hashval_t
...@@ -273,7 +264,7 @@ lto_coff_begin_section_with_type (const char *name, size_t type) ...@@ -273,7 +264,7 @@ lto_coff_begin_section_with_type (const char *name, size_t type)
/* Create a new section. */ /* Create a new section. */
file->scn = coff_newsection (file, name, type); file->scn = coff_newsection (file, name, type);
if (!file->scn) 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. */ /* Add a string table entry and record the offset. */
gcc_assert (file->shstrtab_stream); gcc_assert (file->shstrtab_stream);
...@@ -312,7 +303,7 @@ lto_obj_append_data (const void *data, size_t len, void *block) ...@@ -312,7 +303,7 @@ lto_obj_append_data (const void *data, size_t len, void *block)
coff_data = coff_newdata (file->scn); coff_data = coff_newdata (file->scn);
if (!coff_data) 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_buf = CONST_CAST (void *, data);
coff_data->d_size = len; coff_data->d_size = len;
......
...@@ -140,15 +140,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset) ...@@ -140,15 +140,6 @@ lto_file_init (lto_file *file, const char *filename, off_t offset)
file->offset = 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. */ /* Returns a hash code for P. */
static hashval_t static hashval_t
...@@ -321,7 +312,7 @@ lto_obj_begin_section (const char *name) ...@@ -321,7 +312,7 @@ lto_obj_begin_section (const char *name)
/* Create a new section. */ /* Create a new section. */
file->scn = mach_o_new_section (file, name); file->scn = mach_o_new_section (file, name);
if (!file->scn) 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) ...@@ -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); mach_o_data = mach_o_new_data (file->scn);
if (!mach_o_data) 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_buf = CONST_CAST (void *, data);
mach_o_data->d_size = len; mach_o_data->d_size = len;
......
...@@ -1481,8 +1481,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -1481,8 +1481,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
resolution = fopen (resolution_file_name, "r"); resolution = fopen (resolution_file_name, "r");
if (resolution == NULL) if (resolution == NULL)
fatal_error ("could not open symbol resolution file: %s", fatal_error ("could not open symbol resolution file: %m");
xstrerror (errno));
t = fscanf (resolution, "%u", &num_objects); t = fscanf (resolution, "%u", &num_objects);
gcc_assert (t == 1); gcc_assert (t == 1);
......
...@@ -1948,14 +1948,14 @@ process_options (void) ...@@ -1948,14 +1948,14 @@ process_options (void)
FILE *final_output = fopen (flag_dump_final_insns, "w"); FILE *final_output = fopen (flag_dump_final_insns, "w");
if (!final_output) if (!final_output)
{ {
error ("could not open final insn dump file %qs: %s", error ("could not open final insn dump file %qs: %m",
flag_dump_final_insns, strerror (errno)); flag_dump_final_insns);
flag_dump_final_insns = NULL; flag_dump_final_insns = NULL;
} }
else if (fclose (final_output)) else if (fclose (final_output))
{ {
error ("could not close zeroed insn dump file %qs: %s", error ("could not close zeroed insn dump file %qs: %m",
flag_dump_final_insns, strerror (errno)); flag_dump_final_insns);
flag_dump_final_insns = NULL; flag_dump_final_insns = NULL;
} }
} }
......
/* Tree-dumping functionality for intermediate representation. /* Tree-dumping functionality for intermediate representation.
Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
Free Software Foundation, Inc. 2010 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com> Written by Mark Mitchell <mark@codesourcery.com>
This file is part of GCC. This file is part of GCC.
...@@ -926,7 +926,7 @@ dump_begin (int phase, int *flag_ptr) ...@@ -926,7 +926,7 @@ dump_begin (int phase, int *flag_ptr)
dfi = get_dump_file_info (phase); dfi = get_dump_file_info (phase);
stream = fopen (name, dfi->state < 0 ? "w" : "a"); stream = fopen (name, dfi->state < 0 ? "w" : "a");
if (!stream) if (!stream)
error ("could not open dump file %qs: %s", name, strerror (errno)); error ("could not open dump file %qs: %m", name);
else else
dfi->state = 1; dfi->state = 1;
free (name); free (name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment