Menu

cppcheck V.2.8 - misra.py can't use --cppcheck-build-dir?

2022-08-23
2023-08-01
  • Thomas Schneider

    Hi Everyone,

    Trying to analyse a large project with MISRA always results in crashing misra.py. I've broken down the problem onto very small project, see attached zip-file.
    Reason seems to be that*.ctu-info files provided by "cppcheck-addon-ctu-file-list" should be read but wasn't generated.
    1. First case is when non-ASCII characters are inside the code (see Test2.c): in this case "Test2.c.ctu-info" isn't generated and misra.py crashes on trying to read it
    2. Second case is when using --cppcheck-build-dir: misra.py wants to read "Test3.c.analyzerinfo.ctu-info" but (empty!) "Test3.a1.ctu-info" was generated instead (regardless whether there ar non-ASCIs or not!)

    See also some comments in attached CppCheck.bat.
    Note that CppCheck V.2.7 works fine!

    Regards from Meerbusch
    Thomas

     
  • Julien

    Julien - 2023-07-26

    Hi sorry this answer may be late but in my case on Cppcheck v2.6 and v2.8 I had to modify misra.py and after :

        dump_files, ctu_info_files = cppcheckdata.get_files(args)    
    
        if (not dump_files) and (not ctu_info_files):
            if not args.quiet:
                print("No input files.")
            sys.exit(0)
    

    I add these lines to rename CTU files :

        new_ctu_info_files = []
        for f in ctu_info_files:
            new_ctu_info_files.append(f.replace(".c.analyzerinfo.", ".a1."))
        ctu_info_files = new_ctu_info_files
    

    This seems to fix your point 2.

     
  • Thomas Schneider

    Hi Julien,
    thanks for figuring out a workaround. But in newer Versions (since 2.9) all seems to work fine again.

    Regards from Meerbusch
    Thomas

     

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.