aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog24
-rw-r--r--gdb/cli-out.c10
-rw-r--r--gdb/complaints.c4
-rw-r--r--gdb/defs.h29
-rw-r--r--gdb/disasm.c5
-rw-r--r--gdb/exceptions.c5
-rw-r--r--gdb/exceptions.h7
-rw-r--r--gdb/gdbserver/ChangeLog4
-rw-r--r--gdb/gdbserver/server.h6
-rw-r--r--gdb/mi/mi-interp.c5
-rw-r--r--gdb/mi/mi-out.c7
-rw-r--r--gdb/tui/tui-hooks.c4
-rw-r--r--gdb/tui/tui-out.c11
-rw-r--r--gdb/ui-out.c13
-rw-r--r--gdb/ui-out.h16
-rw-r--r--gdb/utils.c10
16 files changed, 105 insertions, 55 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0ce42ae..4a38761 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,27 @@
+2005-07-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cli-out.c (cli_field_fmt, cli_message, out_field_fmt): Add
+ ATTR_FORMAT or ATTRIBUTE_FPTR_PRINTF.
+ * complaints.c (vcomplaint): Likewise.
+ * defs.h (xvasprintf, xstrvprintf, verror, vfatal)
+ (internal_verror, internal_vwarning, vwarning)
+ (deprecated_query_hook, deprecated_warning_hook)
+ (deprecated_readline_begin_hook): Likewise.
+ * disasm.c (fprintf_disasm): Likewise.
+ * exceptions.c (throw_it): Likewise.
+ * exceptions.h (throw_verror, throw_vfatal): Likewise.
+ * mi/mi-interp.c (mi_interp_query_hook): Likewise.
+ * mi/mi-out.c (mi_field_fmt, mi_message): Likewise.
+ * tui/tui-hooks.c (tui_query_hook): Likewise.
+ * tui/tui-out.c (tui_field_fmt, tui_message, out_field_fmt):
+ Likewise.
+ * ui-out.c (default_field_fmt, default_message, uo_field_fmt)
+ (uo_message): Likewise.
+ * ui-out.h (ui_out_field_fmt, ui_out_message, field_fmt_ftype)
+ (message_ftype): Likewise.
+ * utils.c (vfprintf_maybe_filtered, internal_vproblem)
+ (defaulted_query, printchar): Likewise.
+
2005-07-26 Mark Kettenis <kettenis@gnu.org>
* i386obsd-tdep.c (i386obsd_sigreturn_offset): New variable.
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 5e6fc4e..a684918 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -1,6 +1,7 @@
/* Output generating routines for GDB CLI.
- Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003, 2005
+ Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -58,11 +59,12 @@ static void cli_field_string (struct ui_out *uiout, int fldno, int width,
static void cli_field_fmt (struct ui_out *uiout, int fldno,
int width, enum ui_align align,
const char *fldname, const char *format,
- va_list args);
+ va_list args) ATTR_FORMAT (printf, 6, 0);
static void cli_spaces (struct ui_out *uiout, int numspaces);
static void cli_text (struct ui_out *uiout, const char *string);
static void cli_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTR_FORMAT (printf, 3, 0);
static void cli_wrap_hint (struct ui_out *uiout, char *identstring);
static void cli_flush (struct ui_out *uiout);
static int cli_redirect (struct ui_out *uiout, struct ui_file *outstream);
@@ -101,7 +103,7 @@ static void field_separator (void);
static void out_field_fmt (struct ui_out *uiout, int fldno,
const char *fldname,
- const char *format,...);
+ const char *format,...) ATTR_FORMAT (printf, 4, 5);
/* local variables */
diff --git a/gdb/complaints.c b/gdb/complaints.c
index af4be51..9e44ad3 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -1,7 +1,7 @@
/* Support for complaint handling during symbol reading in GDB.
Copyright 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000, 2002,
- 2004 Free Software Foundation, Inc.
+ 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -166,7 +166,7 @@ static unsigned int stop_whining = 0;
/* Print a complaint, and link the complaint block into a chain for
later handling. */
-static void
+static void ATTR_FORMAT (printf, 4, 0)
vcomplaint (struct complaints **c, const char *file, int line, const char *fmt,
va_list args)
{
diff --git a/gdb/defs.h b/gdb/defs.h
index ac6e0ea..7548455 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -872,12 +872,14 @@ extern void *xzalloc (size_t);
/* Like asprintf/vasprintf but get an internal_error if the call
fails. */
extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3);
-extern void xvasprintf (char **ret, const char *format, va_list ap);
+extern void xvasprintf (char **ret, const char *format, va_list ap)
+ ATTR_FORMAT (printf, 2, 0);
/* Like asprintf and vasprintf, but return the string, throw an error
if no memory. */
extern char *xstrprintf (const char *format, ...) ATTR_FORMAT (printf, 1, 2);
-extern char *xstrvprintf (const char *format, va_list ap);
+extern char *xstrvprintf (const char *format, va_list ap)
+ ATTR_FORMAT (printf, 1, 0);
/* Like snprintf, but throw an error if the output buffer is too small. */
extern int xsnprintf (char *str, size_t size, const char *format, ...)
@@ -897,24 +899,28 @@ extern char *quit_pre_print;
extern char *warning_pre_print;
-extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN;
+extern NORETURN void verror (const char *fmt, va_list ap)
+ ATTR_NORETURN ATTR_FORMAT (printf, 1, 0);
extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
-extern NORETURN void vfatal (const char *fmt, va_list ap) ATTR_NORETURN;
+extern NORETURN void vfatal (const char *fmt, va_list ap)
+ ATTR_NORETURN ATTR_FORMAT (printf, 1, 0);
extern NORETURN void fatal (const char *fmt, ...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
extern NORETURN void internal_verror (const char *file, int line,
- const char *, va_list ap) ATTR_NORETURN;
+ const char *, va_list ap)
+ ATTR_NORETURN ATTR_FORMAT (printf, 3, 0);
extern NORETURN void internal_error (const char *file, int line,
const char *, ...) ATTR_NORETURN ATTR_FORMAT (printf, 3, 4);
extern void internal_vwarning (const char *file, int line,
- const char *, va_list ap);
+ const char *, va_list ap)
+ ATTR_FORMAT (printf, 3, 0);
extern void internal_warning (const char *file, int line,
const char *, ...) ATTR_FORMAT (printf, 3, 4);
@@ -923,7 +929,7 @@ extern NORETURN void nomem (long) ATTR_NORETURN;
extern void warning (const char *, ...) ATTR_FORMAT (printf, 1, 2);
-extern void vwarning (const char *, va_list args);
+extern void vwarning (const char *, va_list args) ATTR_FORMAT (printf, 1, 0);
/* List of known OS ABIs. If you change this, make sure to update the
table in osabi.c. */
@@ -1092,15 +1098,18 @@ extern void (*deprecated_print_frame_info_listing_hook) (struct symtab * s,
int line, int stopline,
int noerror);
extern struct frame_info *parse_frame_specification (char *frame_exp);
-extern int (*deprecated_query_hook) (const char *, va_list);
-extern void (*deprecated_warning_hook) (const char *, va_list);
+extern int (*deprecated_query_hook) (const char *, va_list)
+ ATTRIBUTE_FPTR_PRINTF(1,0);
+extern void (*deprecated_warning_hook) (const char *, va_list)
+ ATTRIBUTE_FPTR_PRINTF(1,0);
extern void (*deprecated_flush_hook) (struct ui_file * stream);
extern void (*deprecated_create_breakpoint_hook) (struct breakpoint * b);
extern void (*deprecated_delete_breakpoint_hook) (struct breakpoint * bpt);
extern void (*deprecated_modify_breakpoint_hook) (struct breakpoint * bpt);
extern void (*deprecated_interactive_hook) (void);
extern void (*deprecated_registers_changed_hook) (void);
-extern void (*deprecated_readline_begin_hook) (char *,...);
+extern void (*deprecated_readline_begin_hook) (char *, ...)
+ ATTRIBUTE_FPTR_PRINTF_1;
extern char *(*deprecated_readline_hook) (char *);
extern void (*deprecated_readline_end_hook) (void);
extern void (*deprecated_register_changed_hook) (int regno);
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 4126f72..0a7c96c 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1,6 +1,7 @@
/* Disassemble support for GDB.
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -313,7 +314,7 @@ do_assembly_only (struct ui_out *uiout, struct disassemble_info * di,
/* Initialize the disassemble info struct ready for the specified
stream. */
-static int
+static int ATTR_FORMAT (printf, 2, 3)
fprintf_disasm (void *stream, const char *format, ...)
{
va_list args;
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index de01266..014524f 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -373,10 +373,7 @@ print_any_exception (struct ui_file *file, const char *prefix,
}
}
-NORETURN static void
-throw_it (enum return_reason reason, enum errors error, const char *fmt,
- va_list ap) ATTR_NORETURN;
-NORETURN static void
+NORETURN static void ATTR_NORETURN ATTR_FORMAT (printf, 3, 0)
throw_it (enum return_reason reason, enum errors error, const char *fmt,
va_list ap)
{
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index c722503..81c0313 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -160,9 +160,10 @@ extern void exception_fprintf (struct ui_file *file, struct gdb_exception e,
Wombat. */
extern NORETURN void throw_exception (struct gdb_exception exception) ATTR_NORETURN;
-extern NORETURN void throw_verror (enum errors, const char *fmt,
- va_list ap) ATTR_NORETURN;
-extern NORETURN void throw_vfatal (const char *fmt, va_list ap) ATTR_NORETURN;
+extern NORETURN void throw_verror (enum errors, const char *fmt, va_list ap)
+ ATTR_NORETURN ATTR_FORMAT (printf, 2, 0);
+extern NORETURN void throw_vfatal (const char *fmt, va_list ap)
+ ATTR_NORETURN ATTR_FORMAT (printf, 1, 0);
extern NORETURN void throw_error (enum errors error, const char *fmt,
...) ATTR_NORETURN ATTR_FORMAT (printf, 2, 3);
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index be0023e..b19a328 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2005-07-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * server.h (error, fatal, warning): Add ATTR_FORMAT.
+
2005-07-13 Daniel Jacobowitz <dan@codesourcery.com>
* configure.ac: Define HAVE_LINUX_REGSETS even if PTRACE_GETREGS
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 0840de1..ebd0fea 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -163,9 +163,9 @@ int target_signal_to_host (enum target_signal oursig);
/* Functions from utils.c */
void perror_with_name (char *string);
-void error (const char *string,...) ATTR_NORETURN;
-void fatal (const char *string,...) ATTR_NORETURN;
-void warning (const char *string,...);
+void error (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
+void fatal (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
+void warning (const char *string,...) ATTR_FORMAT (printf, 1, 2);
/* Functions from the register cache definition. */
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index c46640d..cb4c49e 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1,6 +1,6 @@
/* MI Interpreter Definitions and Commands for GDB, the GNU debugger.
- Copyright 2002, 2003, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -55,7 +55,8 @@ static void mi_command_loop (int mi_version);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the mi's
back" in this command */
-static int mi_interp_query_hook (const char *ctlstr, va_list ap);
+static int mi_interp_query_hook (const char *ctlstr, va_list ap)
+ ATTR_FORMAT (printf, 1, 0);
static void mi3_command_loop (void);
static void mi2_command_loop (void);
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 361cf69..98c2f1d 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -1,6 +1,6 @@
/* MI Command Set - output generating routines.
- Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
@@ -56,11 +56,12 @@ static void mi_field_string (struct ui_out *uiout, int fldno, int width,
static void mi_field_fmt (struct ui_out *uiout, int fldno,
int width, enum ui_align align,
const char *fldname, const char *format,
- va_list args);
+ va_list args) ATTR_FORMAT (printf, 6, 0);
static void mi_spaces (struct ui_out *uiout, int numspaces);
static void mi_text (struct ui_out *uiout, const char *string);
static void mi_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTR_FORMAT (printf, 3, 0);
static void mi_wrap_hint (struct ui_out *uiout, char *identstring);
static void mi_flush (struct ui_out *uiout);
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 91129be..8c906c5 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -1,6 +1,6 @@
/* GDB hooks for TUI.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -70,7 +70,7 @@ tui_new_objfile_hook (struct objfile* objfile)
tui_target_new_objfile_chain (objfile);
}
-static int
+static int ATTR_FORMAT (printf, 1, 0)
tui_query_hook (const char * msg, va_list argp)
{
int retval;
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index 1c2af68..546599b 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -1,7 +1,7 @@
/* Output generating routines for GDB CLI.
- Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
- Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -60,11 +60,12 @@ static void tui_field_string (struct ui_out *uiout, int fldno, int width,
static void tui_field_fmt (struct ui_out *uiout, int fldno,
int width, enum ui_align align,
const char *fldname, const char *format,
- va_list args);
+ va_list args) ATTR_FORMAT (printf, 6, 0);
static void tui_spaces (struct ui_out *uiout, int numspaces);
static void tui_text (struct ui_out *uiout, const char *string);
static void tui_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTR_FORMAT (printf, 3, 0);
static void tui_wrap_hint (struct ui_out *uiout, char *identstring);
static void tui_flush (struct ui_out *uiout);
@@ -102,7 +103,7 @@ static void field_separator (void);
static void out_field_fmt (struct ui_out *uiout, int fldno,
const char *fldname,
- const char *format,...);
+ const char *format,...) ATTR_FORMAT (printf, 4, 5);
/* local variables */
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index f59eecc..6e14d09 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -1,6 +1,7 @@
/* Output generating routines for GDB.
- Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2004, 2005
+ Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -178,12 +179,12 @@ static void default_field_fmt (struct ui_out *uiout, int fldno,
int width, enum ui_align align,
const char *fldname,
const char *format,
- va_list args);
+ va_list args) ATTR_FORMAT (printf, 6, 0);
static void default_spaces (struct ui_out *uiout, int numspaces);
static void default_text (struct ui_out *uiout, const char *string);
static void default_message (struct ui_out *uiout, int verbosity,
const char *format,
- va_list args);
+ va_list args) ATTR_FORMAT (printf, 3, 0);
static void default_wrap_hint (struct ui_out *uiout, char *identstring);
static void default_flush (struct ui_out *uiout);
@@ -248,11 +249,13 @@ static void uo_field_string (struct ui_out *uiout, int fldno, int width,
const char *string);
static void uo_field_fmt (struct ui_out *uiout, int fldno, int width,
enum ui_align align, const char *fldname,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTR_FORMAT (printf, 6, 0);
static void uo_spaces (struct ui_out *uiout, int numspaces);
static void uo_text (struct ui_out *uiout, const char *string);
static void uo_message (struct ui_out *uiout, int verbosity,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTR_FORMAT (printf, 3, 0);
static void uo_wrap_hint (struct ui_out *uiout, char *identstring);
static void uo_flush (struct ui_out *uiout);
static int uo_redirect (struct ui_out *uiout, struct ui_file *outstream);
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 5e19aff..06e56af 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -1,5 +1,8 @@
/* Output generating routines for GDB.
- Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
+
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
@@ -123,7 +126,8 @@ extern void ui_out_field_stream (struct ui_out *uiout, const char *fldname,
struct ui_stream *buf);
extern void ui_out_field_fmt (struct ui_out *uiout, const char *fldname,
- const char *format, ...);
+ const char *format, ...)
+ ATTR_FORMAT (printf, 3, 4);
extern void ui_out_field_skip (struct ui_out *uiout, const char *fldname);
@@ -132,7 +136,8 @@ extern void ui_out_spaces (struct ui_out *uiout, int numspaces);
extern void ui_out_text (struct ui_out *uiout, const char *string);
extern void ui_out_message (struct ui_out *uiout, int verbosity,
- const char *format, ...);
+ const char *format, ...)
+ ATTR_FORMAT (printf, 3, 4);
extern struct ui_stream *ui_out_stream_new (struct ui_out *uiout);
@@ -223,12 +228,13 @@ typedef void (field_fmt_ftype) (struct ui_out * uiout, int fldno, int width,
enum ui_align align,
const char *fldname,
const char *format,
- va_list args);
+ va_list args) ATTRIBUTE_FPTR_PRINTF(6,0);
typedef void (spaces_ftype) (struct ui_out * uiout, int numspaces);
typedef void (text_ftype) (struct ui_out * uiout,
const char *string);
typedef void (message_ftype) (struct ui_out * uiout, int verbosity,
- const char *format, va_list args);
+ const char *format, va_list args)
+ ATTRIBUTE_FPTR_PRINTF(3,0);
typedef void (wrap_hint_ftype) (struct ui_out * uiout, char *identstring);
typedef void (flush_ftype) (struct ui_out * uiout);
typedef int (redirect_ftype) (struct ui_out * uiout,
diff --git a/gdb/utils.c b/gdb/utils.c
index 690f87c..bca32a9 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -80,7 +80,7 @@ void (*deprecated_error_begin_hook) (void);
/* Prototypes for local functions */
static void vfprintf_maybe_filtered (struct ui_file *, const char *,
- va_list, int);
+ va_list, int) ATTR_FORMAT (printf, 2, 0);
static void fputs_maybe_filtered (const char *, struct ui_file *, int);
@@ -693,7 +693,7 @@ struct internal_problem
has been reported, and assuming GDB didn't quit, the caller can
either allow execution to resume or throw an error. */
-static void
+static void ATTR_FORMAT (printf, 4, 0)
internal_vproblem (struct internal_problem *problem,
const char *file, int line, const char *fmt, va_list ap)
{
@@ -1236,7 +1236,7 @@ query (const char *ctlstr, ...)
ARGS are the arguments passed along with the CTLSTR argument to
printf. */
-static int
+static int ATTR_FORMAT (printf, 1, 0)
defaulted_query (const char *ctlstr, const char defchar, va_list args)
{
int answer;
@@ -1495,8 +1495,8 @@ parse_escape (char **string_ptr)
static void
printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
- void (*do_fprintf) (struct ui_file *, const char *, ...),
- struct ui_file *stream, int quoter)
+ void (*do_fprintf) (struct ui_file *, const char *, ...)
+ ATTRIBUTE_FPTR_PRINTF_2, struct ui_file *stream, int quoter)
{
c &= 0xFF; /* Avoid sign bit follies */