]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* as.h (as_perror): Delete declaration.
authorAlan Modra <amodra@gmail.com>
Fri, 22 Sep 2006 11:35:14 +0000 (11:35 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 22 Sep 2006 11:35:14 +0000 (11:35 +0000)
* 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.

gas/ChangeLog
gas/as.h
gas/config/obj-som.c
gas/config/tc-tic54x.c
gas/doc/internals.texi
gas/gdbinit.in
gas/listing.c
gas/messages.c
gas/output-file.c
gas/symbols.c
gas/write.c

index 2d1137d87864cf8390a02763e8bb2693d2847eea..dfb5fdc12b0e34128ff65c80912d97a5ca6fea5a 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-22  Alan Modra  <amodra@bigpond.net.au>
+
+       * 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  <amodra@bigpond.net.au>
 
        * config/tc-ppc.c (md_section_align): Don't round up address for ELF.
index 424bd979d47820505e3329ef4126226cff4f9e84..8ac17cf1a4d8d5acf9062fd080393e792fc8ebf4 100644 (file)
--- 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);
index 571330efcb4250ed73c8637eb88983cb5287b334..f41df58182b6a30bedf5bb50ee9da81af5081101 100644 (file)
@@ -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 ();
 }
index b9f4fcfa256acc8306793b1f534699d00fcd9a50..412473b98e1f804a5b98a278770150c2c9b37b81 100644 (file)
@@ -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;
     }
index 16a64637e31a983344168615ec024eadb4cf30bf..b2c8586be8c6f929898fe48e81be4b2c016097a4 100644 (file)
@@ -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}, ...)
index e946726ec676c11a0b7f6ead336f0cc2ed30d299..fb1046da531a1345750b8968df8c9b0971f2b573 100644 (file)
@@ -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
 
index 717ed60111c86f0559bdee76ead752908c1d2af3..1b55cbf63989ef18fab6aa8b4043268eb7b40bb1 100644 (file)
@@ -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)
index b1b94cdf7c6eccf118be48e11a6a16ad0fbe3deb..21381b47e968a6cd8b627ebbcc2f0b729390481f 100644 (file)
@@ -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.
index 446af306ca101d9611d947c1a274626235ab154a..dfbef1f24d3648a2e2b9f8a1a29ed15af36b323b 100644 (file)
@@ -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!  */
 }
index 117d1220e670fb81fe088271be387976a388b910..bd4745083efd881ac392aea074a55cd535e31fe4 100644 (file)
@@ -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;
index 9e28a6f5492bacee00e89457bd42524e30423d5e..66a05a530faf362c31f5d10f6fb64377d4c846e8 100644 (file)
@@ -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;
                }
            }