Menu

Running with --addon=misra vs --addon=misra.py yields different results

2021-11-25
2021-11-27
  • Per Arnold Blaasmo

    Due to lines 1346-1347 in cppcheck.cpp:
    if (addon != "misra" && !addonInfo.ctu && endsWith(files.back(), ".ctu-info"))
    continue;

    Running cppcheck with the option --addon=misra vs --addon=misra.py yields different results.
    They should not.

    The example in the manual used the option --addon=misra.py.
    What is the prefered way to call and addon?

    Per A.

    PS! simple example:
    Using 'misra' give 2 violations, using 'misra.py' gives 1 violation
    $: ~ /tmp/misra-test> cppcheck --addon=misra interrupts.c
    Checking interrupts.c ...
    Checking interrupts.c: __DEBUG;__DEBUG_D;__XC32...
    interrupts.c:67:13: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-8.4]
    extern void Dummy_Handler(void);
    ^
    interrupts.c:64:17: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-8.7]
    extern uint32_t _stack;
    ^</file></file>

    $: ~/tmp/misra-test> cppcheck --addon=misra.py interrupts.c
    Checking interrupts.c ...
    Checking interrupts.c: __DEBUG;__DEBUG_D;__XC32...
    interrupts.c:67:13: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-8.4]
    extern void Dummy_Handler(void);
    ^</file>

     

    Last edit: Per Arnold Blaasmo 2021-11-25
  • Daniel Marjamäki

    hmm.. the intention was that you would get the same results.

    but I would suggest that you create a misra.json and execute that. So you can provide a rule text file.

     
  • Daniel Marjamäki

    I have created this ticket: https://trac.cppcheck.net/ticket/10626

     

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.