Checking my project for Misra 2012 I got this error in misra.py :
Traceback (most recent call last):
File "D:\Tools\CppCheck\addons\misra.py", line 4630, in <module>
main()
File "D:\Tools\CppCheck\addons\misra.py", line 4572, in main
checker.parseDump(item)
File "D:\Tools\CppCheck\addons\misra.py", line 4228, in parseDump
self.executeCheck(704, self.misra_7_4, cfg)
File "D:\Tools\CppCheck\addons\misra.py", line 4157, in executeCheck
check_function(*args)
File "D:\Tools\CppCheck\addons\misra.py", line 1823, in misra_7_4
if usedParameter.isString and parameterDefinition.nameToken:
AttributeError: 'NoneType' object has no attribute 'nameToken'</module>
I looked at my misra_rules.txt for that section and I cannot see something special :-/
Rule 7.4
Required
A string ....
... char.
Regards,
Yann
Last edit: Yann 2021-11-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I'm trying to debut the exception it seems to be thrown on a parameterDefinition with nameToken = NoneType
the first parameterDefinition name in the list is 'fmt'
And looking at the source code there's several function defintion with fmt as a first parameter like : void ImGuiTextBuffer::appendfv(const char* fmt, va_list args) void ImGui::SetTooltipV(const char* fmt, va_list args) void ImGui::SetTooltip(const char* fmt, ...)
Could be a case where the second arg is not correctly parsed ?
Last edit: Yann 2021-11-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks yes it sounds reasonable that it crash when the parameter does not have a name.. It would be very helpful with a short code that reproduce the problem.. preferably plain C..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Checking my project for Misra 2012 I got this error in misra.py :
Traceback (most recent call last):
File "D:\Tools\CppCheck\addons\misra.py", line 4630, in <module>
main()
File "D:\Tools\CppCheck\addons\misra.py", line 4572, in main
checker.parseDump(item)
File "D:\Tools\CppCheck\addons\misra.py", line 4228, in parseDump
self.executeCheck(704, self.misra_7_4, cfg)
File "D:\Tools\CppCheck\addons\misra.py", line 4157, in executeCheck
check_function(*args)
File "D:\Tools\CppCheck\addons\misra.py", line 1823, in misra_7_4
if usedParameter.isString and parameterDefinition.nameToken:
AttributeError: 'NoneType' object has no attribute 'nameToken'</module>
I looked at my misra_rules.txt for that section and I cannot see something special :-/
Rule 7.4
Required
A string ....
... char.
Last edit: Yann 2021-11-16
If I'm trying to debut the exception it seems to be thrown on a parameterDefinition with nameToken = NoneType
the first parameterDefinition name in the list is 'fmt'
And looking at the source code there's several function defintion with fmt as a first parameter like :
void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
void ImGui::SetTooltipV(const char* fmt, va_list args)
void ImGui::SetTooltip(const char* fmt, ...)
Could be a case where the second arg is not correctly parsed ?
Last edit: Yann 2021-11-16
thanks yes it sounds reasonable that it crash when the parameter does not have a name.. It would be very helpful with a short code that reproduce the problem.. preferably plain C..
I tried to create a new cppcheck project with only the same source file that thrown the error and it's working good 🤨