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!!
Which version are you using ? Running your project example on Cppcheck v2.3 gives a valid report :
<?xml version="1.0" encoding="UTF-8"?><resultsversion="2"><cppcheckversion="2.3"/><errors><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared\wtypesbase.h"line="386"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h"line="7482"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h"line="7483"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h"line="7484"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h"line="7485"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\objidlbase.h"line="7486"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2822"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2823"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2833"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2877"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2886"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2894"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="2904"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="3023"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="3040"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\wingdi.h"line="3153"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h"line="6742"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h"line="15301"/></error><errorid="clang-diagnostic-error"severity="style"msg="enumerator value is not representable in the underlying type &#039;int&#039; "verbose="enumerator value is not representable in the underlying type &#039;int&#039; "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winuser.h"line="15329"/></error><errorid="clang-tidy-misc-unused-parameters"severity="style"msg="parameter &#039;ptr&#039; is unused "verbose="parameter &#039;ptr&#039; is unused "sinceDate="24/03/2021"><locationfile0="Lib/Lib/Lib.c"file="Lib\Lib\Lib.c"line="3"/></error></errors></results>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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!!
Which version are you using ? Running your project example on Cppcheck v2.3 gives a valid report :
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?
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 :
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
Hi, I continue here because this may be related to our previews discussion :
Running Cppcheck v2.4.1 with MISRA addon on files with :
Give bailing out errors :
I found the fix from searching the given
KeyError: '0x55dbcd2b2740'
onfile.a1.dump
and looking at the Scope ClassName.This (without first useless struct) run fine :
Hope this help.
This may be a bug (on misra.py side) ?
Last edit: Julien 2021-07-05
Thanks! Here is the suggested workaround: https://github.com/danmar/cppcheck/pull/3326 .
Thanks =)