Menu

Output changes on each analysis

2019-03-27
2019-04-10
  • Mark Donkers

    Mark Donkers - 2019-03-27

    Each time I perform an analysis on my project (on an unchanged code base), the number of outputted errors/warnings/information randomly changes. I would think that the output should always be identical since nothing has changed. Further down are the statisics from two back-to-back scans. Version: Cppcheck v1.87

    Note: Performing a "Clear results" between scans does not fix it.

    Workaround 1: Close Cppcheck, reopen and press "Reanalyze all files"
    Workaround 2: Delete the myproject-cppcheck-build-dir folder then "Reanalyze all files".
    The results between the two work around is also different.

    Attached files:

    • My .cppcheck file
    • lastResults - 1st.xml (results from "good" scan)
    • lastResults - 2nd.xml (results after back-to-back scan)

    Notes About lastResults files:
    In the 2nd file, there are results missing, as would be expected from what the Statistics output reported. What's strange is that for the lines that are the same, the escape character for a newline is a different format. For the first, the escape sequence is \012 and for the 2nd it is &#10

    Another strange output between the files is that there is the following output about a line of code. In the 2nd lastResults.xml file, the order in which the lines are listed are reversed. Should that not be consistent between scans?

    <error id="redundantAssignment" severity="style" msg="Variable ... (I deleted code here for clarity)
        <location file="Sources\FlexCMBApp.c" line="996" info=""/>
        <location file="Sources\FlexCMBApp.c" line="1009" info=""/>
    </error>
    

    Based on both of these observations, is it possible the outputs being piped through a different "outputter" in different conditions?

    @@@@ Good scan @@@@@@@@@@@@@@@@@@@@@@@
    Project Settings
    Project:
    Paths: Sources;test
    Include paths:
    Defines:
    Undefines:
    Previous Scan
    Path selected: C:/Share/Projects/CMBGen2/FW/CMBGen2
    Number of files scanned: 99
    Scan duration: 0.2 seconds
    Statistics
    Errors: 13
    Warnings: 0
    Style warnings: 384
    Portability warnings: 0
    Performance warnings: 0
    Information messages: 2

    @@@@ "Bad" scan @@@@@@@@@@@@@@@@@@@@@@@
    Project Settings
    Project:
    Paths: Sources;test
    Include paths:
    Defines:
    Undefines:
    Previous Scan
    Path selected: C:/Share/Projects/CMBGen2/FW/CMBGen2
    Number of files scanned: 99
    Scan duration: 0.1 seconds
    Statistics
    Errors: 10
    Warnings: 0
    Style warnings: 168
    Portability warnings: 0
    Performance warnings: 0
    Information messages: 2

     
  • Adrian Haider

    Adrian Haider - 2019-04-10

    I have the same problem with version 1.87. The behaviour is reproducible.

    Edit:
    It could be that this is just a counter problem, I tried to analyze a file with this code:

    #include <stdio.h>
    
    int main()
    {
        printf("Hello World %u\n"); //no parameter for %u
    
        return 0;
    }
    

    And the counter was always 0, even after restarting the program. But the error was always in the list.

     

    Last edit: Adrian Haider 2019-04-10

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.