Subject: [Boost-bugs] [Boost C++ Libraries] #8531: [Coverity] boost/function/function_template.hpp: spurious warnings
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-01 00:41:15
#8531: [Coverity] boost/function/function_template.hpp: spurious warnings
----------------------------------------+-----------------------------------
Reporter: Dan Kegel <dank@â¦> | Owner: dgregor
Type: Bugs | Status: new
Milestone: To Be Determined | Component: function
Version: Boost Development Trunk | Severity: Problem
Keywords: |
----------------------------------------+-----------------------------------
This was found in an older release, but is still present in trunk.
Coverity complains
{{{
(1) Event pointless_expression: The expression "false /*
mpl_::bool_<false>::value */ && false /* mpl_::bool_<false>::value */"
does not
accomplish anything because it evaluates to either of its identical
operands, "false /* mpl_::bool_<false>::value */". Did you intend the
operands to be different?
938 if (boost::has_trivial_copy_constructor<Functor>::value &&
939 boost::has_trivial_destructor<Functor>::value &&
940
detail::function::function_allows_small_object_optimization<Functor>::value)
}}}
And a similar error near line 973.
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.
To reproduce (assuming you have a Coverity license, and bjam installed in
~/local/bin):
{{{
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
}}}
Then look at covlog/c/output/errors/index.html in a web browser. If you
see a bunch of errors like
CONSTANT_EXPRESSION_RESULT .../boost/function/function_template.hpp
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).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8531> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC