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

Windows VS2019 compile warnings in libbson

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.24.0
    • Affects Version/s: None
    • Component/s: libbson
    • None

      As noted in https://github.com/mongodb-labs/python-bsonjs/issues/23, I see the following compile warnings in libbson 1.17.0 on Windows when building with VS2019:

      $ /cygdrive/c/python/Python38/python setup.py build_ext -i
      running build_ext
      building 'bsonjs' extension
      creating build
      creating build\temp.win-amd64-3.8
      creating build\temp.win-amd64-3.8\Release
      creating build\temp.win-amd64-3.8\Release\src
      creating build\temp.win-amd64-3.8\Release\src\bson
      creating build\temp.win-amd64-3.8\Release\src\common
      creating build\temp.win-amd64-3.8\Release\src\jsonsl
      ...
      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DBSON_COMPILATION=1 -Isrc -Isrc/bson -Isrc/jsonsl -Isrc/common -IC:\python\Python38\include -IC:\python\Python38\includ
      e "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.
      18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\
      4.7.2\include\um" /Tcsrc\bson\bson-atomic.c /Fobuild\temp.win-amd64-3.8\Release\src\bson\bson-atomic.obj
      bson-atomic.c
      src\bson\bson-atomic.c(93): warning C4133: 'function': incompatible types - from 'volatile int64_t *' to 'volatile LONG *'
      src\bson\bson-atomic.c(93): warning C4244: 'function': conversion from 'int64_t' to 'LONG', possible loss of data
      
      src\bson\bson-context.c(290): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
      
      src\bson\bson-decimal128.c(176): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      src\bson\bson-decimal128.c(180): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      src\bson\bson-decimal128.c(629): warning C4267: '-=': conversion from 'size_t' to 'int32_t', possible loss of data
      
      src\bson\bson-iter.c(114): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data
      
      src\bson\bson-json.c(617): warning C4146: unary minus operator applied to unsigned type, result still unsigned
      src\bson\bson-json.c(1069): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
      src\bson\bson-json.c(2090): warning C4018: '<': signed/unsigned mismatch
      src\bson\bson-json.c(2091): warning C4018: '<': signed/unsigned mismatch
      
      src\bson\bson-timegm.c(488): warning C4244: '+=': conversion from 'const int64_t' to 'int_fast32_t', possible loss of data
      
      src\jsonsl\jsonsl.c(921): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      src\jsonsl\jsonsl.c(959): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
      

            Assignee:
            ezra.chung@mongodb.com Ezra Chung
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: