aviggiano / redis-roaring

Roaring Bitmaps for Redis
MIT License
348 stars 56 forks source link

issues in MacOSX #80

Closed inspire365 closed 3 years ago

inspire365 commented 3 years ago

Hi friends:

I try redis-roaring in my MacOSX, but exit with the following two errors:

/Users/dev/labs/redis-roaring/src/redis-roaring.c:604:14: error: variable 'bitmap' is used uninitialized whenever 'if' condition is false
      [-Werror,-Wsometimes-uninitialized]
  } else if (RedisModule_ModuleTypeGetType(srckey) == BitmapType) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dev/labs/redis-roaring/src/redis-roaring.c:610:24: note: uninitialized use occurs here
  if (!bitmap_is_empty(bitmap)) {
                       ^~~~~~
/Users/danlee/labs/redis-roaring/src/redis-roaring.c:604:10: note: remove the 'if' if its condition is always true
  } else if (RedisModule_ModuleTypeGetType(srckey) == BitmapType) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/dev/labs/redis-roaring/src/redis-roaring.c:599:17: note: initialize the variable 'bitmap' to silence this warning
  Bitmap* bitmap;        //  should be fixed by initialzing bitmap to NULL
                ^
                 = NULL
1 error generated.
/Users/dev/labs/redis-roaring/tests/performance.c:83:5: error: implicit declaration of function 'clock_gettime' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    clock_gettime(CLOCK_MONOTONIC, &statistics->start);
    ^
/Users/dev/labs/redis-roaring/tests/performance.c:83:19: error: use of undeclared identifier 'CLOCK_MONOTONIC'
    clock_gettime(CLOCK_MONOTONIC, &statistics->start);
                  ^
/Users/dev/labs/redis-roaring/tests/performance.c:90:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
  clock_gettime(CLOCK_MONOTONIC, &end);
                ^
3 errors generated.

// my MacOSX doesn't support clock_gettime, should fix it with this solution:  
// https://github.com/hashcat/hashcat/pull/1480/commits/4f8343b8b1cde3efda5f81d460af894e3fc43d50

It will be better if fixed for later users.

Thanks!

my system info below: System Version: macOS 10.13.6 (17G14042) Kernel Version: Darwin 17.7.0

Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin17.7.0 Thread model: posix

aviggiano commented 3 years ago

Hello @inspire365 Thank you for the bug report! I'll take a look into this issue soon. If you have time and can submit a pull request I'll be happy to incorporate it. Best regards

aviggiano commented 3 years ago

Closed after #81