<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - bogus "format string is not a string literal" warnings"
href="http://llvm.org/bugs/show_bug.cgi?id=22701">bug 22701</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - bogus "format string is not a string literal" warnings"
href="http://llvm.org/bugs/show_bug.cgi?id=22701#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - bogus "format string is not a string literal" warnings"
href="http://llvm.org/bugs/show_bug.cgi?id=22701">bug 22701</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>That analysis is wrong.
<span class="quote">> Looks like a clang bug because vprintf takes a format and an va_arg
> type which means there is no way to tell what the format is going to
> look into.</span >
The warning is that a string of unknown origin is being used as a format
string. Warning about this doesn't require knowing what the arguments are.
<span class="quote">> > remote.c:6986:37: warning: format string is not a string literal
> > [-Wformat-nonliteral]
> > if (vsnprintf (rs->buf, max_size, format, ap) >= max_size)
> > ^~~~~~
> > /usr/include/secure/_stdio.h:75:63: note: expanded from macro 'vsnprintf'
> > __builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
>
> See how they even warn about their own header too.</span >
That warning is about a possible misuse of vsnprintf within remote.c. And
neither remote.c nor secure/_stdio.h is "[our] own header".
Consider a case like:
va_list va;
/*...*/
const char *p = gets(); // or read from network or whatever
vprintf(p, va);
We do not need to know *anything* about the va_list to see that this is broken.
If you don't want us to check that you use format strings that can trivially be
shown to be "valid", then turn off -Wformat-nonliteral.
But in this case, the right thing to do is to annotate inferior_debug with
__attribute__((format(printf, 2, 3))).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>