Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1820

"defined but not used" compiler warnings

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None

       Compiling the extension spits several warnings:

      gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wall -g -std=c99 -m64 -o bson_native.o -c bson_native.c
      BUILDSTDERR: In file included from bson_native.c:21:
      BUILDSTDERR: native-endian.h:196:15: warning: '__bson_double_swap_slow' defined but not used [-Wunused-function]
      BUILDSTDERR: 196 | static double __bson_double_swap_slow(double v)
      BUILDSTDERR: | ^~~~~~~~~~~~~~~~~~~~~~~
      BUILDSTDERR: native-endian.h:169:17: warning: '__bson_uint64_swap_slow' defined but not used [-Wunused-function]
      BUILDSTDERR: 169 | static uint64_t __bson_uint64_swap_slow(uint64_t v)
      BUILDSTDERR: | ^~~~~~~~~~~~~~~~~~~~~~~
      BUILDSTDERR: native-endian.h:145:17: warning: '__bson_uint32_swap_slow' defined but not used [-Wunused-function]
      BUILDSTDERR: 145 | static uint32_t __bson_uint32_swap_slow(uint32_t v)
      BUILDSTDERR: | ^~~~~~~~~~~~~~~~~~~~~~~
      

      These functions should be probably conditionalized by platform or they should be inline instead of static?

      Here is some SO discussion on this topic:

      https://stackoverflow.com/questions/2845748/function-defined-but-not-used-warning-in-c

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            vo.x Vít Ondruch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: