LCOV/GCOV branch coverage with C++ producing branches all over the place

前端 未结 6 984
清歌不尽
清歌不尽 2020-12-05 01:13

We are using LCOV/GCOV to produce test coverage of our projects. Recently we tried to enable branch-coverage additionally. But it looks like, this just doesn\'t yield the re

6条回答
  •  不思量自难忘°
    2020-12-05 01:38

    GCC will add a bunch of exception handling stuff. Especially when you do function calls.

    You can fix this by adding -fno-exceptions -fno-inline to your build.

    I should add, you probably only want these flags on for testing. So something like this:

    g++ -O0 --coverage -fno-exceptions -fno-inline main.cpp -o test-coverage 
    

提交回复
热议问题