diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-13 18:06:52 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-13 18:06:52 +0000 |
commit | d07c9932fe3d8be3478554d156bf3bf189027339 (patch) | |
tree | fd24969394b3b9dffb1cc037cebd35f54276e5b8 /gcc/diagnostic.c | |
parent | a82984ec82161ff946c0e260660fbbcbdad83b28 (diff) | |
download | gcc-d07c9932fe3d8be3478554d156bf3bf189027339.tar.gz |
* 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
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66769 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 92e749f0b94..53399fcf4a8 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. |