Menu

Running python addons - fix

2020-08-01
2021-07-06
<< < 1 2 3 (Page 3 of 3)
  • eranzim

    eranzim - 2021-03-24

    Hi!
    PSA a minimized project that reproduces the issue, including the files that were generated and the malformed Lib.c.analyzerinfo.dump file.
    To reproduce, I open cppcheck, open the Lib.cppcheck project file and click "Reanalyze all files" button. Sometimes the Lib.c.analyzerinfo.dump file isn't created (another bug?), in which case I click the "Clear results" button and then the "Reanalyze all files" button again. Sometimes this needs to be repeated several times until the file is created.
    If you need anything else (e.g. cppcheck preferences?), don't hesitate to ask.
    Thanks!!

     
  • Julien

    Julien - 2021-03-24

    Which version are you using ? Running your project example on Cppcheck v2.3 gives a valid report :

    <?xml version="1.0" encoding="UTF-8"?>
    <results version="2">
        <cppcheck version="2.3"/>
        <errors>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypesbase.h" line="386"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h" line="7482"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h" line="7483"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h" line="7484"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h" line="7485"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h" line="7486"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2822"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2823"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2833"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2877"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2886"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2894"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="2904"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="3023"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="3040"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h" line="3153"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h" line="6742"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h" line="15301"/>
            </error>
            <error id="clang-diagnostic-error" severity="style" msg="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " verbose="enumerator value is not representable in the underlying type &amp;#039;int&amp;#039; " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h" line="15329"/>
            </error>
            <error id="clang-tidy-misc-unused-parameters" severity="style" msg="parameter &amp;#039;ptr&amp;#039; is unused " verbose="parameter &amp;#039;ptr&amp;#039; is unused " sinceDate="24/03/2021">
                <location file0="Lib/Lib/Lib.c" file="Lib\Lib\Lib.c" line="3"/>
            </error>
        </errors>
    </results>
    
     
    • eranzim

      eranzim - 2021-03-25

      I am using version 2.3. Also, I'm not getting those errors you're showing (possibly due to the same problem?). Is it possible to enable diagnostic logs or something, that could help find the problem?

       
      • Julien

        Julien - 2021-03-25

        Running from .cppcheck project I do not get Lib.c.analyzerinfo.dump but direct .xml results.

        I am on Win10 20H2 with following paths on PATH :

        C:\Users\julienp\AppData\Local\Programs\Python\Python38-32\Scripts\
        C:\Users\julienp\AppData\Local\Programs\Python\Python38-32\
        C:\Program Files\Cppcheck
        C:\Program Files\LLVM\bin
        
         
        • eranzim

          eranzim - 2021-03-25

          The last 2 were missing from my path, I added them (my LLVM is in the visual studio folder, but it seems to be fine adding that). It indeed finds more findings e.g. from clang-tidy (I see my findings in the GUI, but I also see they appear in lastResults.xml), but Lib.c.analyzerinfo.dump is created corrupted nontheless, and thus running the addon fails.
          Running Win10 20H2 build 19042.867.

           

          Last edit: eranzim 2021-03-25
  • Julien

    Julien - 2021-07-05

    Hi, I continue here because this may be related to our previews discussion :

    Running Cppcheck v2.4.1 with MISRA addon on files with :

    typedef struct
    {
        union
        {
            struct
            {
                unsigned a : 2; 
                unsigned : 14;
            };
            uint16_t value;
        };
    } STRUCT_BITS;
    

    Give bailing out errors :

    Bailing out from checking src/file.c since there was an internal error: Failed to execute 'python3 /etc/cppcheck/addons/misra.py --cli Cppcheck/FW-cppcheck-build-dir/file.a1.dump'. Traceback (most recent call last):
    File "/etc/cppcheck/addons/misra.py", line 3327, in <module>
    main()
    File "/etc/cppcheck/addons/misra.py", line 3271, in main
    checker.parseDump(item)
    File "/etc/cppcheck/addons/misra.py", line 3075, in parseDump
    for cfgNumber, cfg in enumerate(data.iterconfigurations()):
    File "/etc/cppcheck/addons/cppcheckdata.py", line 945, in iterconfigurations
    cfg.setIdMap(cfg_arguments)
    File "/etc/cppcheck/addons/cppcheckdata.py", line 755, in setIdMap
    self.set_id_map(functions_arguments)
    File "/etc/cppcheck/addons/cppcheckdata.py", line 742, in set_id_map
    scope.setId(IdMap)
    File "/etc/cppcheck/addons/cppcheckdata.py", line 407, in setId
    self.varlist.append(IdMap[v])</module>

    I found the fix from searching the given KeyError: '0x55dbcd2b2740' on file.a1.dump and looking at the Scope ClassName.

    This (without first useless struct) run fine :

    typedef union
    {
        struct
        {
            unsigned a : 2; 
            unsigned : 14;
        };
        uint16_t value;
    } STRUCT_BITS;
    

    Hope this help.

    This may be a bug (on misra.py side) ?

     

    Last edit: Julien 2021-07-05
    • Georgiy Komarov

      Georgiy Komarov - 2021-07-05

      Thanks! Here is the suggested workaround: https://github.com/danmar/cppcheck/pull/3326 .

       
      • Julien

        Julien - 2021-07-06

        Thanks =)

         
<< < 1 2 3 (Page 3 of 3)

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.