Counting functions in C source code

后端 未结 6 927
隐瞒了意图╮
隐瞒了意图╮ 2021-01-19 08:17

I have complete project in C, which can be built with gcc or Visual Studio. There are no calls to external libraries.

I would like to know how many functions there

6条回答
  •  南笙
    南笙 (楼主)
    2021-01-19 08:36

    Frama-C has a metrics plug-in that among other things computes the number of functions in your program. Just use

    frama-c -metrics file1.c file2.c ... filen.c
    

    to get as output something like:

              Global metrics
          ============== 
          Sloc = 2080
          Decision point = 117
          Global variables = 51
          If = 117
          Loop = 22
          Goto = 75
          Assignment = 613
          Exit point = 242
          Function = 841
          Function call = 871
          Pointer dereferencing = 447
    

提交回复
热议问题