#944 introduced a regression when building for coverage analysis. The -O2
flag from the default Autoconf’s CFLAGS
overrides the coverage-specific -O0
one, which makes coverage analysis results less reliable.
This PR restores the pre-#944 behaviour.
In contrast to an alternative smaller diff:
0--- a/configure.ac
1+++ b/configure.ac
2@@ -240,7 +240,7 @@ fi
3
4 if test x"$enable_coverage" = x"yes"; then
5 SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOVERAGE=1"
6- SECP_CFLAGS="-O0 --coverage $SECP_CFLAGS"
7+ CFLAGS="$CFLAGS -O0 --coverage "
8 LDFLAGS="--coverage $LDFLAGS"
9 else
10 # Most likely the CFLAGS already contain -O2 because that is autoconf's default.
this PR ensures that the user always has the last word.
FWIW, Bitcoin Core uses a similar approach.