This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/rfa:rs6000] Eliminate warning_begin()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 30 Jan 2002 22:07:16 -0500
- Subject: [patch/rfa:rs6000] Eliminate warning_begin()
Hello,
The file rs6000-nat.c contains GDB's only warning_begin() call. This
patch should eliminate it. Ok? I think it is ok - don't have an rs6000
handy.
It also adds a vwarning() function. A next pass is to cleanup code like
language.c:type_error() replacing its body with vwarning() and verror()
calls.
enjoy,
Andrew
2002-01-30 Andrew Cagney <ac131313@redhat.com>
* defs.h (vwarning): Declare.
(warning_begin): Delete declaration.
* utils.c (vwarning): New function.
(warning): Call vwarning.
(warning_begin): Delete function.
* rs6000-nat.c (vmap_ldinfo): Use the function warning to print
the warning message.
* d10v-tdep.c (d10v_address_to_pointer) [0]: Delete call to
warning_begin.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.32
diff -p -r1.32 d10v-tdep.c
*** d10v-tdep.c 2002/01/07 20:43:46 1.32
--- d10v-tdep.c 2002/01/31 02:15:53
*************** d10v_address_to_pointer (struct type *ty
*** 402,417 ****
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
{
- #if 0
- if (! d10v_iaddr_p (addr))
- {
- warning_begin ();
- fprintf_unfiltered (gdb_stderr, "address `");
- print_address_numeric (addr, 1, gdb_stderr);
- fprintf_unfiltered (gdb_stderr, "' is not a code address\n");
- }
- #endif
-
store_unsigned_integer (buf, TYPE_LENGTH (type),
d10v_convert_iaddr_to_raw (addr));
}
--- 402,407 ----
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.73
diff -p -r1.73 defs.h
*** defs.h 2002/01/17 22:15:16 1.73
--- defs.h 2002/01/31 02:15:55
*************** extern void warning_begin (void);
*** 1173,1178 ****
--- 1173,1180 ----
extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2);
+ extern void vwarning (const char *, va_list args);
+
/* Global functions from other, non-gdb GNU thingies.
Libiberty thingies are no longer declared here. We include libiberty.h
above, instead. */
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.20
diff -p -r1.20 rs6000-nat.c
*** rs6000-nat.c 2002/01/08 02:04:12 1.20
--- rs6000-nat.c 2002/01/31 02:16:04
*************** vmap_ldinfo (LdInfo *ldi)
*** 851,864 ****
running a different copy of the same executable. */
if (symfile_objfile != NULL && !got_exec_file)
{
! warning_begin ();
! fputs_unfiltered ("Symbol file ", gdb_stderr);
! fputs_unfiltered (symfile_objfile->name, gdb_stderr);
! fputs_unfiltered ("\nis not mapped; discarding it.\n\
If in fact that file has symbols which the mapped files listed by\n\
\"info files\" lack, you can load symbols with the \"symbol-file\" or\n\
\"add-symbol-file\" commands (note that you must take care of relocating\n\
! symbols to the proper address).\n", gdb_stderr);
free_objfile (symfile_objfile);
symfile_objfile = NULL;
}
--- 851,862 ----
running a different copy of the same executable. */
if (symfile_objfile != NULL && !got_exec_file)
{
! warning ("Symbol file %s\nis not mapped; discarding it.\n\
If in fact that file has symbols which the mapped files listed by\n\
\"info files\" lack, you can load symbols with the \"symbol-file\" or\n\
\"add-symbol-file\" commands (note that you must take care of relocating\n\
! symbols to the proper address).",
! symfile_objfile->name);
free_objfile (symfile_objfile);
symfile_objfile = NULL;
}
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.57
diff -p -r1.57 utils.c
*** utils.c 2002/01/20 04:23:27 1.57
--- utils.c 2002/01/31 02:16:12
*************** discard_all_intermediate_continuations (
*** 554,576 ****
! /* Print a warning message. Way to use this is to call warning_begin,
! output the warning message (use unfiltered output to gdb_stderr),
! ending in a newline. There is not currently a warning_end that you
! call afterwards, but such a thing might be added if it is useful
! for a GUI to separate warning messages from other output.
- FIXME: Why do warnings use unfiltered output and errors filtered?
- Is this anything other than a historical accident? */
-
void
! warning_begin (void)
{
! target_terminal_ours ();
! wrap_here (""); /* Force out any buffered output */
! gdb_flush (gdb_stdout);
! if (warning_pre_print)
! fprintf_unfiltered (gdb_stderr, warning_pre_print);
}
/* Print a warning message.
--- 554,581 ----
! /* Print a warning message. The first argument STRING is the warning
! message, used as an fprintf format string, the second is the
! va_list of arguments for that string. A warning is unfiltered (not
! paginated) so that the user does not need to page through each
! screen full of warnings when there are lots of them. */
void
! vwarning (const char *string, va_list args)
{
! if (warning_hook)
! (*warning_hook) (string, args);
! else
! {
! target_terminal_ours ();
! wrap_here (""); /* Force out any buffered output */
! gdb_flush (gdb_stdout);
! if (warning_pre_print)
! fprintf_unfiltered (gdb_stderr, warning_pre_print);
! vfprintf_unfiltered (gdb_stderr, string, args);
! fprintf_unfiltered (gdb_stderr, "\n");
! va_end (args);
! }
}
/* Print a warning message.
*************** warning (const char *string,...)
*** 584,598 ****
{
va_list args;
va_start (args, string);
! if (warning_hook)
! (*warning_hook) (string, args);
! else
! {
! warning_begin ();
! vfprintf_unfiltered (gdb_stderr, string, args);
! fprintf_unfiltered (gdb_stderr, "\n");
! va_end (args);
! }
}
/* Start the printing of an error message. Way to use this is to call
--- 589,596 ----
{
va_list args;
va_start (args, string);
! vwarning (string, args);
! va_end (args);
}
/* Start the printing of an error message. Way to use this is to call