[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generating code coverage reports
From: |
Simon Josefsson |
Subject: |
Re: Generating code coverage reports |
Date: |
Mon, 03 Nov 2008 15:21:16 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) |
address@hidden (Ludovic Courtès) writes:
>> Hi Ludovic. Thanks, I pushed this patch. Adding anything to LDFLAGS
>> doesn't seem to be required though?
>
> According to the doc (info "(gcc)Debugging Options") it is required.
> See also this example (with GCC 4.2.4):
>
> $ cat > t.c <<EOF
> int main (int argc, char *argv[]) { return 0; }
> EOF
> $ gcc --coverage -c t.c
> $ gcc t.o
> t.o: In function `global constructors keyed to 0_main':
> t.c:(.text+0x43): undefined reference to `__gcov_init'
> t.o:(.data+0x24): undefined reference to `__gcov_merge_add'
> collect2: ld returned 1 exit status
> $ gcc --coverage t.o
> [ success ]
Yes, but it seems that --coverage is passed to the command line to link
applications with CFLAGS:
address@hidden:~/src/libidn/src master$ rm idn
address@hidden:~/src/libidn/src master$ make CFLAGS="-g --coverage"
make all-am
make[1]: Entering directory `/home/jas/src/libidn/src'
/bin/bash ../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Werror -g
--coverage -o idn idn.o idn_cmd.o ../lib/libidn.la ../gl/libgnu.la
libtool: link: gcc -std=gnu99 -Wall -Werror -g --coverage -o .libs/idn idn.o
idn_cmd.o ../lib/.libs/libidn.so ../gl/.libs/libgnu.a
make[1]: Leaving directory `/home/jas/src/libidn/src'
address@hidden:~/src/libidn/src master$
At least the rules in maint.mk seems to work for me in several projects.
All of them uses libtool though.
/Simon