This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: format string is not a string literal


>> On Feb 25, 2015, at 4:41 PM, Jack Howarth <howarth.mailing.lists@gmail.com> wrote:
>>
>> Andrew,
>>     See the additional comments from the llvm.org clang developers at...
>>
>> http://llvm.org/bugs/show_bug.cgi?id=22701#c5
>
> Then put this warning under a different flag. Anyways clang is broken and gdb should not change due to a broken compiler.
>
> Thanks,
> Andrew

I would not say that clang is broken or that the warning is unclear.
The flag is -Wformat-nonliteral and the warning message is "format
string is not a string  literal". I don't know how you can be more
clear and direct about the fact that the format string is not a string
literal. Looking at the code, we observe that clang is right (the
format string is indeed not a string literal). With the proper
function attributes, the compiler could do better checks and prevent
programming mistakes. Since clang pointed out this low-hanging fruit
improvement to gdb's code, why shouldn't we take advantage of it?

Anyway, Jack, you are welcome to submit a patch for this if you feel
like it and/or file a bug if it is not already done.

Simon


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