Project

General

Profile

Actions

Bug #69525

closed
JM RF

src/test/test_not_before_queue.cc: failure to build with -Werror: comparison of integer expressions of different signedness (inside template)

Bug #69525: src/test/test_not_before_queue.cc: failure to build with -Werror: comparison of integer expressions of different signedness (inside template)

Added by John Mulligan almost 2 years ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Tags (freeform):
Fixed In:
v19.3.0-8050-g87c1e647b9
Released In:
v20.2.0~973
Upkeep Timestamp:
2025-11-01T01:14:55+00:00

Description

I hit this as an error while trying to build tests on ubuntu 24.04 in container. This environment has set -Werror by default. I can force -Werror off temporarily by hacking the build script (src/script/run-make.sh) but this isn't a good long term solution. I can see these unit test errors now that I have fixes for most regular build errors.

[38/605] Linking CXX executable bin/unittest_sloppy_crc_map
[39/605] Building CXX object src/test/CMakeFiles/unittest_not_before_queue.dir/test_not_bef
ore_queue.cc.o
FAILED: src/test/CMakeFiles/unittest_not_before_queue.dir/test_not_before_queue.cc.o
/usr/bin/ccache /usr/bin/g++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_HAS
_IO_URING -DBOOST_ASIO_NO_TS_EXECUTORS -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 -D_REENTRANT -D_THREAD_SAFE -D__CEPH__ -D__STDC_FORMAT_MACROS -D__linux__ -I/ceph/build.u2
4x2/src/include -I/ceph/src -isystem /ceph/build.u24x2/boost/include -isystem /ceph/build.u
24x2/include -isystem /ceph/src/xxHash -isystem /ceph/src/fmt/include -isystem /ceph/src/go
ogletest/googlemock/include -isystem /ceph/src/googletest/googlemock -isystem /ceph/src/goo
gletest/googletest/include -isystem /ceph/src/googletest/googletest -Og -Werror -std=c++20
-fPIE -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wall
-fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werr
or=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifi
ers -ftemplate-depth-1024 -Wpessimizing-move -Wredundant-move -Wstrict-null-sentinel -Wover
loaded-virtual -DCEPH_DEBUG_MUTEX -fstack-protector-strong -D_GLIBCXX_ASSERTIONS -fdiagnost
ics-color=auto -MD -MT src/test/CMakeFiles/unittest_not_before_queue.dir/test_not_before_qu
eue.cc.o -MF src/test/CMakeFiles/unittest_not_before_queue.dir/test_not_before_queue.cc.o.d
 -o src/test/CMakeFiles/unittest_not_before_queue.dir/test_not_before_queue.cc.o -c /ceph/s
