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

Warnings due to GCC extensions (-wpedantic)

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.2.4
    • Affects Version/s: 1.1.7
    • Component/s: None
    • Labels:
      None

      The 1.1.7 release of mongoc and libbson introduced some new portability problems due to the use of GNU extensions. These can easily be reproduced by compiling with -pedantic.

      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c bson/bson-context.c -o bson/bson-context.o
      In file included from bson/bson-context.c:32:0:
      bson/bson-context-private.h:31:4: warning: type of bit-field ‘flags’ is a GCC extension [-Wpedantic]
          bson_context_flags_t flags : 7;
          ^
      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c bson/bson-iso8601.c -o bson/bson-iso8601.o
      bson/bson-iso8601.c: In function ‘_bson_iso8601_date_parse’:
      bson/bson-iso8601.c:227:30: warning: ‘sec_ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          if (sec_len && !parse_num (sec_ptr, sec_len, 2, 0, 60, &sec)) {
                                    ^
      bson/bson-iso8601.c:273:31: warning: ‘millis_ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                millis += (millis_ptr[millis_len - i] - '0') * magnitude;
                                     ^
      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c bson/bson-oid.c -o bson/bson-oid.o
      In file included from bson/bson-oid.c:24:0:
      bson/bson-context-private.h:31:4: warning: type of bit-field ‘flags’ is a GCC extension [-Wpedantic]
          bson_context_flags_t flags : 7;
          ^
      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c mongoc/mongoc-bulk-operation.c -o mongoc/mongoc-bulk-operation.o
      In file included from mongoc/mongoc-bulk-operation-private.h:26:0,
                       from mongoc/mongoc-bulk-operation.c:19:
      mongoc/mongoc-write-command-private.h:46:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:47:10: warning: type of bit-field ‘multi’ is a GCC extension [-Wpedantic]
                uint8_t   multi : 1;
                ^
      mongoc/mongoc-write-command-private.h:50:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:51:10: warning: type of bit-field ‘allow_bulk_op_insert’ is a GCC extension [-Wpedantic]
                uint8_t   allow_bulk_op_insert : 1;
                ^
      mongoc/mongoc-write-command-private.h:54:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c mongoc/mongoc-collection.c -o mongoc/mongoc-collection.o
      In file included from mongoc/mongoc-bulk-operation-private.h:26:0,
                       from mongoc/mongoc-collection.c:22:
      mongoc/mongoc-write-command-private.h:46:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:47:10: warning: type of bit-field ‘multi’ is a GCC extension [-Wpedantic]
                uint8_t   multi : 1;
                ^
      mongoc/mongoc-write-command-private.h:50:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:51:10: warning: type of bit-field ‘allow_bulk_op_insert’ is a GCC extension [-Wpedantic]
                uint8_t   allow_bulk_op_insert : 1;
                ^
      mongoc/mongoc-write-command-private.h:54:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c mongoc/mongoc-gridfs.c -o mongoc/mongoc-gridfs.o
      mongoc/mongoc-gridfs.c: In function ‘_mongoc_gridfs_new’:
      mongoc/mongoc-gridfs.c:110:16: warning: variable ‘prefix_len’ set but not used [-Wunused-but-set-variable]
             uint32_t prefix_len;
                      ^
      gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iyajl -Ibson -Imongoc -include apple.h -include mlfeatures.h -I/opt/csw/include -DBSON_COMPILATION -DMONGOC_COMPILATION      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -O3 -Wall -pipe -pedantic -std=gnu99 -c mongoc/mongoc-write-command.c -o mongoc/mongoc-write-command.o
      In file included from mongoc/mongoc-write-command.c:21:0:
      mongoc/mongoc-write-command-private.h:46:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:47:10: warning: type of bit-field ‘multi’ is a GCC extension [-Wpedantic]
                uint8_t   multi : 1;
                ^
      mongoc/mongoc-write-command-private.h:50:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      mongoc/mongoc-write-command-private.h:51:10: warning: type of bit-field ‘allow_bulk_op_insert’ is a GCC extension [-Wpedantic]
                uint8_t   allow_bulk_op_insert : 1;
                ^
      mongoc/mongoc-write-command-private.h:54:10: warning: type of bit-field ‘ordered’ is a GCC extension [-Wpedantic]
                uint8_t   ordered : 1;
                ^
      

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            Jeroenooms Jeroen Ooms [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: