Fix macos "integers of different signs" error from #18850 #19492

pull ryanofsky wants to merge 1 commits into bitcoin:master from bitcoin:pr/macs changing 1 files +1 −1
  1. fanquake added the label Tests on Jul 11, 2020
  2. in src/wallet/test/wallet_tests.cpp:815 in bfb9739bd6 outdated
     811 | @@ -812,7 +812,7 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
     812 |  
     813 |          LOCK(wallet->cs_wallet);
     814 |          BOOST_CHECK(wallet->HasWalletSpend(prev_hash));
     815 | -        BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 1);
     816 | +        BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), (size_t)1);
    


    MarcoFalke commented at 1:14 PM on July 11, 2020:
            BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 1U);
    

    nit: I think the other tests use the postfix thing


    ryanofsky commented at 1:16 PM on July 11, 2020:

    nit: I think the other tests use the postfix thing

    Thanks, switched

  3. MarcoFalke approved
  4. MarcoFalke commented at 1:14 PM on July 11, 2020: member

    review ACK based on return type of https://en.cppreference.com/w/cpp/container/map/count

  5. Fix macos error "comparison of integers of different signs" caused by #18850
    Examples
    
    https://travis-ci.org/github/bitcoin/bitcoin/jobs/707134622#L3609
    https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136763#L3642
    https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136764#L2276
    d11d348111
  6. ryanofsky force-pushed on Jul 11, 2020
  7. MarcoFalke commented at 1:23 PM on July 11, 2020: member

    review reACK d11d3481113d9160882ec9147e7623f3f77adeb2

  8. MarcoFalke commented at 1:30 PM on July 11, 2020: member

    Anyone knows how to test this?

    • How to reproduce -Werror=sign-compare failures locally? #19123
  9. fanquake commented at 3:05 PM on July 11, 2020: member

    There is another instance (also introduced in #18850) that should be fixed as part of this PR:

    diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
    index ade2fbb32..d302303e3 100644
    --- a/src/wallet/test/wallet_tests.cpp
    +++ b/src/wallet/test/wallet_tests.cpp
    @@ -818,7 +818,7 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
             BOOST_CHECK_EQUAL(wallet->ZapSelectTx(vHashIn, vHashOut), DBErrors::LOAD_OK);
     
             BOOST_CHECK(!wallet->HasWalletSpend(prev_hash));
    -        BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0);
    +        BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0U);
         }
     
         TestUnloadWallet(std::move(wallet));
    
      CXX      wallet/test/test_test_bitcoin-wallet_tests.o
    In file included from wallet/test/wallet_tests.cpp:24:
    In file included from /usr/local/include/boost/test/unit_test.hpp:18:
    In file included from /usr/local/include/boost/test/test_tools.hpp:46:
    /usr/local/include/boost/test/tools/old/impl.hpp:107:17: warning: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Wsign-compare]
        return left == right;
               ~~~~ ^  ~~~~~
    /usr/local/include/boost/test/tools/old/impl.hpp:130:16: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl<unsigned long, int>' requested here
            return equal_impl( left, right );
                   ^
    /usr/local/include/boost/test/tools/old/impl.hpp:145:16: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl_frwd::call_impl<unsigned long, int>' requested here
            return call_impl( left, right, left_is_array() );
                   ^
    /usr/local/include/boost/test/tools/old/impl.hpp:92:50: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl_frwd::operator()<unsigned long, int>' requested here
    BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ )
                                                     ^
    /usr/local/include/boost/preprocessor/repetition/repeat.hpp:29:26: note: expanded from macro 'BOOST_PP_REPEAT'
    # define BOOST_PP_REPEAT BOOST_PP_CAT(BOOST_PP_REPEAT_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
                             ^
    /usr/local/include/boost/preprocessor/cat.hpp:22:32: note: expanded from macro 'BOOST_PP_CAT'
    #    define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b)
                                   ^
    /usr/local/include/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I'
    #    define BOOST_PP_CAT_I(a, b) a ## b
                                     ^
    <scratch space>:163:1: note: expanded from here
    BOOST_PP_REPEAT_1
    ^
    wallet/test/wallet_tests.cpp:821:9: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, unsigned long, int>' requested here
            BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0);
            ^
    /usr/local/include/boost/test/tools/old/interface.hpp:154:45: note: expanded from macro 'BOOST_CHECK_EQUAL'
    #define BOOST_CHECK_EQUAL( L, R )           BOOST_TEST_TOOL_IMPL( 0, \
                                                ^
    /usr/local/include/boost/test/tools/old/interface.hpp:67:47: note: expanded from macro 'BOOST_TEST_TOOL_IMPL'
        BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) (                    \
                                                  ^
    1 warning generated.
    
  10. MarcoFalke commented at 5:14 PM on July 11, 2020: member

    Done in #19493

  11. MarcoFalke closed this on Jul 11, 2020

  12. MarcoFalke deleted the branch on Jul 11, 2020
  13. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-25 00:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me