This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch for format non-literal warnings


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]