rc/test/test_not_before_queue.cc
In file included from ../src/test/test_not_before_queue.cc:7:
../src/common/not_before_queue.h: In instantiation of 'bool not_before_queue_t<V, T>::compa
re_by_removal_class_t::operator()(const not_before_queue_t<V, T>::container_t&, const U&) c
onst [with U = int; V = tv_t; T = test_time_t]':
boost/include/boost/intrusive/detail/tree_value_compare.hpp:175:30:   required from 'Ret bo
ost::intrusive::tree_value_compare<ValuePtr, KeyCompare, KeyOfValue, Ret, true>::operator()
(const key_type&, const U&, typename boost::intrusive::disable_if_smartref_to<U, ValuePtr>:
:type*) const [with U = int; ValuePtr = not_before_queue_t<tv_t, test_time_t>::container_t*
; KeyCompare = not_before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; KeyOfValu
e = boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t>; Ret =
 bool; key_type = not_before_queue_t<tv_t, test_time_t>::container_t; typename boost::intru
sive::disable_if_smartref_to<U, ValuePtr>::type = boost::move_detail::enable_if_nat]'
boost/include/boost/intrusive/detail/key_nodeptr_comp.hpp:104:20:   required from 'bool boo
st::intrusive::detail::key_nodeptr_comp<KeyTypeKeyCompare, ValueTraits, KeyOfValue>::operat
or()(const T1&, const T2&, typename boost::move_detail::enable_if_c<(is_same_or_nodeptr_con
vertible<T1>::value && (! is_same_or_nodeptr_convertible<T2>::value)), sfinae_type*>::type)
 const [with T1 = boost::intrusive::rbtree_node<void*>*; T2 = int; KeyTypeKeyCompare = not_
before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; ValueTraits = boost::intrusi
ve::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_n
ode_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>; KeyOf
Value = boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t>; t
ypename boost::move_detail::enable_if_c<(is_same_or_nodeptr_convertible<T1>::value && (! is
_same_or_nodeptr_convertible<T2>::value)), sfinae_type*>::type = boost::intrusive::detail::
key_nodeptr_comp<not_before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t, boost::
intrusive::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::r
btree_node_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>
, boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t> >::sfina
e_type*]'
boost/include/boost/intrusive/bstree_algorithms.hpp:2034:17:   required from 'static boost:
:intrusive::bstree_algorithms<NodeTraits>::node_ptr boost::intrusive::bstree_algorithms<Nod
eTraits>::lower_bound_loop(node_ptr, node_ptr, const KeyType&, KeyNodePtrCompare) [with Key
Type = int; KeyNodePtrCompare = boost::intrusive::detail::key_nodeptr_comp<not_before_queue
_t<tv_t, test_time_t>::compare_by_removal_class_t, boost::intrusive::bhtraits<not_before_qu
eue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*, false>,
boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>, boost::move_detail::identity<no
t_before_queue_t<tv_t, test_time_t>::container_t> >; NodeTraits = boost::intrusive::rbtree_
node_traits<void*, false>; node_ptr = boost::intrusive::rbtree_node<void*>*]'
boost/include/boost/intrusive/bstree_algorithms.hpp:925:30:   required from 'static boost::
intrusive::bstree_algorithms<NodeTraits>::node_ptr boost::intrusive::bstree_algorithms<Node
Traits>::lower_bound(const_node_ptr, const KeyType&, KeyNodePtrCompare) [with KeyType = int
; KeyNodePtrCompare = boost::intrusive::detail::key_nodeptr_comp<not_before_queue_t<tv_t, t
est_time_t>::compare_by_removal_class_t, boost::intrusive::bhtraits<not_before_queue_t<tv_t
, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*, false>, boost::int
rusive::safe_link, boost::intrusive::dft_tag, 3>, boost::move_detail::identity<not_before_q
ueue_t<tv_t, test_time_t>::container_t> >; NodeTraits = boost::intrusive::rbtree_node_trait
s<void*, false>; node_ptr = boost::intrusive::rbtree_node<void*>*; const_node_ptr = const b
oost::intrusive::rbtree_node<void*>*]'
boost/include/boost/intrusive/bstree.hpp:333:10:   required from 'boost::intrusive::bstbase
2<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, AlgoType, HeaderHolder>::iterator boost::in
trusive::bstbase2<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, AlgoType, HeaderHolder>::lo
wer_bound(const KeyType&, KeyTypeKeyCompare) [with KeyType = int; KeyTypeKeyCompare = not_b
efore_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; ValueTraits = boost::intrusiv
e::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_no
de_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>; VoidOr
KeyOfValue = void; VoidOrKeyComp = not_before_queue_t<tv_t, test_time_t>::compare_by_remova
l_class_t; boost::intrusive::algo_types AlgoType = boost::intrusive::RbTreeAlgorithms; Head
erHolder = void; iterator = boost::intrusive::tree_iterator<boost::intrusive::bhtraits<not_
before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*,
 false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>, false>]'
