0

In a similar vein to this question I got a new Boost warning when building a PR branch on MacOS.

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 int' and 'const int' [-Wsign-compare]
    return left == right;

Is this entirely harmless again? Maybe I should just be configuring with --enable-suppress-external-warnings and ignoring all Boost warnings? A signed integer shouldn't be compared to an unsigned integer though surely?

1 Answer 1

1

Is this entirely harmless again?

Quite possibly; you'd need to review the Boost internal code to find out. But in any case, if there is an issue, it's in Boost that this needs to be fixed.

Maybe I should just be configuring with --enable-suppress-external-warnings and ignoring all Boost warnings?

Unless you feel like debugging Boost itself, yes.

A signed integer shouldn't be compared to an unsigned integer though surely?

There is nothing inherently wrong with it. It's an indication that the code could be written in a more obviously correct way likely, but it's perfectly reasonable to encounter this in bug-free code. For example when in the context this is executed, it's known that the signed integer is never negative.

2
  • Bitcoin Core just uses Boost for the unit tests right? It doesn't use Boost libraries for anything else? So even if there was a bug in Boost you'd be (relatively) relaxed about it as its just a unit test dependency rather than a dependency for the actual codebase being tested? Will turn on suppress external warnings from now on. Jul 27, 2022 at 19:00
  • 1
    It uses Boost libraries for several things, but the Boost Test library (which is the one under consideration here) is only used by the Bitcoin Core test code, indeed. Jul 27, 2022 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.