Patch to fix legit "format not a string literal" warnings part 2/2

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sun Oct 31 23:33:00 GMT 1999


 > You might want to make sure that `buf' will be null terminated, even
 > if `length' is a negative number, because `ident_subst' will try to
 > take the length of `buf' right away.
 >  
 > So, I would suggest:
 >  
 >   diff -rup orig/egcs-CVS19991010/gcc/java/typeck.c
 >   egcs-CVS19991010/gcc/java/ty
 > peck.c
 >   --- orig/egcs-CVS19991010/gcc/java/typeck.c     Tue Aug 10 12:58:13
 >   1999
 >   +++ egcs-CVS19991010/gcc/java/typeck.c  Mon Oct 11 11:51:52 1999
 >   @@ -374,7 +374,9 @@ build_java_array_type (element_type, len
 >      char buf[12];
 >      tree elsig = build_java_signature (element_type);
 >      tree el_name = element_type;
 >   -  sprintf (buf, length >= 0 ? "[%d" : "[", length);
 >   +  buf[0] = '[';
 >   +  if (length >= 0)
 >   +    sprintf (buf+1, HOST_WIDE_INT_PRINT_DEC, length);
 >   +  else
 >   +    buf [1] = `\0';
 >      sig = ident_subst (IDENTIFIER_POINTER (elsig), IDENTIFIER_LENGTH
 >   (elsig),
 >                        buf, 0, 0, "");
 >      t = IDENTIFIER_SIGNATURE_TYPE (sig);
 >  
 > Otherwise, the rest looks OK. I don't really have the time to
 > bootstrap
 > it, but the Java changes seem to be reasonably straightforward.
 > Thank you for your contribution.
 > ./A

Okay I made the change you suggested and installed the java portions.
Thanks for reviewing it.

		--Kaveh


PS: the non-java portions still need a review.... :-)

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



More information about the Gcc-patches mailing list