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

Fixed comparison between signed and unsigned integer expressions in s… #35

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

Conversation

lssno
Copy link

@lssno lssno commented Apr 18, 2017

There was some comparison between signed and unsigned integer expressions in snappy_unittests.cc.

g++ -DHAVE_CONFIG_H -I.    -Wall  -g -O2 -MT snappy_unittest-snappy_unittest.o -MD -MP -MF .deps/snappy_unittest-snappy_unittest.Tpo -c -o snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc' || echo './'`snappy_unittest.cc
In file included from snappy-internal.h:34:0,
                 from snappy_unittest.cc:39:
snappy_unittest.cc: In function ‘void snappy::Test_Snappy_FourByteOffset()’:
snappy-test.h:579:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_EQ(a, b) CRASH_UNLESS((a) == (b))
                                     ~~~~^~~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:579:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_EQ(a, b) CRASH_UNLESS((a) == (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:851:3: note: in expansion of macro ‘CHECK_EQ’
   CHECK_EQ(length, src.size());**
   ^~~~~~~~
snappy_unittest.cc: In function ‘void snappy::Test_Snappy_IOVecEdgeCases()’:
**snappy_unittest.cc:870:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
**snappy_unittest.cc:922:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
snappy_unittest.cc: In function ‘void snappy::Test_Snappy_IOVecLiteralOverflow()’:
**snappy_unittest.cc:931:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
**snappy_unittest.cc:944:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
snappy_unittest.cc: In function ‘void snappy::Test_Snappy_IOVecCopyOverflow()’:
**snappy_unittest.cc:953:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
**snappy_unittest.cc:967:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < ARRAYSIZE(kLengths); ++i) {**
                      
snappy_unittest.cc: In function ‘void snappy::Test_Snappy_FindMatchLengthRandom()’:
**snappy_unittest.cc:1171:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (matched == t.size()) {**
         ~~~~~~~~^~~~~~~~~~~
In file included from snappy-internal.h:34:0,
                 from snappy_unittest.cc:39:
snappy_unittest.cc: In function ‘void snappy::BM_UFlat(int, int)’:
snappy-test.h:581:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                                     ~~~~^~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:581:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:1357:3: note: in expansion of macro ‘CHECK_LT’
   CHECK_LT(arg, ARRAYSIZE(files));**
   ^~~~~~~~
snappy_unittest.cc: In function ‘void snappy::BM_UValidate(int, int)’:
snappy-test.h:581:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                                     ~~~~^~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:581:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:1383:3: note: in expansion of macro ‘CHECK_LT’
   CHECK_LT(arg, ARRAYSIZE(files));**
   ^~~~~~~~
snappy_unittest.cc: In function ‘void snappy::BM_UIOVec(int, int)’:
snappy-test.h:581:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                                     ~~~~^~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:581:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:1406:3: note: in expansion of macro ‘CHECK_LT’
   CHECK_LT(arg, ARRAYSIZE(files));**
   ^~~~~~~~
snappy_unittest.cc:1420:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (used_so_far == contents.size()) {
         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from snappy-internal.h:34:0,
                 from snappy_unittest.cc:39:
snappy_unittest.cc: In function ‘void snappy::BM_UFlatSink(int, int)’:
snappy-test.h:581:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                                     ~~~~^~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:581:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:1452:3: note: in expansion of macro ‘CHECK_LT’
   CHECK_LT(arg, ARRAYSIZE(files));**
   ^~~~~~~~
snappy_unittest.cc: In function ‘void snappy::BM_ZFlat(int, int)’:
snappy-test.h:581:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                                     ~~~~^~~~~
snappy-stubs-internal.h:73:46: note: in definition of macro ‘PREDICT_TRUE’
 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
                                              ^
snappy-test.h:581:24: note: in expansion of macro ‘CRASH_UNLESS’
 #define CHECK_LT(a, b) CRASH_UNLESS((a) < (b))
                        ^~~~~~~~~~~~
**snappy_unittest.cc:1484:3: note: in expansion of macro ‘CHECK_LT’
   CHECK_LT(arg, ARRAYSIZE(files));**
   ^~~~~~~~

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@lssno
Copy link
Author

lssno commented Apr 18, 2017

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@cmumford
Copy link
Contributor

@googlebot rescan

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

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

Successfully merging this pull request may close these issues.

None yet

3 participants