aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-03-09 13:26:19 +1030
committerAlan Modra <amodra@gmail.com>2024-03-09 14:35:09 +1030
commitbd8d76258f86f93b20e6bd94f58033a49eb0d3ec (patch)
tree5f6cd9f44182eb1189f2f4b8501eefbd0e5d3576 /bfd/bfd.c
parented29a346be439466ff2a5ce33e715e02c49fbdac (diff)
downloadgdb-bd8d76258f86f93b20e6bd94f58033a49eb0d3ec.zip
gdb-bd8d76258f86f93b20e6bd94f58033a49eb0d3ec.tar.gz
gdb-bd8d76258f86f93b20e6bd94f58033a49eb0d3ec.tar.bz2
print cached error messages using _bfd_error_handler
* bfd.c (bfd_print_error): Make static. Don't print program name. (error_handler_fprintf): Print program name here. * format.c (print_warnmsg): Use _bfd_error_handler to print cached messages. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r--bfd/bfd.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 71732a0..1bdfac6 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1449,31 +1449,12 @@ _bfd_doprnt_scan (const char *format, va_list ap, union _bfd_doprnt_args *args)
return arg_count;
}
-/*
-FUNCTION
- bfd_print_error
-
-SYNOPSIS
- void bfd_print_error (bfd_print_callback print_func,
- void *stream, const char *fmt, va_list ap);
-
-DESCRIPTION
-
- This formats FMT and AP according to BFD "printf" rules,
- sending the output to STREAM by repeated calls to PRINT_FUNC.
- PRINT_FUNC is a printf-like function; it does not need to
- implement the BFD printf format extensions. This can be used
- in a callback that is set via bfd_set_error_handler to turn
- the error into ordinary output.
-*/
-
-void
+static void
bfd_print_error (bfd_print_callback print_func, void *stream,
const char *fmt, va_list ap)
{
union _bfd_doprnt_args args[MAX_ARGS];
- print_func (stream, "%s: ", _bfd_get_error_program_name ());
_bfd_doprnt_scan (fmt, ap, args);
_bfd_doprnt (print_func, stream, fmt, args);
}
@@ -1486,6 +1467,7 @@ error_handler_fprintf (const char *fmt, va_list ap)
/* PR 4992: Don't interrupt output being sent to stdout. */
fflush (stdout);
+ fprintf (stderr, "%s: ", _bfd_get_error_program_name ());
bfd_print_error ((bfd_print_callback) fprintf, stderr, fmt, ap);
/* On AIX, putc is implemented as a macro that triggers a -Wunused-value