diff options
author | Vollstrecker <werner@vollstreckernet.de> | 2024-12-25 12:52:53 +0100 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2025-01-31 19:59:10 -0800 |
commit | 44919160dee8de9f6bf03e1af0162be988dcd493 (patch) | |
tree | 1b92812c72fc427335b884ae99190b233e8ada65 | |
parent | 9ddf1b4bc56d0183c4a41868ecc8515f5fc2d897 (diff) | |
download | zlib-44919160dee8de9f6bf03e1af0162be988dcd493.tar.gz zlib-44919160dee8de9f6bf03e1af0162be988dcd493.tar.bz2 zlib-44919160dee8de9f6bf03e1af0162be988dcd493.zip |
Adjust coverage testing to the llvm gcov calling convention.
-rw-r--r-- | Makefile.in | 4 | ||||
-rwxr-xr-x | configure | 29 |
2 files changed, 27 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in index 6bb6af5..e6edd0d 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -13,6 +13,8 @@ | |||
13 | # make install prefix=$HOME | 13 | # make install prefix=$HOME |
14 | 14 | ||
15 | CC=cc | 15 | CC=cc |
16 | GCOV=GCOV | ||
17 | LLVM_GCOV_FLAG=LLMV_GCOV_FLAG | ||
16 | 18 | ||
17 | CFLAGS=-O | 19 | CFLAGS=-O |
18 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | 20 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 |
@@ -121,7 +123,7 @@ infcover: infcover.o libz.a | |||
121 | cover: infcover | 123 | cover: infcover |
122 | rm -f *.gcda | 124 | rm -f *.gcda |
123 | ${QEMU_RUN} ./infcover | 125 | ${QEMU_RUN} ./infcover |
124 | gcov inf*.c -o ./infcover.gcda | 126 | ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda |
125 | 127 | ||
126 | libz.a: $(OBJS) | 128 | libz.a: $(OBJS) |
127 | $(AR) $(ARFLAGS) $@ $(OBJS) | 129 | $(AR) $(ARFLAGS) $@ $(OBJS) |
@@ -87,6 +87,7 @@ zprefix=0 | |||
87 | zconst=0 | 87 | zconst=0 |
88 | build64=0 | 88 | build64=0 |
89 | gcc=0 | 89 | gcc=0 |
90 | clang=0 | ||
90 | warn=0 | 91 | warn=0 |
91 | debug=0 | 92 | debug=0 |
92 | address=0 | 93 | address=0 |
@@ -185,14 +186,31 @@ else | |||
185 | fi | 186 | fi |
186 | 187 | ||
187 | case "$cc" in | 188 | case "$cc" in |
188 | *gcc*) gcc=1 ;; | 189 | *gcc*) gcc=1 |
189 | *clang*) gcc=1 ;; | 190 | GCOV="gcov" ;; |
191 | *clang*) gcc=1 | ||
192 | clang=1 ;; | ||
190 | esac | 193 | esac |
191 | case `$cc -v 2>&1` in | 194 | case `$cc -v 2>&1` in |
192 | *gcc*) gcc=1 ;; | 195 | *gcc*) gcc=1 |
193 | *clang*) gcc=1 ;; | 196 | GCOV="gcov" ;; |
197 | *clang*) gcc=1 | ||
198 | clang=1 ;; | ||
194 | esac | 199 | esac |
195 | 200 | ||
201 | if test "$clang" -eq 1; then | ||
202 | clangV=`echo "$cc" | sed -e 's/^.*-//'` | ||
203 | if `llvm-cov-${clangV} --version > /dev/null`; then | ||
204 | GCOV="llvm-cov-${clangV}" | ||
205 | LLVM_GCOV_FLAG="gcov" | ||
206 | echo "Using ${GCOV} for coverage" | ||
207 | else | ||
208 | cover=0 | ||
209 | LLVM_GCOV_FLAG="" | ||
210 | echo "Deactivating cover as no suitable gcov can be found" | ||
211 | fi | ||
212 | fi | ||
213 | |||
196 | show $cc -c $test.c | 214 | show $cc -c $test.c |
197 | if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then | 215 | if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then |
198 | echo ... using gcc >> configure.log | 216 | echo ... using gcc >> configure.log |
@@ -620,7 +638,6 @@ fi | |||
620 | 638 | ||
621 | # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X | 639 | # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X |
622 | if test $cover -eq 1; then | 640 | if test $cover -eq 1; then |
623 | CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" | ||
624 | if test -n "$GCC_CLASSIC"; then | 641 | if test -n "$GCC_CLASSIC"; then |
625 | CC=$GCC_CLASSIC | 642 | CC=$GCC_CLASSIC |
626 | fi | 643 | fi |
@@ -872,6 +889,8 @@ echo uname = $uname >> configure.log | |||
872 | # update Makefile with the configure results | 889 | # update Makefile with the configure results |
873 | sed < ${SRCDIR}Makefile.in " | 890 | sed < ${SRCDIR}Makefile.in " |
874 | /^CC *=/s#=.*#=$CC# | 891 | /^CC *=/s#=.*#=$CC# |
892 | /^GCOV *=/s#=.*#=$GCOV# | ||
893 | /^LLVM_GCOV_FLAG *=/s#=.*#=$LLVM_GCOV_FLAG# | ||
875 | /^CFLAGS *=/s#=.*#=$CFLAGS# | 894 | /^CFLAGS *=/s#=.*#=$CFLAGS# |
876 | /^SFLAGS *=/s#=.*#=$SFLAGS# | 895 | /^SFLAGS *=/s#=.*#=$SFLAGS# |
877 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# | 896 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# |