This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: FYI: fix PR 11345
>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
Pedro> gcc -g3 -O0 -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../src/gdb/gnulib -Ignulib -DMI_OUT=1 -DTUI=1 `echo " -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts " | sed "s/ -Wformat-nonliteral / /g"` \
Pedro> -Werror -c -o printcmd.o -MT printcmd.o -MMD -MP -MF .deps/printcmd.Tpo ../../src/gdb/printcmd.c
Pedro> cc1: warnings being treated as errors
Pedro> ../../src/gdb/printcmd.c: In function 'printf_command':
Pedro> ../../src/gdb/printcmd.c:2649: error: format not a string literal and no format arguments
BTW, what version of gcc is this? I couldn't reproduce it.
My gcc (F11 system) doesn't warn, and svn trunk gcc has:
if (params == 0 && warn_format_security)
warning (OPT_Wformat_security,
"format not a string literal and no format arguments");
else if (params == 0 && warn_format_nonliteral)
warning (OPT_Wformat_nonliteral,
"format not a string literal and no format arguments");
We explicitly don't pass -Wformat-nonliteral for this file, and I don't
see -Wformat-security in there...
Could you try Doug's suggestion?
printf_filtered (last_arg, 0);
If that doesn't work I will write a loop using strstr.
Tom