diff --git a/gas/ChangeLog b/gas/ChangeLog index 2d1137d878..dfb5fdc12b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,16 @@ +2006-09-22 Alan Modra + + * as.h (as_perror): Delete declaration. + * gdbinit.in (as_perror): Delete breakpoint. + * messages.c (as_perror): Delete function. + * doc/internals.texi: Remove as_perror description. + * listing.c (listing_print: Don't use as_perror. + * output-file.c (output_file_create, output_file_close): Likewise. + * symbols.c (symbol_create, symbol_clone): Likewise. + * write.c (write_contents): Likewise. + * config/obj-som.c (obj_som_version, obj_som_copyright): Likewise. + * config/tc-tic54x.c (tic54x_mlib): Likewise. + 2006-09-22 Alan Modra * config/tc-ppc.c (md_section_align): Don't round up address for ELF. diff --git a/gas/as.h b/gas/as.h index 424bd979d4..8ac17cf1a4 100644 --- a/gas/as.h +++ b/gas/as.h @@ -1,6 +1,6 @@ /* as.h - global header file Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -544,7 +544,6 @@ void cond_finish_check (int); void cond_exit_macro (int); int seen_at_least_1_file (void); void app_pop (char *); -void as_perror (const char *, const char *); void as_where (char **, unsigned int *); void bump_line_counters (void); void do_scrub_begin (int); diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index 571330efcb..f41df58182 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -1,5 +1,5 @@ /* SOM object file format. - Copyright 1993, 1994, 1998, 2000, 2002, 2003, 2004, 2005 + Copyright 1993, 1994, 1998, 2000, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -150,12 +150,9 @@ obj_som_version (int unused ATTRIBUTE_UNUSED) version_seen = 1; if (!bfd_som_attach_aux_hdr (stdoutput, VERSION_AUX_ID, version)) - { - bfd_perror (stdoutput->filename); - as_perror (_("FATAL: Attaching version header %s"), - stdoutput->filename); - exit (EXIT_FAILURE); - } + as_fatal (_("attaching version header %s: %s"), + stdoutput->filename, bfd_errmsg (bfd_get_error ())); + *input_line_pointer = c; demand_empty_rest_of_line (); } @@ -195,12 +192,9 @@ obj_som_copyright (int unused ATTRIBUTE_UNUSED) copyright_seen = 1; if (!bfd_som_attach_aux_hdr (stdoutput, COPYRIGHT_AUX_ID, copyright)) - { - bfd_perror (stdoutput->filename); - as_perror (_("FATAL: Attaching copyright header %s"), - stdoutput->filename); - exit (EXIT_FAILURE); - } + as_fatal (_("attaching copyright header %s: %s"), + stdoutput->filename, bfd_errmsg (bfd_get_error ())); + *input_line_pointer = c; demand_empty_rest_of_line (); } diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index b9f4fcfa25..412473b98e 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -2512,8 +2512,8 @@ tic54x_mlib (ignore) abfd = bfd_openr (path, NULL); if (!abfd) { - as_bad (_("Can't open macro library file '%s' for reading."), path); - as_perror ("%s", path); + as_bad (_("can't open macro library file '%s' for reading: %s"), + path, bfd_errmsg (bfd_get_error ())); ignore_rest_of_line (); return; } diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 16a64637e3..b2c8586be8 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1,6 +1,6 @@ \input texinfo @c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -@c 2001, 2002, 2003, 2004, 2005 +@c 2001, 2002, 2003, 2004, 2005, 2006 @c Free Software Foundation, Inc. @setfilename internals.info @node Top @@ -1844,10 +1844,6 @@ Returns non-zero if any warnings or errors, respectively, have been printed during this invocation. @end deftypefun -@deftypefun @{@} void as_perror (const char *@var{gripe}, const char *@var{filename}) -Displays a BFD or system error, then clears the error status. -@end deftypefun - @deftypefun @{@} void as_tsktsk (const char *@var{format}, ...) @deftypefunx @{@} void as_warn (const char *@var{format}, ...) @deftypefunx @{@} void as_bad (const char *@var{format}, ...) diff --git a/gas/gdbinit.in b/gas/gdbinit.in index e946726ec6..fb1046da53 100644 --- a/gas/gdbinit.in +++ b/gas/gdbinit.in @@ -6,7 +6,6 @@ break as_warn_where break as_bad break as_bad_where break as_fatal -break as_perror break as_assert break as_abort diff --git a/gas/listing.c b/gas/listing.c index 717ed60111..1b55cbf639 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -1,6 +1,6 @@ /* listing.c - maintain assembly listings Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2005 + 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1076,8 +1076,7 @@ listing_print (char *name) using_stdout = 0; else { - bfd_set_error (bfd_error_system_call); - as_perror (_("can't open list file: %s"), name); + as_warn (_("can't open %s: %s"), name, xstrerror (errno)); list_file = stdout; using_stdout = 1; } @@ -1095,10 +1094,7 @@ listing_print (char *name) if (! using_stdout) { if (fclose (list_file) == EOF) - { - bfd_set_error (bfd_error_system_call); - as_perror (_("error closing list file: %s"), name); - } + as_warn (_("can't close %s: %s"), name, xstrerror (errno)); } if (last_open_file) diff --git a/gas/messages.c b/gas/messages.c index b1b94cdf7c..21381b47e9 100644 --- a/gas/messages.c +++ b/gas/messages.c @@ -1,6 +1,6 @@ /* messages.c - error reporter - Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2003, 2004, 2005 + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -116,24 +116,6 @@ as_show_where (void) fprintf (stderr, "%s:%u: ", file, line); } -/* Like perror(3), but with more info. */ - -void -as_perror (const char *gripe, /* Unpunctuated error theme. */ - const char *filename) -{ - const char *errtxt; - int saved_errno = errno; - - as_show_where (); - fprintf (stderr, gripe, filename); - errno = saved_errno; - errtxt = bfd_errmsg (bfd_get_error ()); - fprintf (stderr, ": %s\n", errtxt); - errno = 0; - bfd_set_error (bfd_error_no_error); -} - /* Send to stderr a string as a warning, and locate warning in input file(s). Please only use this for when we have some recovery action. diff --git a/gas/output-file.c b/gas/output-file.c index 446af306ca..dfbef1f24d 100644 --- a/gas/output-file.c +++ b/gas/output-file.c @@ -36,11 +36,12 @@ output_file_create (char *name) else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT))) { - if (bfd_get_error () == bfd_error_invalid_target) - as_perror (_("Selected target format '%s' unknown"), TARGET_FORMAT); + bfd_error_type err = bfd_get_error (); + + if (err == bfd_error_invalid_target) + as_fatal (_("selected target format '%s' unknown"), TARGET_FORMAT); else - as_perror (_("FATAL: can't create %s"), name); - exit (EXIT_FAILURE); + as_fatal (_("can't create %s: %s"), name, bfd_errmsg (err)); } bfd_set_format (stdoutput, bfd_object); @@ -53,11 +54,8 @@ void output_file_close (char *filename) { /* Close the bfd. */ - if (bfd_close (stdoutput) == 0) - { - bfd_perror (filename); - as_perror (_("FATAL: can't close %s\n"), filename); - exit (EXIT_FAILURE); - } + if (!bfd_close (stdoutput)) + as_fatal (_("can't close %s: %s"), filename, + bfd_errmsg (bfd_get_error ())); stdoutput = NULL; /* Trust nobody! */ } diff --git a/gas/symbols.c b/gas/symbols.c index 117d1220e6..bd4745083e 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1,6 +1,6 @@ /* symbols.c -symbol table- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -144,7 +144,7 @@ symbol_create (const char *name, /* It is copied, the caller can destroy/modify. symbolP->bsym = bfd_make_empty_symbol (stdoutput); if (symbolP->bsym == NULL) - as_perror ("%s", "bfd_make_empty_symbol"); + as_fatal ("bfd_make_empty_symbol: %s", bfd_errmsg (bfd_get_error ())); symbolP->bsym->udata.p = (PTR) symbolP; S_SET_NAME (symbolP, preserved_copy_of_name); @@ -570,7 +570,7 @@ symbol_clone (symbolS *orgsymP, int replace) *newsymP = *orgsymP; bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg)); if (bsymnew == NULL) - as_perror ("%s", "bfd_make_empty_symbol"); + as_fatal ("bfd_make_empty_symbol: %s", bfd_errmsg (bfd_get_error ())); newsymP->bsym = bsymnew; bsymnew->name = bsymorg->name; bsymnew->flags = bsymorg->flags; diff --git a/gas/write.c b/gas/write.c index 9e28a6f549..66a05a530f 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1014,11 +1014,8 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED, f->fr_literal, (file_ptr) offset, (bfd_size_type) f->fr_fix); if (!x) - { - bfd_perror (stdoutput->filename); - as_perror (_("FATAL: Can't write %s"), stdoutput->filename); - exit (EXIT_FAILURE); - } + as_fatal (_("can't write %s: %s"), stdoutput->filename, + bfd_errmsg (bfd_get_error ())); offset += f->fr_fix; } fill_literal = f->fr_literal + f->fr_fix; @@ -1038,12 +1035,8 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED, (file_ptr) offset, (bfd_size_type) fill_size); if (!x) - { - bfd_perror (stdoutput->filename); - as_perror (_("FATAL: Can't write %s"), - stdoutput->filename); - exit (EXIT_FAILURE); - } + as_fatal (_("can't write %s: %s"), stdoutput->filename, + bfd_errmsg (bfd_get_error ())); offset += fill_size; } }