Very cool. Thanks Dave!<br><br><div class="gmail_quote">On Thu, Dec 8, 2011 at 7:43 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Just adding some finishing touches to Lang's recent excursion into the front end by adding notes to describe how to suppress (and in simple cases, fix) the warning<br><br><pre style="color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;word-spacing:0px">
<span style="font-weight:bold">/tmp/webcompile/_7230_0.cc:3:10: </span><span></span><span style="color:rgb(255,0,255);font-weight:bold">warning: </span><span></span><span style="font-weight:bold">address of function 'f1' will always evaluate to 'true' [-Wbool-conversions]</span><span>
return f1;
</span><span style="color:green;font-weight:bold"> ^~
</span><span></span><span style="font-weight:bold">/tmp/webcompile/_7230_0.cc:3:10: </span><span></span><span style="color:gray;font-weight:bold">note: </span><span>prefix with the address-of operator to silence this warning</span><span>
return f1;
</span><span style="color:green;font-weight:bold"> ^
</span><span></span><span style="color:green"> &
</span><span></span><span style="font-weight:bold">/tmp/webcompile/_7230_0.cc:3:10: </span><span></span><span style="color:gray;font-weight:bold">note: </span><span>suffix with parentheses to turn this into a function call</span><span>
return f1;
</span><span style="color:green;font-weight:bold"> ^
</span><span></span><span style="color:green"> ()</span></pre>The latter note is only included if the function has a bool return and no arguments (I couldn't figure out how to account for default or variadic arguments - suggestions welcome. Also for bool conversion) so this is fairly simple.<br>
<br>I updated the test cases, added a couple, though in the interests of reducing noise I just -Wno-bool-conversions on one of the unrelated test files that happened to trigger this warning alot.<br><br>Oh, one other question - the quoting of 'true' in this warning is inconsistent with another warning I saw "self-comparison always evaluates to false" - which do you think we should prefer/use?<br>
<br>Thanks,<br>- David<br>
</blockquote></div><br>