Patch for format non-literal warnings
Richard Henderson
rth@cygnus.com
Fri Dec 31 16:38:00 GMT 1999
On Sun, Dec 26, 1999 at 09:19:30AM -0500, Kaveh R. Ghazi wrote:
> if (p > _(msgid)) /* Print the left-hand substring. */
> - {
> - char fmt[sizeof "%.255s"];
> - long width = p - _(msgid);
> -
> - if (width > 255L) width = 255L; /* arbitrary */
> - sprintf (fmt, "%%.%lds", width);
> - fprintf (stderr, fmt, _(msgid));
> - }
> + fprintf (stderr, "%.*s", (int)(p - _(msgid)), _(msgid));
This is probably ok, though I wonder if we'll run into
trouble with old libcs...
> - fprintf (file, buf, va_arg (argptr, int));
> + vfprintf (file, buf, argptr);
This is not a valid replacement. The later does not (always) consume
an argument from the local `argptr'.
r~
More information about the Gcc-patches
mailing list