Boost C++ Libraries: Ticket #8531: [Coverity] boost/function/function_template.hpp: spurious warnings https://svn.boost.org/trac10/ticket/8531 <p> This was found in an older release, but is still present in trunk. </p> <p> Coverity complains </p> <pre class="wiki">(1) Event pointless_expression: The expression "false /* mpl_::bool_&lt;false&gt;::value */ &amp;&amp; false /* mpl_::bool_&lt;false&gt;::value */" does not accomplish anything because it evaluates to either of its identical operands, "false /* mpl_::bool_&lt;false&gt;::value */". Did you intend the operands to be different? 938 if (boost::has_trivial_copy_constructor&lt;Functor&gt;::value &amp;&amp; 939 boost::has_trivial_destructor&lt;Functor&gt;::value &amp;&amp; 940 detail::function::function_allows_small_object_optimization&lt;Functor&gt;::value) </pre><p> And a similar error near line 973. </p> <p> It complains very loudly indeed; every use of assign_to generates this warning. Until Coverity sprouts a suppression file feature like Valgrind has, putting an annotation in the source is the way to make Coverity shut up about this. The attached patch does that. </p> <p> To reproduce (assuming you have a Coverity license, and bjam installed in ~/local/bin): </p> <pre class="wiki">cd ~/boost-trunk/libs/functions/tests PATH=/opt/coverity/cov-analysis-linux64-6.5.1/bin:$HOME/local/bin:$PATH cov-configure --gcc rm -rf covlog mkdir -p covlog cov-build --dir covlog bjam cov-analyze --dir covlog cov-format-errors --dir covlog </pre><p> Then look at covlog/c/output/errors/index.html in a web browser. If you see a bunch of errors like </p> <p> CONSTANT_EXPRESSION_RESULT .../boost/function/function_template.hpp </p> <p> then you have the problem. The attached patch makes those warnings go away (and reduces the number of warnings in this test from 169 to 79). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8531 Trac 1.4.3 Dan Kegel <dank@…> Wed, 01 May 2013 00:41:51 GMT attachment set https://svn.boost.org/trac10/ticket/8531 https://svn.boost.org/trac10/ticket/8531 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-function2.patch</span> </li> </ul> <p> Draft patch to silence spurious warnings </p> Ticket Jeffrey Walton <noloader@…> Thu, 25 Jul 2013 06:21:05 GMT <link>https://svn.boost.org/trac10/ticket/8531#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8531#comment:1</guid> <description> <blockquote class="citation"> <p> To reproduce (assuming you have a Coverity license...) </p> </blockquote> <p> Coverity offers its scanning service gratis to open and free projects. Boost can sign up for an account at <a class="ext-link" href="http://scan.coverity.com/projects"><span class="icon">​</span>http://scan.coverity.com/projects</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 30 Jan 2014 18:51:49 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/8531#comment:2 https://svn.boost.org/trac10/ticket/8531#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">Marshall Clow</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Marshall Clow Sat, 01 Feb 2014 04:16:42 GMT <link>https://svn.boost.org/trac10/ticket/8531#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8531#comment:3</guid> <description> <p> Fixed on develop in commit 9f06e35e8d8e886b87e7f3ddf846e59a2c282613 </p> <p> Will close when merged to master. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Mon, 03 Feb 2014 22:10:10 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8531#comment:4 https://svn.boost.org/trac10/ticket/8531#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Merged to master in commit a80ac7f5c560911ebedabafe4016df57a9cf3a63 </p> Ticket James E. King, III <jim.king@…> Fri, 29 Jul 2016 12:33:38 GMT <link>https://svn.boost.org/trac10/ticket/8531#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8531#comment:5</guid> <description> <p> Hi, this was merged to master however the ticket was not updated with a release milestone or marked as closed. </p> </description> <category>Ticket</category> </item> <item> <author>James E. King, III <jim.king@…></author> <pubDate>Fri, 29 Jul 2016 12:39:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8531#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8531#comment:6</guid> <description> <p> It looks like this made it into 1.56 based on: </p> <p> <a class="ext-link" href="https://github.com/boostorg/function/commit/9f06e35e8d8e886b87e7f3ddf846e59a2c282613"><span class="icon">​</span>https://github.com/boostorg/function/commit/9f06e35e8d8e886b87e7f3ddf846e59a2c282613</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>