<div class="gmail_quote">2011/7/14 Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word">We should probably not emit a -Wunused-[x] warning in cases where a function doesn't fully parse correctly. Please file a bug.<br><div><br></div></div></blockquote><div><br>Done: <a href="http://llvm.org/bugs/show_bug.cgi?id=10371">http://llvm.org/bugs/show_bug.cgi?id=10371</a><br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;"><div><div><div><div></div><div class="h5"><div>On Jul 14, 2011, at 12:34 PM, Matthieu Monrocq wrote:</div>
<br></div></div><blockquote type="cite"><div><div></div><div class="h5">Hello clang,<br><br>I made a strange discovery with a small helper function I wrote:<br><br>If one test the following (short) program:<br><br><div style="margin-left:40px">
<span style="font-family:courier new,monospace">struct A;</span><br style="font-family:courier new,monospace">
<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">void sink(A,int);</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">void func(A const& a, int x, int y) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> sink(a + x, y);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br></div><br>The following errors get emitted:<br>
<br><div style="margin-left:40px"><span style="font-family:courier new,monospace">$ clang -fsyntax-only -Wunused-parameter unused_parameter.cpp</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">unused_parameter.cpp:15:11: error: invalid operands to binary expression ('const A' and 'int')</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> sink(a + x, y);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> ~ ^ ~</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">unused_parameter.cpp:14:34: warning: unused parameter 'y' [-Wunused-parameter]</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">void func(A const& a, int x, int y) {</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> ^</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">1 warning and 1 error generated.</span><br>
</div><br><br>The first one is expected, however it seems its presence somehow short-circuit the analysis of the whole expression and as a result we get the spurious warning...<br><br>I feel that this is unwelcome, because it obfuscates the true error (especially since I tend to compile with -Werror).<br>
<br><br>For reference, I use the following version of Clang:<br><br>$ clang --version<br>clang version 3.0 (trunk 132889)<br>Target: i686-pc-mingw32<br>Thread model: posix<br><br>I could not find any mention of such an issue with my Google-fu in the cfe-dev archive, so please let me know if it already came up and it was deemed unimportant.<br>
<br>-- Matthieu<br></div></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br>