Menu

debugging/understanding simplifyHeadersAndUnusedTemplates

2022-10-18
2022-10-18
  • Charles-the-intern

    Hello,
    There is this external header-only library that our codebase depends on, and I include the path to it as part of -I flag. When disable checking headers, my understanding is cppcheck will still go into these headers but remove the definition, leaving only declaration behind. When I chose this option, cppcheck crashes and after debugging for a while, I found out I got assert(brackets.empty() == false) here: https://github.com/danmar/cppcheck/blob/main/lib/templatesimplifier.cpp#L2220.

    I didn't get this issue when enabling checking headers, so seems like simplifyHeadersAndUnusedTemplates might work incorrectly. Is there a way to output such redacted file to help investigate more? I know there's --dump and --debug option, but they only output full header files. FYI I'm using cppcheck version 2.9

    Thanks a lot!

     
  • CHR

    CHR - 2022-10-18

    Maybe you could reduce the input code to a minimal reproducer? Looking at the token's line number in the debugger when it hits the assert might help.

     
    • Charles-the-intern

      Thanks, that's what I've been doing as well. I know which header and which line it occurs now, but when I bring that file out and test it, I couldn't reproduce the crash...
      I'll continue digging around then...

       

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.