../src/common/not_before_queue.h:277:35:   required from 'int not_before_queue_t<V, T>::rem
ove_if_by_class(const K&, PRED&&, std::optional<int>) [with K = int; PRED = NotBeforeTest_R
emoveIfByClass_no_cond_Test::TestBody()::<lambda(const tv_t&)>; V = tv_t; T = test_time_t]'
../src/test/test_not_before_queue.cc:217:3:   required from here
../src/common/not_before_queue.h:136:43: error: comparison of integer expressions of differ
ent signedness: 'const unsigned int' and 'const int' [-Werror=sign-compare]
  136 |       return project_removal_class(lhs.v) < rhs;
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/common/not_before_queue.h: In instantiation of 'bool not_before_queue_t<V, T>::compa
re_by_removal_class_t::operator()(const U&, const not_before_queue_t<V, T>::container_t&) c
onst [with U = int; V = tv_t; T = test_time_t]':
boost/include/boost/intrusive/detail/tree_value_compare.hpp:180:30:   required from 'Ret bo
ost::intrusive::tree_value_compare<ValuePtr, KeyCompare, KeyOfValue, Ret, true>::operator()
(const U&, const key_type&, typename boost::intrusive::disable_if_smartref_to<U, ValuePtr>:
:type*) const [with U = int; ValuePtr = not_before_queue_t<tv_t, test_time_t>::container_t*
; KeyCompare = not_before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; KeyOfValu
e = boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t>; Ret =
 bool; key_type = not_before_queue_t<tv_t, test_time_t>::container_t; typename boost::intru
sive::disable_if_smartref_to<U, ValuePtr>::type = boost::move_detail::enable_if_nat]'
boost/include/boost/intrusive/detail/key_nodeptr_comp.hpp:110:20:   required from 'bool boo
st::intrusive::detail::key_nodeptr_comp<KeyTypeKeyCompare, ValueTraits, KeyOfValue>::operat
or()(const T1&, const T2&, typename boost::move_detail::enable_if_c<((! is_same_or_nodeptr_
convertible<T1>::value) && is_same_or_nodeptr_convertible<T2>::value), sfinae_type*>::type)
 const [with T1 = int; T2 = boost::intrusive::rbtree_node<void*>*; KeyTypeKeyCompare = not_
before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; ValueTraits = boost::intrusi
ve::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_n
ode_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>; KeyOf
Value = boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t>; t
ypename boost::move_detail::enable_if_c<((! is_same_or_nodeptr_convertible<T1>::value) && i
s_same_or_nodeptr_convertible<T2>::value), sfinae_type*>::type = boost::intrusive::detail::
key_nodeptr_comp<not_before_queue_t<tv_t, test_time_t>::compare_by_removal_class_t, boost::
intrusive::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::r
btree_node_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>
, boost::move_detail::identity<not_before_queue_t<tv_t, test_time_t>::container_t> >::sfina
e_type*]'
boost/include/boost/intrusive/bstree_algorithms.hpp:2050:17:   required from 'static boost:
:intrusive::bstree_algorithms<NodeTraits>::node_ptr boost::intrusive::bstree_algorithms<Nod
eTraits>::upper_bound_loop(node_ptr, node_ptr, const KeyType&, KeyNodePtrCompare) [with Key
Type = int; KeyNodePtrCompare = boost::intrusive::detail::key_nodeptr_comp<not_before_queue
_t<tv_t, test_time_t>::compare_by_removal_class_t, boost::intrusive::bhtraits<not_before_qu
eue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*, false>,
boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>, boost::move_detail::identity<no
t_before_queue_t<tv_t, test_time_t>::container_t> >; NodeTraits = boost::intrusive::rbtree_
node_traits<void*, false>; node_ptr = boost::intrusive::rbtree_node<void*>*]'
boost/include/boost/intrusive/bstree_algorithms.hpp:943:30:   required from 'static boost::
intrusive::bstree_algorithms<NodeTraits>::node_ptr boost::intrusive::bstree_algorithms<Node
Traits>::upper_bound(const_node_ptr, const KeyType&, KeyNodePtrCompare) [with KeyType = int
; KeyNodePtrCompare = boost::intrusive::detail::key_nodeptr_comp<not_before_queue_t<tv_t, t
est_time_t>::compare_by_removal_class_t, boost::intrusive::bhtraits<not_before_queue_t<tv_t
, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*, false>, boost::int
rusive::safe_link, boost::intrusive::dft_tag, 3>, boost::move_detail::identity<not_before_q
ueue_t<tv_t, test_time_t>::container_t> >; NodeTraits = boost::intrusive::rbtree_node_trait
s<void*, false>; node_ptr = boost::intrusive::rbtree_node<void*>*; const_node_ptr = const b
oost::intrusive::rbtree_node<void*>*]'
boost/include/boost/intrusive/bstree.hpp:351:10:   required from 'boost::intrusive::bstbase
2<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, AlgoType, HeaderHolder>::iterator boost::in
trusive::bstbase2<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, AlgoType, HeaderHolder>::up
per_bound(const KeyType&, KeyTypeKeyCompare) [with KeyType = int; KeyTypeKeyCompare = not_b
efore_queue_t<tv_t, test_time_t>::compare_by_removal_class_t; ValueTraits = boost::intrusiv
e::bhtraits<not_before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_no
de_traits<void*, false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>; VoidOr
KeyOfValue = void; VoidOrKeyComp = not_before_queue_t<tv_t, test_time_t>::compare_by_remova
l_class_t; boost::intrusive::algo_types AlgoType = boost::intrusive::RbTreeAlgorithms; Head
erHolder = void; iterator = boost::intrusive::tree_iterator<boost::intrusive::bhtraits<not_
before_queue_t<tv_t, test_time_t>::container_t, boost::intrusive::rbtree_node_traits<void*,
 false>, boost::intrusive::safe_link, boost::intrusive::dft_tag, 3>, false>]'
../src/common/not_before_queue.h:279:31:   required from 'int not_before_queue_t<V, T>::rem
ove_if_by_class(const K&, PRED&&, std::optional<int>) [with K = int; PRED = NotBeforeTest_R
emoveIfByClass_no_cond_Test::TestBody()::<lambda(const tv_t&)>; V = tv_t; T = test_time_t]'
../src/test/test_not_before_queue.cc:217:3:   required from here
../src/common/not_before_queue.h:131:18: error: comparison of integer expressions of differ
ent signedness: 'const int' and 'const unsigned int' [-Werror=sign-compare]
  131 |       return lhs < project_removal_class(rhs.v);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

The interesting wrinkle here is that this is within a template. I eagarly await seeing how a real C++ coder fixes this so I can keep learning through osmosis. :-)

RF Updated by Ronen Friedman almost 2 years ago Actions #1

  • Status changed from New to Fix Under Review
  • Assignee set to Ronen Friedman
  • Pull request ID set to 61993

RF Updated by Ronen Friedman almost 2 years ago Actions #2

@John Mulligan - not sure the fix is up to all you've expected it to be...

RF Updated by Ronen Friedman over 1 year ago Actions #3

  • Status changed from Fix Under Review to Resolved

UB Updated by Upkeep Bot over 1 year ago Actions #4

  • Merge Commit set to 87c1e647b96d6b3d99eba9c3f0313eb137eb6ed5
  • Fixed In set to v19.3.0-8050-g87c1e647b96
  • Upkeep Timestamp set to 2025-07-10T00:35:53+00:00

UB Updated by Upkeep Bot over 1 year ago Actions #5

  • Fixed In changed from v19.3.0-8050-g87c1e647b96 to v19.3.0-8050-g87c1e647b9
  • Upkeep Timestamp changed from 2025-07-10T00:35:53+00:00 to 2025-07-14T19:37:40+00:00

UB Updated by Upkeep Bot about 1 year ago Actions #6

  • Released In set to v20.2.0~973
  • Upkeep Timestamp changed from 2025-07-14T19:37:40+00:00 to 2025-11-01T01:14:55+00:00
Actions

Also available in: PDF Atom