tags 11007 + patch
close 11007
thanks

On 03/27/2012 04:21 PM, Stefano Lattarini wrote:
>
> I can now reproduce the issue, after upgrading tcc to version 0.9.25
> (either the issue wasn't present with the older version I had previously
> installed, or I hadn't been able to trigger it).  I hope I'll be able to
> find a fix before 1.11.4.  In the meantime, as usual, any help or patch
> would be mostly welcome.
> 
I've committed the attached patch, which fixes the issue for me.  The fix
will appear in automake 1.11.4 (to be released at the beginning of the next
week).  I'm thus closing this bug report; feel free to re-open it if the
problem persists for you.

Thanks,
  Stefano
>From b96263e1cc2d2977cf685d5596c7bbf57617a0da Mon Sep 17 00:00:00 2001
Message-Id: <b96263e1cc2d2977cf685d5596c7bbf57617a0da.1332940026.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Tue, 27 Mar 2012 17:55:07 +0200
Subject: [PATCH] depcomp: support tcc (Tiny C Compiler)

This change fixes automake bug#11007.

Since git commit 0c928da9 of 21-06-2010, "tcc: Draft suppoprt for
-MD/-MF options" (sic, with typo in summary line), tcc has supported
automatic dependency generation with a command-line interface
similar to what old (pre-8.0) Intel compilers did.  This caused
Automake-generated code for automatic dependency tracking to
recognize tcc dependency style as "icc".  However, the format of
the dependency files generated by tcc is apparently different enough
from that of icc to cause spurious failures in the post-processing
operated by our 'depcomp' script on such files.

The failure was exposed with the development version of tcc 0.9.26
(as installed with debian package "tcc 0.9.26~git20120104.83d") by
test case 'depcomp-auto.tap' (available only in the master branch).

* lib/depcomp (icc): Cater to tcc as well.  Update comments
accordingly.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com>
---
 NEWS        |    5 +++++
 lib/depcomp |   31 ++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 8809d2c..11ce4c9 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,11 @@ New in 1.11.0a:
 
 * Miscellaneous changes:
 
+  - There is an initial, experimental support for automatic dependency
+    tracking with tcc (the Tiny C Compiler).  Its associated depmode is
+    currently recognized as "icc" (but this and other details are likely
+    to change in future versions).
+
   - Automatic dependency tracking now works also with the IBM XL C/C++
     compilers, thanks to the new new depmode 'xlc'.
 
diff --git a/lib/depcomp b/lib/depcomp
index 325713f..25a39e6 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2012-03-12.15; # UTC
+scriptversion=2012-03-27.16; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
 # 2011, 2012 Free Software Foundation, Inc.
@@ -289,23 +289,26 @@ aix)
   ;;
 
 icc)
-  # Intel's C compiler understands '-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+  # However on
+  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   # ICC 7.0 will fill foo.d with something like
   #    foo.o: sub/foo.c
   #    foo.o: sub/foo.h
-  # which is wrong.  We want:
+  # which is wrong.  We want
   #    sub/foo.o: sub/foo.c
   #    sub/foo.o: sub/foo.h
   #    sub/foo.c:
   #    sub/foo.h:
   # ICC 7.1 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
+  # and will wrap long lines using '\':
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
-
+  # tcc 0.9.26 (FIXME still under development at the moment of writing)
+  # will emit a similar output, but also prepend the continuation lines
+  # with horizontal tabulation characters.
   "$@" -MD -MF "$tmpdepfile"
   stat=$?
   if test $stat -eq 0; then :
@@ -318,11 +321,17 @@ icc)
   # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
   # Do two passes, one to just change these to
   # '$object: dependent.h' and one to simply 'dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
+    < "$tmpdepfile" > "$depfile"
+  sed '
+    s/[ '"$tab"'][ '"$tab"']*/ /g
+    s/^ *//
+    s/ *\\*$//
+    s/^[^:]*: *//
+    /^$/d
+    /:$/d
+    s/$/ :/
+  ' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-- 
1.7.9

Reply via email to