diff options
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/c-opts.c | 8 | ||||
-rw-r--r-- | gcc/c-pch.c | 22 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/host-darwin.c | 4 | ||||
-rw-r--r-- | gcc/diagnostic.c | 35 | ||||
-rw-r--r-- | gcc/diagnostic.h | 1 | ||||
-rw-r--r-- | gcc/dwarfout.c | 2 | ||||
-rw-r--r-- | gcc/f/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/f/com.c | 2 | ||||
-rw-r--r-- | gcc/ggc-common.c | 24 | ||||
-rw-r--r-- | gcc/ggc-page.c | 10 | ||||
-rw-r--r-- | gcc/graph.c | 2 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 12 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 8 | ||||
-rw-r--r-- | gcc/java/lex.c | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 2 | ||||
-rw-r--r-- | gcc/toplev.c | 14 | ||||
-rw-r--r-- | gcc/toplev.h | 2 |
20 files changed, 99 insertions, 87 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3059a2..c57fab3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,21 @@ 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. * rtl.h: Prototype it. * integrate.c (copy_rtx_and_substitute <SYMBOL_REF>): Call it diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 23ed899..ea2cef4 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -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 diff --git a/gcc/c-pch.c b/gcc/c-pch.c index a7fa879..354fcc7 100644 --- a/gcc/c-pch.c +++ b/gcc/c-pch.c @@ -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 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index dd1f6a9..ecd6b73 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -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 diff --git a/gcc/config/rs6000/host-darwin.c b/gcc/config/rs6000/host-darwin.c index 8b4eed2..294a654 100644 --- a/gcc/config/rs6000/host-darwin.c +++ b/gcc/config/rs6000/host-darwin.c @@ -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; diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 92e749f..53399fc 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -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 = ≈ 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 = ≈ + 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 = ≈ + 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 = ≈ - 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. diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 1d697f4..24fe2fe 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -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. */ diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index b6d150f..8555443 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -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); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 94d1eb1..c016f31 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -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. diff --git a/gcc/f/com.c b/gcc/f/com.c index bb093e3..951ef44 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -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; } diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index db8cbd0..adf2fd0 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -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); diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 569e519..51ea7f0 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -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++) { diff --git a/gcc/graph.c b/gcc/graph.c index e56ef93..5b660be 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -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) { diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b4e13f3..679636f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index e3e60cb..2b20537 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -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), diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 59ef514..0d8f73e 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -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); diff --git a/gcc/java/lex.c b/gcc/java/lex.c index e21bfd6..b2655fa 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -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) { diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index dd6b87e..0625958 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -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); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 22cd711..800b72a 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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. */ diff --git a/gcc/toplev.h b/gcc/toplev.h index a55e730..9271b6d 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -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 *)) |