Menu

Error thrown checking Misra 7.4

Yann
2021-11-16
2021-11-17
  • Yann

    Yann - 2021-11-16

    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.

    Regards,
    
    Yann
    
     

    Last edit: Yann 2021-11-16
  • Yann

    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
  • Daniel Marjamäki

    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..

     
  • Yann

    Yann - 2021-11-17

    I tried to create a new cppcheck project with only the same source file that thrown the error and it's working good 🤨

     

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.