FYI: fix PR 11345

Tom Tromey tromey@redhat.com
Thu Mar 4 18:21:00 GMT 2010


>>>>> "Doug" == Doug Evans <dje@google.com> writes:

Doug> I was explicitly turning on the warning.

On irc, Doug clarified that this was -Wformat=2.

Doug> If we adopt the rule that this file can't be compiled with that
Doug> warning, that's different.

Yeah, this file can't be compiled with -Wformat-nonliteral or anything
that implies it, like -Wformat=2.

I am checking in the appended to the trunk and the 7.1 branch.
Pedro verified that it works for him, and I also verified it locally
by passing -Wformat-security explicitly.

Tom

2010-03-04  Tom Tromey  <tromey@redhat.com>

	* printcmd.c (printf_command): Pass dummy argument to
	printf_filtered.

Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.171
diff -u -r1.171 printcmd.c
--- printcmd.c	3 Mar 2010 18:05:04 -0000	1.171
+++ printcmd.c	4 Mar 2010 18:16:15 -0000
@@ -2645,8 +2645,10 @@
     /* Print the portion of the format string after the last argument.
        Note that this will not include any ordinary %-specs, but it
        might include "%%".  That is why we use printf_filtered and not
-       puts_filtered here.  */
-    printf_filtered (last_arg);
+       puts_filtered here.  Also, we pass a dummy argument because
+       some platforms have modified GCC to include -Wformat-security
+       by default, which will warn here if there is no argument.  */
+    printf_filtered (last_arg, 0);
   }
   do_cleanups (old_cleanups);
 }



More information about the Gdb-patches mailing list