+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.
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
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;
}
}
+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
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;
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);
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);
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);
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
/* 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));
}
}
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. */
/* 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.
{
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;
}
if (ferror (list))
- fatal ("error reading %s: %s", listname, strerror (errno));
+ fatal ("error reading %s: %s", listname, xstrerror (errno));
fclose (list);
}
{
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;
+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.
/* 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.
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
/* 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);
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;
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
/* 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");
}
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;
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);
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;
}
}
/* 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.
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);