This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] More -Wformat-nonlit
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 04 Aug 2003 22:43:35 -0400
- Subject: [commit] More -Wformat-nonlit
This fixes a few more format-nonliteral warnings. The one to note is
monitor_printf. While that looks like any other printf, it's using a
custom format parser -> it shouldn't have ATTRIB_FORMAT.
committed,
Andrew
2003-08-04 Andrew Cagney <cagney@redhat.com>
* monitor.h (monitor_dump_reg_block): Remove ATTR_FORMAT.
* cli/cli-script.c (define_command): Call query directly, instead
of passing it a buffer.
* ocd.c (ocd_error): Pass error a constant format string.
* remote-mips.c (mips_error): Use fputs_filtered.
Index: monitor.h
===================================================================
RCS file: /cvs/src/src/gdb/monitor.h,v
retrieving revision 1.11
diff -u -r1.11 monitor.h
--- monitor.h 12 Apr 2003 17:41:25 -0000 1.11
+++ monitor.h 5 Aug 2003 02:29:56 -0000
@@ -245,8 +245,12 @@
extern char *monitor_supply_register (int regno, char *valstr);
extern int monitor_expect (char *prompt, char *buf, int buflen);
extern int monitor_expect_prompt (char *buf, int buflen);
-extern void monitor_printf (char *, ...) ATTR_FORMAT (printf, 1, 2);
-extern void monitor_printf_noecho (char *, ...) ATTR_FORMAT (printf, 1, 2);
+/* Note: The variable argument functions monitor_printf and
+ monitor_printf_noecho vararg do not take take standard format style
+ arguments. Instead they take custom formats interpretered directly
+ by monitor_vsprintf. */
+extern void monitor_printf (char *, ...);
+extern void monitor_printf_noecho (char *, ...);
extern void monitor_write (char *buf, int buflen);
extern int monitor_readchar (void);
extern char *monitor_get_dev_name (void);
Index: ocd.c
===================================================================
RCS file: /cvs/src/src/gdb/ocd.c,v
retrieving revision 1.25
diff -u -r1.25 ocd.c
--- ocd.c 11 Jun 2003 13:16:28 -0000 1.25
+++ ocd.c 5 Aug 2003 02:29:56 -0000
@@ -146,7 +146,7 @@
s = buf;
}
- error (s);
+ error ("%s", s);
}
/* Return nonzero if the thread TH is still alive on the remote system. */
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.36
diff -u -r1.36 remote-mips.c
--- remote-mips.c 11 Jun 2003 13:16:28 -0000 1.36
+++ remote-mips.c 5 Aug 2003 02:29:59 -0000
@@ -483,7 +483,7 @@
wrap_here (""); /* Force out any buffered output */
gdb_flush (gdb_stdout);
if (error_pre_print)
- fprintf_filtered (gdb_stderr, error_pre_print);
+ fputs_filtered (error_pre_print, gdb_stderr);
vfprintf_filtered (gdb_stderr, string, args);
fprintf_filtered (gdb_stderr, "\n");
va_end (args);
Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.17
diff -u -r1.17 cli-script.c
--- cli/cli-script.c 8 Jun 2003 18:27:14 -0000 1.17
+++ cli/cli-script.c 5 Aug 2003 02:30:02 -0000
@@ -1092,11 +1092,12 @@
if (c)
{
+ int q;
if (c->class == class_user || c->class == class_alias)
- tem = "Redefine command \"%s\"? ";
+ q = query ("Redefine command \"%s\"? ", c->name);
else
- tem = "Really redefine built-in command \"%s\"? ";
- if (!query (tem, c->name))
+ q = query ("Really redefine built-in command \"%s\"? ", c->name);
+ if (!q)
error ("Command \"%s\" not redefined.", c->name);
}