#8531 closed Bugs (fixed)
[Coverity] boost/function/function_template.hpp: spurious warnings
Reported by: | Owned by: | Marshall Clow | |
---|---|---|---|
Milestone: | To Be Determined | Component: | function |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
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).
Attachments (1)
Change History (7)
by , 9 years ago
Attachment: | boost-function2.patch added |
---|
comment:1 by , 9 years ago
To reproduce (assuming you have a Coverity license...)
Coverity offers its scanning service gratis to open and free projects. Boost can sign up for an account at http://scan.coverity.com/projects.
comment:2 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 9 years ago
Fixed on develop in commit 9f06e35e8d8e886b87e7f3ddf846e59a2c282613
Will close when merged to master.
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Merged to master in commit a80ac7f5c560911ebedabafe4016df57a9cf3a63
comment:5 by , 6 years ago
Hi, this was merged to master however the ticket was not updated with a release milestone or marked as closed.
comment:6 by , 6 years ago
It looks like this made it into 1.56 based on:
https://github.com/boostorg/function/commit/9f06e35e8d8e886b87e7f3ddf846e59a2c282613
Draft patch to silence spurious warnings