* utils.c (fprintf_filtered, fprintf_unfiltered, fprintfi_filtered,

printf_filtered, printf_unfiltered, printfi_filtered, query, warning,
          error, fatal, fatal_dump_core): Use stdarg.h macros when compiling
          with an ANSI compiler.
        * complain.c (complain): Likewise.
        * language.c (type_error, range_error): Likewise.
        * monitor.c (monitor_printf, monitor_printf_noecho): Likewise.
        * remote-array.c (printf_monitor, debuglogs): Likewise.
        * remote-mips.c (mips_error): Likewise.
        * remote-os9k.c (printf_monitor): Likewise.
        * remote-st.c (printf_stdebug): Likewise.
        * gdbtk.c (gdbtk_query): Likewise.

        * defs.h, complain.h, language.h, monitor.h: Add prototypes to
          match above changes.

        * printcmd.c: Remove uneeded #include <varargs.h>.
        * remote-e7000.c: Likewise.

        * f-typeprint.c (f_type_print_base): Fix typo found by above
          changes.
This commit is contained in:
J.T. Conklin 1995-05-18 23:45:31 +00:00
parent ff15324f63
commit 85c613aaa7
16 changed files with 293 additions and 66 deletions

View File

@ -1,3 +1,29 @@
Thu May 18 15:58:46 1995 J.T. Conklin <jtc@rtl.cygnus.com>
* utils.c (fprintf_filtered, fprintf_unfiltered, fprintfi_filtered,
printf_filtered, printf_unfiltered, printfi_filtered, query, warning,
error, fatal, fatal_dump_core): Use stdarg.h macros when compiling
with an ANSI compiler.
* complain.c (complain): Likewise.
* language.c (type_error, range_error): Likewise.
* monitor.c (monitor_printf, monitor_printf_noecho): Likewise.
* remote-array.c (printf_monitor, debuglogs): Likewise.
* remote-mips.c (mips_error): Likewise.
* remote-os9k.c (printf_monitor): Likewise.
* remote-st.c (printf_stdebug): Likewise.
start-sanitize-gdbtk
* gdbtk.c (gdbtk_query): Likewise.
end-sanitize-gdbtk
* defs.h, complain.h, language.h, monitor.h: Add prototypes to
match above changes.
* printcmd.c: Remove uneeded #include <varargs.h>.
* remote-e7000.c: Likewise.
* f-typeprint.c (f_type_print_base): Fix typo found by above
changes.
Wed May 17 11:21:32 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
* Makefile.in (xcoffread.o): Depend on partial-stab.h.

View File

@ -20,7 +20,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "complaints.h"
#include "gdbcmd.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* Structure to manage complaints about symbol file contents. */
@ -59,14 +63,23 @@ extern int info_verbose;
/* VARARGS */
void
#ifdef __STDC__
complain (struct complaint *complaint, ...)
#else
complain (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, complaint);
#else
struct complaint *complaint;
va_start (args);
complaint = va_arg (args, struct complaint *);
#endif
complaint -> counter++;
if (complaint -> next == NULL)
{

View File

@ -40,7 +40,7 @@ extern struct complaint complaint_root[1];
/* Functions that handle complaints. (in complaints.c) */
extern void
complain ();
complain PARAMS ((struct complaint *, ...));
extern void
clear_complaints PARAMS ((int, int));

View File

@ -187,7 +187,7 @@ extern void null_cleanup PARAMS ((char **));
extern int myread PARAMS ((int, char *, int));
extern int query ();
extern int query PARAMS((char *, ...));
/* Annotation stuff. */
@ -223,21 +223,21 @@ extern void vprintf_filtered ();
extern void vfprintf_filtered ();
extern void fprintf_filtered ();
extern void fprintf_filtered PARAMS ((FILE *, char *, ...));
extern void fprintfi_filtered ();
extern void fprintfi_filtered PARAMS ((int, FILE *, char *, ...));
extern void printf_filtered ();
extern void printf_filtered PARAMS ((char *, ...));
extern void printfi_filtered ();
extern void printfi_filtered PARAMS ((int, char *, ...));
extern void vprintf_unfiltered ();
extern void vfprintf_unfiltered ();
extern void fprintf_unfiltered ();
extern void fprintf_unfiltered PARAMS ((FILE *, char *, ...));
extern void printf_unfiltered ();
extern void printf_unfiltered PARAMS ((char *, ...));
extern void print_spaces PARAMS ((int, GDB_FILE *));
@ -549,11 +549,11 @@ extern char *quit_pre_print;
extern char *warning_pre_print;
extern NORETURN void error () ATTR_NORETURN;
extern NORETURN void error PARAMS((char *, ...)) ATTR_NORETURN;
extern void error_begin PARAMS ((void));
extern NORETURN void fatal () ATTR_NORETURN;
extern NORETURN void fatal PARAMS((char *, ...)) ATTR_NORETURN;
extern NORETURN void nomem PARAMS ((long)) ATTR_NORETURN;
@ -579,7 +579,7 @@ catch_errors PARAMS ((int (*) (char *), void *, char *, return_mask));
extern void warning_begin PARAMS ((void));
extern void warning ();
extern void warning PARAMS ((char *, ...));
/* Global functions from other, non-gdb GNU thingies.
Libiberty thingies are no longer declared here. We include libiberty.h

View File

@ -425,7 +425,7 @@ f_type_print_base (type, stream, show, level)
/* Strings may have dynamic upperbounds (lengths) like arrays. */
if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
fprintf_filtered ("character*(*)");
fprintf_filtered (stream, "character*(*)");
else
{
retcode = f77_get_dynamic_upperbound (type, &upper_bound);

View File

@ -29,7 +29,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include <tcl.h>
#include <tk.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
@ -121,15 +125,13 @@ gdbtk_fputs (ptr, stream)
}
static int
gdbtk_query (args)
gdbtk_query (query, args)
char *query;
va_list args;
{
char *query;
char buf[200];
long val;
query = va_arg (args, char *);
vsprintf (buf, query, args);
Tcl_VarEval (interp, "gdbtk_tcl_query ", "{", buf, "}", NULL);
@ -138,18 +140,26 @@ gdbtk_query (args)
}
static void
#ifdef __STDC__
dsprintf_append_element (Tcl_DString *dsp, char *format, ...)
#else
dsprintf_append_element (va_alist)
va_dcl
#endif
{
va_list args;
Tcl_DString *dsp;
char *format;
char buf[1024];
va_start (args);
#ifdef __STDC__
va_start (args, format);
#else
Tcl_DString *dsp;
char *format;
va_start (args);
dsp = va_arg (args, Tcl_DString *);
format = va_arg (args, char *);
#endif
vsprintf (buf, format, args);

View File

@ -29,7 +29,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include "symtab.h"
#include "gdbtypes.h"
@ -978,19 +982,27 @@ op_error (fmt,op,fatal)
by the value of warning_pre_print and we do not return to the top level. */
void
#ifdef __STDC__
type_error (char *string, ...)
#else
type_error (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
string = va_arg (args, char *);
#endif
if (type_check == type_check_warn)
fprintf_filtered (gdb_stderr, warning_pre_print);
else
error_begin ();
va_start (args);
string = va_arg (args, char *);
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
va_end (args);
@ -999,19 +1011,27 @@ type_error (va_alist)
}
void
#ifdef __STDC__
range_error (char *string, ...)
#else
range_error (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
string = va_arg (args, char *);
#endif
if (range_check == range_check_warn)
fprintf_filtered (gdb_stderr, warning_pre_print);
else
error_begin ();
va_start (args);
string = va_arg (args, char *);
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
va_end (args);

View File

@ -395,10 +395,10 @@ op_error PARAMS ((char *fmt, enum exp_opcode, int));
op_error((f),(o),range_check==range_check_on ? 1 : 0)
extern void
type_error ();
type_error PARAMS ((char *, ...));
void
range_error ();
range_error PARAMS ((char *, ...));
/* Data: Does this value represent "truth" to the current language? */

View File

@ -32,7 +32,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include "wait.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include <sys/types.h>
@ -111,17 +115,24 @@ static int dump_reg_flag; /* Non-zero means do a dump_registers cmd when
Works just like printf. */
void
#ifdef __STDC__
monitor_printf_noecho (char *pattern, ...)
#else
monitor_printf_noecho (va_alist)
va_dcl
#endif
{
va_list args;
char *pattern;
char sndbuf[2000];
int len;
#if __STDC__
va_start (args, pattern);
#else
char *pattern;
va_start (args);
pattern = va_arg (args, char *);
#endif
vsprintf (sndbuf, pattern, args);
@ -141,18 +152,25 @@ monitor_printf_noecho (va_alist)
printf. */
void
#ifdef __STDC__
monitor_printf (char *pattern, ...)
#else
monitor_printf (va_alist)
va_dcl
#endif
{
va_list args;
char *pattern;
char sndbuf[2000];
int len;
int i, c;
#ifdef __STDC__
va_start (args, pattern);
#else
char *pattern;
va_start (args);
pattern = va_arg (args, char *);
#endif
vsprintf (sndbuf, pattern, args);

View File

@ -172,5 +172,6 @@ extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_
extern char *monitor_supply_register PARAMS ((int regno, char *valstr));
extern int monitor_expect PARAMS ((char *prompt, char *buf, int buflen));
extern int monitor_expect_prompt PARAMS ((char *buf, int buflen));
extern void monitor_printf ();
extern void monitor_printf PARAMS ((char *, ...));
extern void monitor_printf_noecho PARAMS ((char *, ...));
extern void init_monitor_ops PARAMS ((struct target_ops *));

View File

@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <string.h>
#include <varargs.h>
#include "frame.h"
#include "symtab.h"
#include "gdbtypes.h"
@ -586,9 +585,8 @@ print_address_numeric (addr, use_local, stream)
GDB_FILE *stream;
{
/* This assumes a CORE_ADDR can fit in a LONGEST. Probably a safe
assumption. We pass use_local but I'm not completely sure whether
that is correct. When (if ever) should we *not* use_local? */
print_longest (stream, 'x', 1, (unsigned LONGEST) addr);
assumption. */
print_longest (stream, 'x', use_local, (unsigned LONGEST) addr);
}
/* Print address ADDR symbolically on STREAM.
@ -927,7 +925,7 @@ address_info (exp, from_tty)
return;
}
msymbol = lookup_minimal_symbol (exp, (struct objfile *) NULL);
msymbol = lookup_minimal_symbol (exp, NULL, NULL);
if (msymbol != NULL)
{

View File

@ -28,7 +28,11 @@
#include "gdbcore.h"
#include "target.h"
#include "wait.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include <sys/types.h>
@ -62,7 +66,7 @@ static char *hex2mem();
} \
while (0)
static void debuglogs();
static void debuglogs PARAMS((int, char *, ...));
static void array_open();
static void array_close();
static void array_detach();
@ -169,17 +173,24 @@ Specify the serial device it is connected to (e.g. /dev/ttya).",
* printf_monitor -- send data to monitor. Works just like printf.
*/
static void
#ifdef __STDC__
printf_monitor(char *pattern, ...)
#else
printf_monitor(va_alist)
va_dcl
#endif
{
va_list args;
char *pattern;
char buf[PBUFSIZ];
int i;
#ifdef __STDC__
va_start(args, pattern);
#else
char *pattern;
va_start(args);
pattern = va_arg(args, char *);
#endif
vsprintf(buf, pattern, args);
@ -213,25 +224,34 @@ write_monitor(data, len)
* to be formatted and printed. A CR is added after each string is printed.
*/
static void
#ifdef __STDC__
debuglogs(int level, char *pattern, ...)
#else
debuglogs(va_alist)
va_dcl
#endif
{
va_list args;
char *pattern, *p;
char *p;
unsigned char buf[PBUFSIZ];
char newbuf[PBUFSIZ];
int level, i;
int i;
#ifdef __STDC__
va_start(args, pattern);
#else
char *pattern;
int level;
va_start(args);
level = va_arg(args, int); /* get the debug level */
pattern = va_arg(args, char *); /* get the printf style pattern */
#endif
if ((level <0) || (level > 100)) {
error ("Bad argument passed to debuglogs(), needs debug level");
return;
}
pattern = va_arg(args, char *); /* get the printf style pattern */
vsprintf(buf, pattern, args); /* format the string */
/* convert some characters so it'll look right in the log */

View File

@ -31,7 +31,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "remote-utils.h"
#include <signal.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
extern char *mips_read_processor_type PARAMS ((void));
@ -271,19 +275,28 @@ static serial_t mips_desc;
inconsistent state. */
static NORETURN void
#ifdef __STDC__
mips_error (char *string, ...)
#else
mips_error (va_alist)
va_dcl
#endif
{
va_list args;
char *string;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
string = va_arg (args, char *);
#endif
target_terminal_ours ();
wrap_here(""); /* Force out any buffered output */
gdb_flush (gdb_stdout);
if (error_pre_print)
fprintf_filtered (gdb_stderr, error_pre_print);
string = va_arg (args, char *);
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
va_end (args);

View File

@ -37,7 +37,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include "wait.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include <sys/types.h>
@ -86,19 +90,27 @@ static char readbuf[16];
/* Send data to monitor. Works just like printf. */
static void
#ifdef __STDC__
printf_monitor(char *pattern, ...)
#else
printf_monitor(va_alist)
va_dcl
#endif
{
va_list args;
char *pattern;
char buf[200];
int i;
#ifdef __STDC__
va_start (args, pattern);
#else
char *pattern;
va_start(args);
pattern = va_arg(args, char *);
#endif
vsprintf(buf, pattern, args);
va_end(args);
if (SERIAL_WRITE(monitor_desc, buf, strlen(buf)))
fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno));

View File

@ -38,7 +38,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include "wait.h"
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <signal.h>
#include <string.h>
#include <sys/types.h>
@ -66,18 +70,27 @@ static serial_t st2000_desc;
/* Send data to stdebug. Works just like printf. */
static void
#ifdef __STDC__
printf_stdebug(char *pattern, ...)
#else
printf_stdebug(va_alist)
va_dcl
#endif
{
va_list args;
char *pattern;
char buf[200];
#ifdef __STDC__
va_start(args, pattern);
#else
char *pattern;
va_start(args);
pattern = va_arg(args, char *);
#endif
vsprintf(buf, pattern, args);
va_end(args);
if (SERIAL_WRITE(st2000_desc, buf, strlen(buf)))
fprintf(stderr, "SERIAL_WRITE failed: %s\n", safe_strerror(errno));
}

View File

@ -23,7 +23,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/param.h>
#include <pwd.h>
#endif
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <ctype.h>
#include <string.h>
@ -53,7 +57,7 @@ malloc_botch PARAMS ((void));
#endif /* NO_MMALLOC, etc */
static void
fatal_dump_core (); /* Can't prototype with <varargs.h> usage... */
fatal_dump_core PARAMS((char *, ...));
static void
prompt_for_continue PARAMS ((void));
@ -250,15 +254,23 @@ warning_begin ()
/* VARARGS */
void
#ifdef __STDC__
warning (char *string, ...)
#else
warning (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
warning_begin ();
string = va_arg (args, char *);
#endif
warning_begin ();
vfprintf_unfiltered (gdb_stderr, string, args);
fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
@ -290,19 +302,23 @@ error_begin ()
/* VARARGS */
NORETURN void
#ifdef __STDC__
error (char *string, ...)
#else
error (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
if (error_hook)
error_hook (args); /* Never returns */
error_begin ();
string = va_arg (args, char *);
#endif
error_begin ();
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
va_end (args);
@ -318,14 +334,22 @@ error (va_alist)
/* VARARGS */
NORETURN void
#ifdef __STDC__
fatal (char *string, ...)
#else
fatal (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
string = va_arg (args, char *);
#endif
fprintf_unfiltered (gdb_stderr, "\ngdb: ");
vfprintf_unfiltered (gdb_stderr, string, args);
fprintf_unfiltered (gdb_stderr, "\n");
@ -338,14 +362,22 @@ fatal (va_alist)
/* VARARGS */
static void
#ifdef __STDC__
fatal_dump_core (char *string, ...)
#else
fatal_dump_core (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, string);
#else
char *string;
va_start (args);
string = va_arg (args, char *);
#endif
/* "internal error" is always correct, since GDB should never dump
core, no matter what the input. */
fprintf_unfiltered (gdb_stderr, "\ngdb internal error: ");
@ -843,19 +875,29 @@ gdb_print_address (addr, stream)
/* VARARGS */
int
#ifdef __STDC__
query (char *ctlstr, ...)
#else
query (va_alist)
va_dcl
#endif
{
va_list args;
char *ctlstr;
register int answer;
register int ans2;
int retval;
#ifdef __STDC__
va_start (args, ctlstr);
#else
char *ctlstr;
va_start (args);
ctlstr = va_arg (args, char *);
#endif
if (query_hook)
{
va_start (args);
return query_hook (args);
return query_hook (ctlstr, args);
}
/* Automatically answer "yes" if input is not from a terminal. */
@ -875,10 +917,7 @@ query (va_alist)
if (annotation_level > 1)
printf_filtered ("\n\032\032pre-query\n");
va_start (args);
ctlstr = va_arg (args, char *);
vfprintf_filtered (gdb_stdout, ctlstr, args);
va_end (args);
printf_filtered ("(y or n) ");
if (annotation_level > 1)
@ -1500,34 +1539,48 @@ vprintf_unfiltered (format, args)
/* VARARGS */
void
#ifdef __STDC__
fprintf_filtered (FILE *stream, char *format, ...)
#else
fprintf_filtered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
FILE *stream;
char *format;
va_start (args);
stream = va_arg (args, FILE *);
format = va_arg (args, char *);
#endif
vfprintf_filtered (stream, format, args);
va_end (args);
}
/* VARARGS */
void
#ifdef __STDC__
fprintf_unfiltered (FILE *stream, char *format, ...)
#else
fprintf_unfiltered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
FILE *stream;
char *format;
va_start (args);
stream = va_arg (args, FILE *);
format = va_arg (args, char *);
#endif
vfprintf_unfiltered (stream, format, args);
va_end (args);
}
@ -1537,10 +1590,17 @@ fprintf_unfiltered (va_alist)
/* VARARGS */
void
#ifdef __STDC__
fprintfi_filtered (int spaces, FILE *stream, char *format, ...)
#else
fprintfi_filtered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
int spaces;
FILE *stream;
char *format;
@ -1549,6 +1609,7 @@ fprintfi_filtered (va_alist)
spaces = va_arg (args, int);
stream = va_arg (args, FILE *);
format = va_arg (args, char *);
#endif
print_spaces_filtered (spaces, stream);
vfprintf_filtered (stream, format, args);
@ -1558,15 +1619,22 @@ fprintfi_filtered (va_alist)
/* VARARGS */
void
#ifdef __STDC__
printf_filtered (char *format, ...)
#else
printf_filtered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
char *format;
va_start (args);
format = va_arg (args, char *);
#endif
vfprintf_filtered (gdb_stdout, format, args);
va_end (args);
}
@ -1574,15 +1642,22 @@ printf_filtered (va_alist)
/* VARARGS */
void
#ifdef __STDC__
printf_unfiltered (char *format, ...)
#else
printf_unfiltered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
char *format;
va_start (args);
format = va_arg (args, char *);
#endif
vfprintf_unfiltered (gdb_stdout, format, args);
va_end (args);
}
@ -1592,16 +1667,24 @@ printf_unfiltered (va_alist)
/* VARARGS */
void
#ifdef __STDC__
printfi_filtered (int spaces, char *format, ...)
#else
printfi_filtered (va_alist)
va_dcl
#endif
{
va_list args;
#ifdef __STDC__
va_start (args, format);
#else
int spaces;
char *format;
va_start (args);
spaces = va_arg (args, int);
format = va_arg (args, char *);
#endif
print_spaces_filtered (spaces, gdb_stdout);
vfprintf_filtered (gdb_stdout, format, args);
va_end (args);