Menu

--cppcheck-build-dir not helping

2023-04-20
2023-04-21
  • Zach Thompson

    Zach Thompson - 2023-04-20

    I'm new to cppcheck so I may just be using it wrong, but using a build directory isn't saving any time for me - using both the GUI and command line. Even if I run the same command back to back without changing any files, it takes the same time (approximately 2 minutes for 190 files)

    My command line looks like --cppcheck --cppcheck-build-dir=build-dir --project=project.sln "--project-configuration=RelWithDebInfo|x64" --enable=all -j8

    Any thoughts?

     
  • CHR

    CHR - 2023-04-20

    Do the files in build-dir also change with every execution?

     
    • Zach Thompson

      Zach Thompson - 2023-04-20

      Yes, they get completely refreshed.

       
  • CHR

    CHR - 2023-04-20

    The decision to run the analysis again happens here: https://github.com/danmar/cppcheck/blob/e17af6d2d865def4f3557bc374bd9892cd943709/lib/cppcheck.cpp#L749
    Maybe you can look at the hashed strings?

     
    • Zach Thompson

      Zach Thompson - 2023-04-21

      What am I looking for exactly? About 80% of the files created in build-dir are .a1 and have their its own unique analyzerinfo hash number but are otherwise identical and look like:

      <?xml version="1.0"?>
      <analyzerinfo hash="8543757348695670605">
              <error id="preprocessorErrorDirective" severity="error" msg="failed to expand &apos;BOOST_MPL_AUX_NA_SPEC&apos;, Invalid ## usage when expanding &apos;BOOST_PP_TUPLE_ELEM_II&apos;: Unexpected token &apos;)&apos;" verbose="failed to expand &apos;BOOST_MPL_AUX_NA_SPEC&apos;, Invalid ## usage when expanding &apos;BOOST_PP_TUPLE_ELEM_II&apos;: Unexpected token &apos;)&apos;">
                  <location file="C:\samepatheverytime\file.cpp" line="29" column="0"/>
              </error>
      </analyzerinfo>
      

      There are also about 10% of .snanalyzerinfo files as well but it seems like they are only generated when their associated .a1 file included a FileInfo check error such as Uninitialized variables or CheckUnusedFunction

       
  • CHR

    CHR - 2023-04-21

    You could dump the toolinfo string to a file (or look at it in the debugger) and compare the content from different runs to see if they are different. I remember an issue where suppressions changed randomly due to missing synchronization between threads.

     
    • Zach Thompson

      Zach Thompson - 2023-04-21

      Hash numbers remain the same after each run - however they change depending on whether I run it via command line or the GUI. Another strange thing, if I use --enable=all then the files are not overwritten but I still don't get any improved speed

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.