Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-19939

Clang compiler warnings in superblock.cc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • .master
    • .master
    • forestdb
    • None
    • Untriaged
    • MacOSX 64-bit
    • Unknown
    • ForestDB: Oct 17 - Nov 4

    Description

      Clang flags several compiler warnings in superblock.cc, with "-Wconversion -Wshorten-64-to-32 -Wmissing-prototypes". The rest of ForestDB is clean.

      This is with the head of the stable branch, bc0e6044, and clang-703.0.31 (Xcode 7.3.1.)

      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:195:19: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'uint8_t' (aka 'unsigned char') [-Werror,-Wconversion]
                  idx = div8(i);
                      ~ ^~~~~~~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:88:22: note: expanded from macro 'div8'
      #define div8(x) ((x) >> 3)
                       ~~~~^~~~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:318:56: error: implicit conversion loses integer precision: 'unsigned long' to 'keylen_t' (aka 'unsigned short') [-Werror,-Wconversion]
              sb->bmp_docs[i].length.keylen = strlen(doc_key)+1;
                                            ~ ~~~~~~~~~~~~~~~^~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:368:57: error: implicit conversion loses integer precision: 'unsigned long' to 'keylen_t' (aka 'unsigned short') [-Werror,-Wconversion]
              rsv->bmp_docs[i].length.keylen = strlen(doc_key)+1;
                                             ~ ~~~~~~~~~~~~~~~^~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:847:33: error: implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wconversion]
              bmp_basic_mask[i] = 0x1 << (7-i);
                                ~ ~~~~^~~~~~~~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:1338:9: error: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
          r = file->ops->pwrite(file->fd, buf, real_blocksize, sb_no * real_blocksize);
            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:1381:9: error: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
          r = file->ops->pread(file->fd, buf, real_blocksize, sb_no * real_blocksize);
            ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Couchbase/CouchbaseLite/vendor/CBForest/vendor/forestdb/src/superblock.cc:1565:6: error: no previous prototype for function '_sb_init' [-Werror,-Wmissing-prototypes]
      void _sb_init(struct superblock *sb, struct sb_config sconfig)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            chiyoung Chiyoung Seo (Inactive)
            jens Jens Alfke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty