[PATCH 3/3] main: Annotate format string args on new *_utf8 functions

Kevin Cernekee cernekee at gmail.com
Sun Dec 7 11:33:17 PST 2014


On Sun, Dec 7, 2014 at 11:12 AM, David Woodhouse <dwmw2 at infradead.org> wrote:
> On Sat, 2014-12-06 at 23:01 -0800, Kevin Cernekee wrote:
>> The new charset translation functions need to use caller-supplied format
>> strings; this change corrects the following warnings:
>>
>>       CC       openconnect-main.o
>>     main.c:422:22: warning: format string is not a string literal
>>           [-Wformat-nonliteral]
>>                     return vfprintf(f, fmt, args);
>>                                        ^~~
>>     main.c:424:29: warning: format string is not a string literal
>>           [-Wformat-nonliteral]
>>             ret = vasprintf(&utf8_str, fmt, args);
>>                                        ^~~
>
>
> Hm, I could have sworn we couldn't shut it up because of
> http://llvm.org/bugs/show_bug.cgi?id=18982

My first impulse was to just nuke -Wformat-nonliteral, but then I ran
across this:

http://stackoverflow.com/questions/20167124/vsprintf-and-vsnprintf-wformat-nonliteral-warning-on-clang-5-0

and realized it is OK to pass 0 as the "first-to-check" parameter.



More information about the openconnect-devel mailing list