Opened 9 years ago
Closed 7 years ago
#8992 closed Bugs (fixed)
A bouquet of implicit conversion compiler warnings
Reported by: | Owned by: | Gennadiy Rozental | |
---|---|---|---|
Milestone: | Boost 1.59.0 | Component: | test |
Version: | Boost 1.54.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
The following (trivial?) warnings were kindly highlighted by clang (version) - using diagnostic options as indicated in the [...]. I based these on the 1.54.0 release, as svn rev. 85329 did not compile for me at the time. File locations are in the format path:line:byte-column.
- boost/test/impl/framework.ipp:438:21
warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
std::srand( runtime_config::random_seed() ); ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- boost/test/impl/exception_safety.ipp:404:46
warning: implicit conversion changes signedness: 'unsigned int' to 'int' [-Wsign-conversion]
formatter << std::left << std::setw( indent ) << ""; ~~~ ^~~~~~
- boost/test/impl/execution_monitor.ipp:249:72
warning: implicit conversion changes signedness: 'typename error_info<throw_line_, int>::value_type' (aka 'int') to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
extract<throw_line>( be ), ^~~~~~~~~~~~~~~~~~~~~~~~~
- boost/test/impl/execution_monitor.ipp:761:18
warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
::alarm( timeout ); ~~ ^~~~~~~
- boost/test/impl/plain_report_formatter.ipp:65:28
warning: implicit conversion loses integer precision: 'counter_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
ostr << std::setw( indent ) << "" ~~~ ^~~~~~
- boost/test/impl/plain_report_formatter.ipp:115:24
warning: implicit conversion loses integer precision: 'counter_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
ostr << std::setw( m_indent ) << "" ~~~ ^~~~~~~~
- boost/test/impl/unit_test_monitor.ipp:64:43
warning: implicit conversion changes signedness: 'const unsigned int' to 'int' [-Wsign-conversion]
p_timeout.value = tc.p_timeout.get(); ~ ^~~~~~~~~~~~~~~~~~
- boost/test/utils/runtime/cla/argv_traverser.ipp:79:58
warning: implicit conversion changes signedness: 'long' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion]
BOOST_RT_PARAM_LITERAL( ' ' ) ) - m_remainder.get(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
- boost/test/utils/runtime/cla/argv_traverser.ipp:180:34
warning: implicit conversion changes signedness: 'long' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion]
return m_work_buffer.begin() - m_commited_end; ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
- boost/test/utils/runtime/cla/named_parameter.ipp:116:27
warning: implicit conversion changes signedness: 'long' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion]
tr.trim( mm_pos.first - in.begin() ); ~~ ~~~~~~~~~~~~~^~~~~~~~~~~~
- boost/test/impl/unit_test_suite.ipp:143:28
warning: implicit conversion loses integer precision: 'const unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
increase_exp_fail( tu->p_expected_failures ); ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~
- boost/test/impl/unit_test_suite.ipp:146:32
warning: implicit conversion loses integer precision: 'counter_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
tu->increase_exp_fail( expected_failures ); ~~ ^~~~~~~~~~~~~~~~~
My reading of the standard (5.2.6 [expr.post.incr] & 5.2.1 [expr.sub]) suggests that clang may be at fault by complaining over the following: I include them for completeness - or to be enlightened if I missed something... :-)
- boost/test/utils/runtime/cla/argv_traverser.ipp:193:33
warning: implicit conversion changes signedness: 'std::size_t' (aka 'unsigned long') to 'std::ptrdiff_t' (aka 'long') [-Wsign-conversion]
m_remainder[m_remainder_size++] = p_separator; ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~^~
- boost/test/utils/runtime/cla/argv_traverser.ipp:80:24
warning: implicit conversion changes signedness: 'std::size_t' (aka 'unsigned long') to 'std::ptrdiff_t' (aka 'long') [-Wsign-conversion]
m_remainder[pos++] = BOOST_RT_PARAM_LITERAL( '\0' ); ~~~~~~~~~~~ ~~~^~
"clang --version"
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.4.0 Thread model: posix
Change History (1)
comment:1 by , 7 years ago
Milestone: | To Be Determined → Boost 1.59.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Most if not all of these are addressed