"format not a string literal"

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Oct 12 07:42:00 GMT 1999


 > From: Ulrich Drepper <drepper@cygnus.com>
 >  
 > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 >  
 > >       Does this gcc patch help out?  I'd be interested to know if
 > > any other false positives remain.
 >  
 > This solves the obvious problems.  There is still case:
 >  
 >         printf (gettext ("%s %d"), "foo", 42);
 >  
 > you have to take the functions registered using
 > `record_international_format' into account.


	Eh?  Did you actually try this?  I don't see a problem.


 > % gcc -v
 > Reading specs from /var/tmp/gcc-testing/build/gcc/specs
 > gcc version 2.96 19991008 (experimental)
 > 
 > % cat foo.c
 > 
 > #include <stdio.h>
 > extern char *gettext (const char *__msgid);
 > int main()
 > {
 >   printf (gettext("%s %d"), "foo", 42);
 >   return 0;
 > }
 > 
 > % gcc -c -W -Wall -Wformat foo.c
 > %


The code to find the format string in intl functions occurs before the
literal string check.  Please try rebuilding glibc with my gcc patch
and tell me of actual false positives with a code sample known to fail.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


More information about the Gcc-bugs mailing list