Evaluating how gcov handles compile time expressions
This latest article explores how the runtime coverage analysis tool gcov handles constexpr and consteval statements. There’s not too much surprising here if you’re familiar with the tools - compile time statements are consistently omitted from coverage results.
The most interesting result is the potential for the addition of a single constexpr function in a runtime context to pull in tons of additional, already existent code into the analysis context. Its totally possible for the addition of a single line of code to have a huge impact on the total lines considered in an analysis if that line pulls in lots of constexpr logic which is unchanged, but previously was only evaluated at compile time.
How consteval and constexpr Impact gcov | Volatile Int
Simple examples demonstrating the effect of consteval and constexpr in code coverage analysis
This is a quick read, hope ya’ll find it interesting!