How do I tell gcov to ignore un-hittable lines of C++ code?

后端 未结 4 1917
悲哀的现实
悲哀的现实 2020-12-28 11:45

I\'m using gcov to measure coverage in my C++ code. I\'d like to get to 100% coverage, but am hampered by the fact that there are some lines of code that are theoretically

4条回答
  •  爱一瞬间的悲伤
    2020-12-28 12:20

    Please use lcov. It hides gcov's complexity, produces nice output, allows detailed output per test, features easy file filtering and - ta-taa - line markers for already reviewed lines:

    From geninfo(1):

    The following markers are recognized by geninfo:

    • LCOV_EXCL_LINE
      • Lines containing this marker will be excluded.
    • LCOV_EXCL_START
      • Marks the beginning of an excluded section. The current line is part of this section.
    • LCOV_EXCL_STOP
      • Marks the end of an excluded section. The current line not part of this section.

提交回复
热议问题