libtool-patches
[Top][All Lists]
Advanced

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

Fix boilerplate code with "set -x"


From: Ralf Wildenhues
Subject: Fix boilerplate code with "set -x"
Date: Tue, 6 Sep 2005 18:06:05 +0200
User-agent: Mutt/1.4.1i

This (anti-) Heisenbug isn't a regression, but an issue that hurts
when trying to debug:  The current (CVS HEAD and branch-1-5) code to
compare compiler/linker warnings ("boilerplate") breaks when "set -x"
is in effect.

The patch at the end should mitigate that while hopefully minimizing
other damage: it removes lines beginning with white space and `+'
(I do not know of a compiler that uses this for warning/error messages).

I've checked that it now passes the old testsuite on GNU Linux/x86_64
when modified like in this patch (note that this trick won't work when
configure re-executes itself, so be sure to call either a shell with
known-good `echo' or set lt_ECHO appropriately):

--- tests/defs.m4sh     24 Aug 2005 18:39:51 -0000      1.14
+++ tests/defs.m4sh     6 Sep 2005 18:49:18 -0000
@@ -190,8 +190,8 @@
     test -f "$my_testdir/configure" || autoreconf --force --install $my_testdir
     if test -f "$my_testdir/configure"; then
 
-      eval func_msg $SHELL "$my_testdir/configure" $my_args
-      if eval $SHELL "$my_testdir/configure" $my_args; then
+      eval func_msg $SHELL -x "$my_testdir/configure" $my_args
+      if eval $SHELL -x "$my_testdir/configure" $my_args; then
        conf_status=$EXIT_SUCCESS
       else
        func_msg "FAILED: Configuring in $my_testdir"


OK to apply the patch below to HEAD and the attached backport to
branch-1-5?  It's not minimal in the sense that the weeding of empty
lines is done twice for $_lt_compiler_boilerplate (the second one is
necessary because "foo=`cat /dev/null`" does not cause $foo to be
empty with all shells), but it does not introduce any new processes.

Cheers,
Ralf

        * libltdl/m4/libtool.m4 (_LT_COMPILER_BOILERPLATE)
        (_LT_LINKER_BOILERPLATE, _LT_COMPILER_OPTION, _LT_LINKER_OPTION)
        (_LT_COMPILER_C_O): When comparing expected and actual compiler/
        linker output for warnings, weed out both empty lines as well as
        lines starting with possibly indented `+', to allow for shell
        debugging with `set -x'.
        Check the weeded instead of unweeded contents for emptiness.

Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.15
diff -u -r1.15 libtool.m4
--- libltdl/m4/libtool.m4       6 Sep 2005 18:58:34 -0000       1.15
+++ libltdl/m4/libtool.m4       6 Sep 2005 19:07:36 -0000
@@ -844,7 +844,7 @@
 m4_defun([_LT_COMPILER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
 printf "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_compiler_boilerplate=`cat conftest.err`
 $RM conftest*
 ])# _LT_COMPILER_BOILERPLATE
@@ -857,7 +857,7 @@
 m4_defun([_LT_LINKER_BOILERPLATE],
 [ac_outfile=conftest.$ac_objext
 printf "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
 _lt_linker_boilerplate=`cat conftest.err`
 $RM conftest*
 ])# _LT_LINKER_BOILERPLATE
@@ -1244,9 +1244,9 @@
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
-     $SED '/^$/d' conftest.err >conftest.er2
-     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; 
then
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; 
then
        $2=yes
      fi
    fi
@@ -1283,8 +1283,8 @@
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed > conftest.exp
-       $SED '/^$/d' conftest.err >conftest.er2
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
        fi
@@ -1676,9 +1676,9 @@
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
-     $SED '/^$/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 
>/dev/null; then
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 
>/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
      fi
    fi

Attachment: boilerplate-setx.diff
Description: Text document


reply via email to

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