This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

as_perror removal


as_perror isn't so useful now that gas has lost its non-bfd targets.

	* 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.

Index: gas/as.h
===================================================================
RCS file: /cvs/src/src/gas/as.h,v
retrieving revision 1.52
diff -u -p -r1.52 as.h
--- gas/as.h	2 Aug 2006 14:26:07 -0000	1.52
+++ gas/as.h	22 Sep 2006 08:09:51 -0000
@@ -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: gas/gdbinit.in
===================================================================
RCS file: /cvs/src/src/gas/gdbinit.in,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 gdbinit.in
--- gas/gdbinit.in	3 May 1999 07:28:40 -0000	1.1.1.1
+++ gas/gdbinit.in	22 Sep 2006 08:09:51 -0000
@@ -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: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.30
diff -u -p -r1.30 listing.c
--- gas/listing.c	1 May 2006 09:21:46 -0000	1.30
+++ gas/listing.c	22 Sep 2006 08:09:53 -0000
@@ -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: gas/messages.c
===================================================================
RCS file: /cvs/src/src/gas/messages.c,v
retrieving revision 1.16
diff -u -p -r1.16 messages.c
--- gas/messages.c	9 Feb 2006 11:54:15 -0000	1.16
+++ gas/messages.c	22 Sep 2006 08:09:53 -0000
@@ -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: gas/output-file.c
===================================================================
RCS file: /cvs/src/src/gas/output-file.c,v
retrieving revision 1.13
diff -u -p -r1.13 output-file.c
--- gas/output-file.c	7 Jun 2006 11:27:57 -0000	1.13
+++ gas/output-file.c	22 Sep 2006 08:09:53 -0000
@@ -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: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.76
diff -u -p -r1.76 symbols.c
--- gas/symbols.c	17 Jul 2006 12:49:50 -0000	1.76
+++ gas/symbols.c	22 Sep 2006 08:09:54 -0000
@@ -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 i
 
   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 repl
   *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: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.101
diff -u -p -r1.101 write.c
--- gas/write.c	7 May 2006 23:03:48 -0000	1.101
+++ gas/write.c	22 Sep 2006 08:09:55 -0000
@@ -1014,11 +1014,8 @@ write_contents (bfd *abfd ATTRIBUTE_UNUS
 					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_UNUS
 						(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;
 		}
 	    }
Index: gas/config/obj-som.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-som.c,v
retrieving revision 1.13
diff -u -p -r1.13 obj-som.c
--- gas/config/obj-som.c	5 May 2005 09:12:53 -0000	1.13
+++ gas/config/obj-som.c	22 Sep 2006 08:09:55 -0000
@@ -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_UN
 
   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_
 
   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: gas/config/tc-tic54x.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-tic54x.c,v
retrieving revision 1.26
diff -u -p -r1.26 tc-tic54x.c
--- gas/config/tc-tic54x.c	7 Jun 2006 11:27:58 -0000	1.26
+++ gas/config/tc-tic54x.c	22 Sep 2006 08:10:01 -0000
@@ -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: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.51
diff -u -p -r1.51 internals.texi
--- gas/doc/internals.texi	24 Jul 2006 13:49:49 -0000	1.51
+++ gas/doc/internals.texi	22 Sep 2006 08:10:03 -0000
@@ -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 erro
 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}, ...)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]