[ob] More warnings; Call for assistance

Jim Blandy jimb@red-bean.com
Tue Jan 17 19:37:00 GMT 2006


Looking at the printcmd.c warnings, there's the following note in Makefile.in:

# FIXME: cagney/2003-08-10: Do not try to build "printcmd.c" with
# -Wformat-nonliteral.  It needs to be overhauled so that it doesn't
# pass user input strings as the format parameter to host printf
# function calls.
printcmd.o: $(srcdir)/printcmd.c
	$(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $(srcdir)/printcmd.c

I gather what this is suggesting is that we have a big switch
selecting an appropriate call to printf that uses a fixed format
string.

There will be dozens of cases there, due to the modifiers (h, l, ll,
precision, leading sign, alternative form).  The precisions will need
to be parsed when present; sometimes they are minimum values,
sometimes they are maximum values.  Since we check the number and type
of the arguments, I think -Wformat-nonliteral is the right answer
here.  I don't see a benefit to making this change that justifies the
risk of mistakes.

What do folks think?



More information about the Gdb-patches mailing list