Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2766

Compiler warnings (gcc-8.1.0)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 1.12.0
    • Fix Version/s: 1.13.0
    • Component/s: libmongoc
    • Labels:
      None

      Description

      Seeing the following compiler warnings with GCC 8:

       
      bson/bson-iso8601.c: In function '_bson_iso8601_date_parse':
      bson/bson-iso8601.c:67:24: warning: 'millis_ptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
       if (!isdigit (str[i])) {
       ~~~^~~
      bson/bson-iso8601.c:119:16: note: 'millis_ptr' was declared here
       const char *millis_ptr;
       ^~~~~~~~~~
      bson/bson-iso8601.c:67:24: warning: 'sec_ptr' may be used uninitialized in this function [-Wmaybe-uninitialized]
       if (!isdigit (str[i])) {
       ~~~^~~
      bson/bson-iso8601.c:118:16: note: 'sec_ptr' was declared here
       const char *sec_ptr;
       ^~~~~~~
       
      bson/bson-json.c: In function '_push_callback':
      bson/bson-json.c:267:46: warning: array subscript -1 is below array bounds of 'bson_json_stack_frame_t[100]' \{aka 'struct <anonymous>[100]'} [-Warray-bounds]
       (((_delta) + bson->n) == 0 ? bson->bson : &STACK_ELE (_delta, bson))
       ^
      bson/bson-json.c:269:26: note: in expansion of macro 'STACK_BSON'
       #define STACK_BSON_CHILD STACK_BSON (0)
       ^~~~~~~~~~
      bson/bson-json.c:292:27: note: in expansion of macro 'STACK_BSON_CHILD'
       bson_destroy (STACK_BSON_CHILD); \
       ^~~~~~~~~~~~~~~~
      bson/bson-json.c:301:7: note: in expansion of macro 'STACK_PUSH'
       STACK_PUSH (BSON_JSON_FRAME_ARRAY); \
       ^~~~~~~~~~
      bson/bson-json.c:1767:7: note: in expansion of macro 'STACK_PUSH_ARRAY'
       STACK_PUSH_ARRAY (_noop ());
       ^~~~~~~~~~~~~~~~
      
      

       
      clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Icommon -Ijsonsl -Ibson -Imongoc -DBSON_COMPILATION -DMONGOC_COMPILATION  -I/usr/local/opt/openssl/include -Wno-deprecated-declarations -DMONGOC_HAVE_SASL_CLIENT_DONE -DBSON_EXTRA_ALIGN  -I/usr/local/include   -fPIC  -Wall -pedantic -c mongoc/mongoc-async-cmd.c -o mongoc/mongoc-async-cmd.o
      mongoc/mongoc-async-cmd.c:322:25: warning: arithmetic on a pointer to void is a GNU extension [-Wpointer-arith]
            iovec[0].iov_base += offset;
            ~~~~~~~~~~~~~~~~~ ^ 

       

      clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Icommon -Ijsonsl -Ibson -Imongoc -DBSON_COMPILATION -DMONGOC_COMPILATION  -I/usr/local/opt/openssl/include -Wno-deprecated-declarations -DMONGOC_HAVE_SASL_CLIENT_DONE -DBSON_EXTRA_ALIGN  -I/usr/local/include   -fPIC  -Wall -pedantic -c mongoc/mongoc-error.c -o mongoc/mongoc-error.o
      mongoc/mongoc-cursor-legacy.c:623:2: warning: no newline at end of file [-Wnewline-eof]
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: