help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc --coverage and copying Bison generated files


From: Akim Demaille
Subject: Re: gcc --coverage and copying Bison generated files
Date: Thu, 15 Jan 2015 11:00:32 +0100

> Le 27 nov. 2014 à 05:03, Daiki Ueno <address@hidden> a écrit :
> 
> Hello,

Hi Daiki!

> Sorry for that this is not really related to Bison (but GCC or LCOV),
> but perhaps a common question that anyone might know the solution.
> 
> In gettext we have the following directory structure:
> 
>  gettext-runtime/
>    intl/
>      Makefile
>      plural.y
>      plural.c # <-- generated from plural.y
>      ...
> 
>  gettext-tools/
>    intl/
>      Makefile
> 
> In order for gettext-runtime and gettext-tools to be built separately,
> gettext-tools/intl/Makefile refers to the source code in
> gettext-runtime/intl/ instead of copying the object files.
> 
> So gettext-tools/intl/Makefile looks like:
> 
>  srcdir = ../../gettext-runtime/intl
> 
>  plural.lo: $(srcdir)/plural.c
>          $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile \
>            $(COMPILE) $(srcdir)/plural.c
> 
> This works for normal compilation.  However, when compiling with the
> --coverage option of GCC, the generated .gcno file embeds relative file
> name annotated with #line directive in plural.c.  That confuses LCOV:
> 
>  genhtml: ERROR: cannot read /tmp/...snip.../gettext-tools/intl/plural.c
> 
> http://hydra.nixos.org/build/17564911/log/tail-reload
> 
> Is there any easy way to tell GCC the correct source file location?  Or
> should we copy all the source files?

I don't know.  I face this problem constantly myself with
GCOV, not just for Bison files, but for almost any kind of
generated file I have in my various projects.

IMHO, what really lacks is a -I like option for gcov/genhtml.

If you find something better, please tell us!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]