Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang -Wtautological-type-limit-compare warnings. #155

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Romain-Geissler-1A
Copy link
Contributor

In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/filtering_streambuf.hpp:17: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/chain.hpp:28: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/push.hpp:24: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/resolve.hpp:19: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/adapter/mode_adapter.hpp:24: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/operations.hpp:16: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/close.hpp:19: In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp:13: /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:86:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') > 9223372036854775807 is always
 false [-Werror,-Wtautological-type-limit-compare]
               off > integer_traits<std::streamoff>::const_max ) )
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:85:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') < -9223372036854775808 is always false [-Werror,-Wtautological-type-limit-compare]
             ( off < integer_traits<std::streamoff>::const_min ||
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:113:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') > 9223372036854775807 is always false [-Werror,-Wtautological-type-limit-compare]
               off > integer_traits<std::streamoff>::const_max ) )
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:112:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') < -9223372036854775808 is always false [-Werror,-Wtautological-type-limit-compare]
             ( off < integer_traits<std::streamoff>::const_min ||
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.

Note: I am not sure this check on the offset is valid in the first place, I don't know how possible it is that stream_offset is a different type than std::streamoff in which case this check is totally pointless as always false.

In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/filtering_streambuf.hpp:17:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/chain.hpp:28:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/push.hpp:24:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/resolve.hpp:19:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/adapter/mode_adapter.hpp:24:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/operations.hpp:16:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/close.hpp:19:
In file included from /data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/detail/adapter/non_blocking_adapter.hpp:13:
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:86:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') > 9223372036854775807 is always
 false [-Werror,-Wtautological-type-limit-compare]
               off > integer_traits<std::streamoff>::const_max ) )
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:85:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') < -9223372036854775808 is always false [-Werror,-Wtautological-type-limit-compare]
             ( off < integer_traits<std::streamoff>::const_min ||
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:113:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') > 9223372036854775807 is always false [-Werror,-Wtautological-type-limit-compare]
               off > integer_traits<std::streamoff>::const_max ) )
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Boost/23-0-0-0/include/boost/iostreams/seek.hpp:112:20: error: result of comparison 'boost::iostreams::stream_offset' (aka 'long') < -9223372036854775808 is always false [-Werror,-Wtautological-type-limit-compare]
             ( off < integer_traits<std::streamoff>::const_min ||
               ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 errors generated.
@pdimov
Copy link
Member

pdimov commented Jan 17, 2023

stream_offset is defined as boost::intmax_t here:

typedef boost::intmax_t stream_offset;

@mclow
Copy link
Contributor

mclow commented Jan 17, 2023

std::streamoff is implementation defined; usually long long. See Cpp Reference

What platform (compiler, standard library) are you using?

@Romain-Geissler-1A
Copy link
Contributor Author

This happened with clang 15 (so a release version) which was using glibc headers (the future 2.37 release, I think when I posted this pull request I used a snapshot of the master branch as of mid december) and libstdc++ headers (the future gcc 13 release, also a snapshot as of mid december).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants