heimdal_build: omit #line statments
authorAndrew Bartlett <abartlet@samba.org>
Thu, 9 Feb 2012 21:49:05 +0000 (08:49 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 Feb 2012 04:20:33 +0000 (15:20 +1100)
This restores and finishes my original commit
80e23c68d83a7c9989f87d5a88a78bb76d222afc, reverted in
68c61a829b8487104483b23052b54c532fecb6ce

    heimdal_build omit #line statments to allow valgrind to work again

This time however, the reason to omit line statements is that it
causes more trouble with the lcov code coverage system than the (nil)
value that these statements bring.  Otherwise, we have to have a
special case to remove the .gcno and .gcda files for these generated
files.

Andrew Bartlett

source4/heimdal_build/lexyacc.sh

index eb6314ad96c301ce84e1ca107930eb6297f536f3..00fe7a4bddb19feba8517b75349dc71e9624a218 100755 (executable)
@@ -24,20 +24,21 @@ call_lex() {
 
     cd $dir
 
-    $LEX $lfile || exit 1
+    # --noline specified because line directives cause more bother than they solve (issues with lcov finding the source files)
+    $LEX --noline $lfile || exit 1
 
     if [ -r lex.yy.c ]; then
        echo "#include \"config.h\"" > $base.c
-       sed -e "s|lex\.yy\.c|$cfile|" lex.yy.c >> $base.c
+       grep -v "^#line" lex.yy.c >> $base.c
        rm -f $base.yy.c
     elif [ -r $base.yy.c ]; then
        echo "#include \"config.h\"" > $base.c
-       sed -e "s|$base\.yy\.c|$cfile|" $base.yy.c >> $base.c
+       grep -v "^#line" $base.yy.c >> $base.c
        rm -f $base.yy.c
     elif [ -r $base.c ]; then
        mv $base.c $base.c.tmp
        echo "#include \"config.h\"" > $base.c
-       sed -e "s|$base\.yy\.c|$cfile|" $base.c.tmp >> $base.c
+       grep -v "^#line" $base.c.tmp >> $base.c
        rm -f $base.c.tmp
     elif [ ! -r base.c ]; then
        echo "$base.c nor $base.yy.c nor lex.yy.c generated."
@@ -59,10 +60,11 @@ call_yacc() {
 
     cd $dir
 
-    $YACC -d $yfile || exit 1
+    # -l specified because line directives cause more bother than they solve (issues with lcov finding the source files)
+    $YACC -l -d $yfile || exit 1
     if [ -r y.tab.h -a -r y.tab.c ];then
-       sed -e "/^#/!b" -e "s|y\.tab\.h|$cfile|" -e "s|\"$base.y|\"$cfile|"  y.tab.h > $base.h
-       sed -e "s|y\.tab\.c|$cfile|" -e "s|\"$base.y|\"$cfile|" y.tab.c > $base.c
+       cat y.tab.h > $base.h
+       cat y.tab.c > $base.c
        rm -f y.tab.c y.tab.h
     elif [ ! -r $base.h -a ! -r $base.c]; then
        echo "$base.h nor $base.c generated."