Menu

cppcheck hang

Guy Maurel
2026-02-04
2026-02-11
  • Guy Maurel

    Guy Maurel - 2026-02-04

    Hello!
    I am the maintainer of https://github.com/uncrustify/uncrustify
    I try to use cppcheck with our sources.
    At least one source file produces a "infinite loop" :
    https://github.com/uncrustify/uncrustify/src/indent.cpp

    What shall I do to find out where is the bug?
    Which tools may I use for that.

    Thanks for any hint
    guy

     
  • CHR

    CHR - 2026-02-05

    There are lots of if conditions in that file. cppcheck is known to have performance issues on such code, see e.g. https://trac.cppcheck.net/ticket/11262
    So it's probably not a real hang that you are seeing, but an extremely long execution time.

     
  • john borland

    john borland - 2026-02-06

    I often use Flame Graphsto track down performance issues. It has been some time since I have profiled cppcheck. Last time I looked at it some of the valueflow functions could escalate run time. I wasn't smart enough to figure out any useful ways of dealing with it back then. On linux there is a tool called perf top I can often use to get I high level view for performance offenders. Then there is GDB if I really need to break in to see if a program is stuck.

     
  • Guy Maurel

    Guy Maurel - 2026-02-09

    Thanks

     
  • john borland

    john borland - 2026-02-11

    When I ran the example below it didn't take very long. This is built off of latest.
    system76-pc:~/Test$ time ./cppcheck/Build/bin/cppcheck check=all ./uncrustify/src/indent.cpp
    Checking uncrustify/src/indent.cpp ...
    Checking uncrustify/src/indent.cpp: HAVE_INTTYPES_H=HAVE_INTTYPES_H...
    Checking uncrustify/src/indent.cpp: WIN32=WIN32...
    Checking uncrustify/src/indent.cpp: WIN32=WIN32;QNXNTO=QNXNTO...

    real 0m18.128s
    user 0m18.100s
    sys 0m0.016s
    system76-pc:~/Test$

     

Log in to post a comment.

MongoDB Logo MongoDB