> The gcov function summaries only output the covered lines, not the > branches and calls. Since the function summaries is an opt-in it > probably makes sense to also include branch coverage, calls, and > condition coverage. > > $ gcc --coverage -fpath-coverage hello.c -o hello > $ ./hello > > Before: > $ gcov -f hello > Function 'main' > Lines executed:100.00% of 4 > > Function 'fn' > Lines executed:100.00% of 7 > > File 'hello.c' > Lines executed:100.00% of 11 > Creating 'hello.c.gcov' > > After: > $ gcov -f hello > Function 'main' > Lines executed:100.00% of 3 > No branches > Calls executed:100.00% of 1 > > Function 'fn' > Lines executed:100.00% of 7 > Branches executed:100.00% of 4 > Taken at least once:50.00% of 4
Doesn't we care if all possible outcomes of the branch was taken? I.e. if the branch is always taken, will I see 100% here? Also what about switch statements? > gcc/ChangeLog: > > * gcov.cc (generate_results): Count branches, conditions. > (function_summary): Output branch, calls, condition count. Patch looks OK, but perhaps the report above can be clarified a bit... Also I apologize for taking so long to get to the patchset. I will review it now and will definitely try to do better next time. Honza