Menu

Problem with --plist-output

2021-07-16
2021-07-17
  • Cheyenne Wills

    Cheyenne Wills - 2021-07-16

    Ran into a problem with --plist-output when running a check against an entire project: The last output file contains additional diagnostic entries not associated with the file being reported.

    Using the following command line (cppcheck 2.4.1)

    cppcheck --cppcheck-build-dir=/tmp/cppcheck-work --enable=all --plist-output=./cppcheck-out/ ./ &> cppcheck.log

    Looking in the stderr/stdout log we can see that the checks for vos-t.c have diagnostics. Following the reports for vos-t.c, cpp-check is not reporting on what I guess are "global" type of errors (unused functions, etc.)

    1841/1843 files checked 99% done
    Checking tests/util/volutil-t.c ...
    1842/1843 files checked 99% done
    Checking tests/volser/vos-t.c ...
    tests/volser/vos-t.c:120:10: style: Variable 'code' is reassigned a value before the old one has been used. [redundantAssignment]
        code = afstest_AddDESKeyFile(dir);
             ^
    tests/volser/vos-t.c:114:10: note: code is assigned
        code = rx_Init(0);
             ^
    tests/volser/vos-t.c:120:10: note: code is overwritten
        code = afstest_AddDESKeyFile(dir);
             ^
    1843/1843 files checked 100% done
    src/WINNT/afssvrmgr/svrmgr.h:170:9: error: The one definition rule is violated, different classes/structs have the same name 'GLOBALS' [ctuOneDefinitionRuleViolation]
    typedef struct
            ^
    src/WINNT/afsusrmgr/TaAfsUsrMgr.h:82:9: note: The one definition rule is violated, different classes/structs have the same name 'GLOBALS'
    typedef struct
    

    Looking at the resulting I see that the vos-t output file has a size of 2,8M and includes not only the diagnostics for vos-t.c but the all the "remaining" global diagnostics. These remaining diagnostics however are incorrect in the output plist file in that there is only one "file"

    <dict>
     <key>clang_version</key>
    <string>cppcheck version 2.4.1</string>
     <key>files</key>
     <array>
      <string>tests/volser/vos-t.c</string>
     </array>
     <key>diagnostics</key>
     <array>
    

    Yet the "extra" diagnostics" in output all have "location" entries that point back to the one file instead of the file where the problem actually is.

     
  • Daniel Marjamäki

    Thanks!

    Yes the "global" type of errors are checked after all files have been checked.

    I have created ticket https://trac.cppcheck.net/ticket/10366

     

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.