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

Thousands of warnings with MSVC like "'4' bytes padding added after data member"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8.0
    • Affects Version/s: 1.7.0
    • Component/s: Build
    • None

      As a consequence of adding the ENABLE_MAINTAINER_FLAGS option to CMakeLists.txt:

      https://github.com/mongodb/mongo-c-driver/commit/34c5c96985eb9bdcb669502cf7cd126fb21c4248

      There are now thousands of worthless warnings like this when compiling with MSVC in our Evergreen build:

      https://github.com/mongodb/mongo-c-driver/commit/34c5c96985eb9bdcb669502cf7cd126fb21c4248
               c:\cygwin\home\administrator\mongo-c-driver\src\libbson\src\bson\bson-types.h(297): warning C4820: '<unnamed-tag>': '4' bytes padding added after data member 'data_len' [C:\cygwin\home\Administrator\mongo-c-driver\src\libbson\test-libbson.vcxproj]
      

      The problem seems to be MSVC can accept the "-Wall" flag, but it's badly implemented. MSVC shouldn't warn about code in system headers, but it does, and perhaps these "padding" warnings are completely spurious no matter where they originate.

      MSVC doesn't accept any other GCC-style warning options like "-Wformat", so it's a waste of time for CMake to check each of them.

      To resolve this, let's skip the entire warning-flags configuration step if the compiler is MSVC.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: