#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:
--- a/configure.ac
+++ b/configure.ac
@@ -240,7 +240,7 @@ fi
if test x"$enable_coverage" = x"yes"; then
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOVERAGE=1"
- SECP_CFLAGS="-O0 --coverage $SECP_CFLAGS"
+ CFLAGS="$CFLAGS -O0 --coverage "
LDFLAGS="--coverage $LDFLAGS"
else
# 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.