This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: format string is not a string literal
- From: Paul Smith <paul at mad-scientist dot net>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Jack Howarth <howarth dot mailing dot lists at gmail dot com>, pinskia at gmail dot com, Simon Marchi <simon dot marchi at polymtl dot ca>, "Paul_Koning at dell dot com" <Paul_Koning at dell dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 26 Feb 2015 12:44:02 -0500
- Subject: Re: format string is not a string literal
- Authentication-results: sourceware.org; auth=none
- References: <CADtEn-1ZT1uznxPzQxr_nBQya1AVrNLyE+ZSDmm2x_ux8qyzUQ at mail dot gmail dot com> <0AB56024-875B-4724-8ED2-A9DDB237CBFF at dell dot com> <CADtEn-0txdtq6x6dAZZ5wew-VOvYU28fueT_kJ2cx7=H0=vdPg at mail dot gmail dot com> <23CC7871-C616-436C-920C-4A635DC87189 at dell dot com> <CAFXXi0=56gNf2GoSKkrx=bRArhjk+AhSbiu0crpdR3=df7B2BQ at mail dot gmail dot com> <7A311B56-C424-4C4F-A0E4-B12B65131745 at gmail dot com> <CADtEn-1vHnay=ftK9Hq6ogYyDNPc_anNgLnwuUZSt4VjzF+7GQ at mail dot gmail dot com> <54EEECD9 dot 4050909 at redhat dot com>
- Reply-to: paul at mad-scientist dot net
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...