This is the mail archive of the
mailing list for the GDB project.
Re: format string is not a string literal
- From: <Paul_Koning at Dell dot com>
- To: <howarth dot mailing dot lists at gmail dot com>
- Cc: <gdb at sourceware dot org>
- Date: Wed, 25 Feb 2015 23:36:24 +0000
- 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>
> On Feb 25, 2015, at 6:21 PM, Jack Howarth <firstname.lastname@example.org> wrote:
> The clang developers disagree...
> On Tue, Feb 24, 2015 at 1:09 PM, <Paul_Koning@dell.com> wrote:
>>> On Feb 24, 2015, at 12:13 PM, Jack Howarth <email@example.com> wrote:
>>> Building gdb 7.9 on x86_64-apple-darwin14 produces a number of
>>> warnings from -Wformat-nonliteral...
>> Sounds like itâs time to turn off that warning, since the code is legit.
I didnât say itâs a bug, Andrew did. But I agree with him.
My comment (âthe code is legitâ) simply meant that GDB uses variable formats for obvious valid reasons (so the format can vary, being user-supplied). Given that itâs intentional, the warning is not wanted.
But that point is really applicable to printf, not vprintf. Andrewâs point is that checking formats for vprintf is not possible because you canât know the argument list; only in printf do you see the arguments so you can match the types. So the bug is that format checking and complaining for non-literal formats should not be enabled at all for vprintf. That may be a header issue rather than a compiler issue, but either way, itâs not the right thing to do.