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; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<span class="terminalStyle1" style="font-weight: bold; ">/tmp/webcompile/_7230_0.cc:3:10: </span><span class="terminalStyle0"></span><span class="terminalStyle135" style="color: rgb(255, 0, 255); font-weight: bold; ">warning: </span><span class="terminalStyle0"></span><span class="terminalStyle1" style="font-weight: bold; ">address of function 'f1' will always evaluate to 'true' [-Wbool-conversions]</span><span class="terminalStyle0">
return f1;
</span><span class="terminalStyle132" style="color: green; font-weight: bold; "> ^~
</span><span class="terminalStyle0"></span><span class="terminalStyle1" style="font-weight: bold; ">/tmp/webcompile/_7230_0.cc:3:10: </span><span class="terminalStyle0"></span><span class="terminalStyle130" style="color: gray; font-weight: bold; ">note: </span><span class="terminalStyle0">prefix with the address-of operator to silence this warning</span><span class="terminalStyle0">
return f1;
</span><span class="terminalStyle132" style="color: green; font-weight: bold; "> ^
</span><span class="terminalStyle0"></span><span class="terminalStyle032" style="color: green; "> &
</span><span class="terminalStyle0"></span><span class="terminalStyle1" style="font-weight: bold; ">/tmp/webcompile/_7230_0.cc:3:10: </span><span class="terminalStyle0"></span><span class="terminalStyle130" style="color: gray; font-weight: bold; ">note: </span><span class="terminalStyle0">suffix with parentheses to turn this into a function call</span><span class="terminalStyle0">
return f1;
</span><span class="terminalStyle132" style="color: green; font-weight: bold; "> ^
</span><span class="terminalStyle0"></span><span class="terminalStyle032" 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>