[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] depcomp: add new one-pass depmode for MSVC 7 and later.
From: |
Peter Rosin |
Subject: |
Re: [PATCH] depcomp: add new one-pass depmode for MSVC 7 and later. |
Date: |
Thu, 07 Oct 2010 22:57:53 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 |
Hi Ralf!
Den 2010-10-07 20:45 skrev Ralf Wildenhues:
> first off, apologies to Stefano and you for my glacier-like review
> progress; I hope to get a bigger chunk of time this weekend, to be
> able to look at some of the longer threads.
You don't need to apologize, you are practically carrying this
burden all by yourself. As long as it's within a week or two
you are doing a *great* job!
> * Peter Rosin wrote on Wed, Oct 06, 2010 at 05:55:44PM CEST:
>> I noticed that MSVC 7 and above sports the option -showIncludes
>
>> cl -showIncludes foo.c
>> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for
>> 80x86
>> Copyright (C) Microsoft Corporation. All rights reserved.
>>
>> foo.c
>> Note: including file: c:\cygwin\home\peda\junk\bar.h
> [...]
>> So, taking advantage of that I'm proposing this depcomp update.
>
> Nice.
Yes, I like this too. Obviously.
>> The patch is based on the msvc branch.
>
>> The old MSVC depmodes are still
>> needed for MSVC 6 so can't be deleted without causing a regression.
>>
>> The testsuite seems happy (but I only ran the depcomp*.test tests).
>
> OK with minor nits below addressed.
Thanks for the review!
>> Subject: [PATCH] depcomp: add new one-pass depmode for MSVC 7 and later.
>>
>> * lib/depcomp: Add new depmodes 'msvc7' and 'msvc7msys' which
>> make use of the -showIncludes option added in MSVC 7.
>> * m4/depend.m4 (_AM_DEPENDENCIES): Handle the new depmodes
>> similarly to 'msvisualcpp' and 'msvcmsys' as MSVC does not
>> support the -o option.
>
>> --- a/lib/depcomp
>> +++ b/lib/depcomp
>
>> + echo "$object : \\" > "$depfile"
>> + sed -n '/^Note: including file: *\(.*\)/ { s//\1/; s/\\/\\\\/g; p; }' <
>> "$tmpdepfile" \
>
> You need a newline after {.
> Between { and }, replace all ; with newlines.
Ok. I actually did that after sending, mainly to shorten the above
line, but then reverted after deciding not to bother sending another
update.
Oh well :-)
>> + | $cygpath_u
>
>> | sort -u | sed -n -e '
>> +s/ /\\ /g
>> +s/\(.*\)/ \1 \\/p
>> +s/.\(.*\) \\/\1:/
>> +H
>> +$ {
>> + s/.*/ /
>> + G
>> + p
>> +}' >> "$depfile"
>
> This sed script is fairly sophisticated (and relies on sed having
> large-enough pattern and hold spaces. It might deserve a comment
> or two (but note that comments inside sed scripts are not portable).
> Due to the space requirement, I wouldn't want to reuse it for some
> of the other (non-w32) vendor depcomp modes.
I ended up with this text:
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
>>> +if test "$depmode" = msvc7msys; then
>>> + # This is just like msvc7 but w/o cygpath translation.
>>> + # Just convert the backslashes to forward slashes to satisfy
>>> + # depend.m4
>>> + cygpath_u='sed s,\\\\,/,g'
>>> + depmode=msvc7
>>> +fi
>>
>> The above comment should be the same as the one in the previous block.
>> I'm fixing locally, in wait for a review.
>
> The comments should be the same, except the lower one should still state
> "just like msvc7" rather than "just like msvisualcpp". (I'm guessing
> you're doing it just that way.)
Right.
I have committed as below and merged to master and pushed.
Hmmm, I had to rebase too.
Cheers,
Peter
>From ac61cea11285d5bd4256aa3f94acf7b602ab8daf Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Thu, 7 Oct 2010 22:27:53 +0200
Subject: [PATCH] depcomp: add new one-pass depmode for MSVC 7 and later.
* lib/depcomp: Add new depmodes 'msvc7' and 'msvc7msys' which
make use of the -showIncludes option added in MSVC 7.
* m4/depend.m4 (_AM_DEPENDENCIES): Handle the new depmodes
similarly to 'msvisualcpp' and 'msvcmsys' as MSVC does not
support the -o option.
Signed-off-by: Peter Rosin <address@hidden>
---
ChangeLog | 9 ++++++++
lib/depcomp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
m4/depend.m4 | 2 +-
3 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d829a23..3f9002e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-07 Peter Rosin <address@hidden>
+
+ depcomp: add new one-pass depmode for MSVC 7 and later.
+ * lib/depcomp: Add new depmodes 'msvc7' and 'msvc7msys' which
+ make use of the -showIncludes option added in MSVC 7.
+ * m4/depend.m4 (_AM_DEPENDENCIES): Handle the new depmodes
+ similarly to 'msvisualcpp' and 'msvcmsys' as MSVC does not
+ support the -o option.
+
2010-09-21 Peter Rosin <address@hidden>
compile: implement library search to support MSVC static linking
diff --git a/lib/depcomp b/lib/depcomp
index df8eea7..c3163be 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-10-07.20; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,10 +90,18 @@ if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
- cygpath_u="sed s,\\\\\\\\,/,g"
+ cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -405,6 +413,52 @@ tru64)
rm -f "$tmpdepfile"
;;
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/ \1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/ /
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
diff --git a/m4/depend.m4 b/m4/depend.m4
index 8304180..652c4c0 100644
--- a/m4/depend.m4
+++ b/m4/depend.m4
@@ -110,7 +110,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
break
fi
;;
- msvisualcpp | msvcmsys)
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
--
1.7.1