Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-8196

Add a first set of warning options to the test/cppsuite files

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT10.0.1
    • Component/s: None
    • Labels:
      None
    • Story Points:
      5
    • Sprint:
      Storage - Ra 2021-11-01

      Description

      Context:
      Through looking at the coverity issues around the CPP test suites WT-8168, I discovered that we don't have flags that allow us to generate compiler warnings. I found that we don't append CFLAGS when compilng cxx files. This is can reflected in cmake build system through

          if(NOT CREATE_TEST_CXX)
              # Don't append the strict diagnostic flags to C++ targets (as these are chosen for C targets).
              set(test_c_flags "${COMPILER_DIAGNOSTIC_FLAGS}")
          endif()
      

      Inside the autoconf build system this is a little harder to parse:

      ac_ext=cpp
      ac_cpp='$CXXCPP $CPPFLAGS'
      ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
      ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
      ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
      

      I don't entirely understand autoconf build system myself, so I will try my best to explain what is happening. This code represents how it compiles for a cpp file. The --enable-strict generates the warning flag for only CFLAGS. In this case, it seems that we don't add in {$CFLAGS}, which means we skip generating the warning flags.

      Task:
      This ticket aims to find a solution where we can add warning flags when compiling CPP tests locally. This will require some investigating if we can utilise the CFLAGS that we generate from --enable-strict or if we need to create a seperate flag specifically for CPP test suites. Once compiler warnings are enabled, there was a lot of warnings that were generated that needs to be addressed.

      We also want evergreen to enable this warning flag to catch the warnings during pull request builds.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              etienne.petrel Etienne Petrel
              Reporter:
              jie.chen Jie Chen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: