format string is not a string literal

Paul Smith paul@mad-scientist.net
Thu Feb 26 18:34:00 GMT 2015


On Thu, 2015-02-26 at 09:52 +0000, Pedro Alves wrote:
> +  /* Use FMT from here on instead of complaint->fmt, to avoid "format
> +     string is not a string literal" warnings.  */
> +  gdb_assert (complaint->fmt == fmt);
> +
>    if (complaint->file != NULL)
> -    internal_vwarning (complaint->file, complaint->line, 
> -                      complaint->fmt, args);
> +    internal_vwarning (complaint->file, complaint->line, fmt, args);

Can someone quickly explain how using fmt instead of complaint->fmt here
removes the warning?  fmt is not a "string literal" either...?

Just curious what the trick is...



More information about the Gdb mailing list