Re: format string is not a string literal

Paul Smith
2015-02-26T17:44:20Z

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...