[SERVER-68579] Comparing the signed with the unsigned integer results in a compilation warning Created: 05/Aug/22  Updated: 29/Oct/23  Resolved: 08/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Trivial - P5
Reporter: Konstantin Trushin Assignee: Alex Neben
Resolution: Fixed Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 20.04 on x86_64 CPU architecture


Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Try to compile the crypto_test binary

Participants:

 Description   

 It is not a big deal but should be better fixed:

 src/mongo/crypto/fle_crypto.cpp: In function 'mongo::BSONObj mongo::{anonymous}::toBSON(mongo::BSONType, mongo::ConstDataRange)':
src/mongo/crypto/fle_crypto.cpp:1046:23: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
 1046 |             docLength < std::numeric_limits<int32_t>::max());
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/mongo/platform/compiler_gcc.h:91:80: note: in definition of macro 'MONGO_unlikely'
   91 | #define MONGO_unlikely(x) static_cast<bool>(__builtin_expect(static_cast<bool>(x), 0))
      |                                                                                ^
src/mongo/util/assert_util.h:417:5: note: in expansion of macro 'MONGO_BASE_ASSERT'
  417 |     MONGO_BASE_ASSERT(::mongo::uassertedWithLocation, msgid, msg, expr)
      |     ^~~~~~~~~~~~~~~~~
src/mongo/crypto/fle_crypto.cpp:1044:5: note: in expansion of macro 'uassert'
 1044 |     uassert(ErrorCodes::BadValue,
      |     ^~~~~~~



 Comments   
Comment by Githook User [ 08/Aug/22 ]

Author:

{'name': 'Konstantin Trushin', 'email': 'konstantin.trushin@percona.com', 'username': 'ktrushin'}

Message: SERVER-68579: Fix the compilation warning
Branch: master
https://github.com/mongodb/mongo/commit/da1b994b05bba3b15cadd5138fc3dcd3687c7f91

Comment by Konstantin Trushin [ 05/Aug/22 ]

The  PR fixes the issue.

Generated at Thu Feb 08 06:11:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.