[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] depcomp and gcc3 still not safe enough
From: |
Raja R Harinath |
Subject: |
[PATCH] depcomp and gcc3 still not safe enough |
Date: |
17 Feb 2001 19:05:27 -0600 |
User-agent: |
Gnus/5.090001 (Oort Gnus v0.01) Emacs/21.0.97 |
Hi,
GCC 3.0 doesn't still exactly implement exactly what 'depcomp' wants.
The problem is that if the compile fails, the file specified to -MF is
deleted too. With 'gcc -MF $depfile', $depfile is deleted. But,
$depfile is eventually included by the Makefile -- so subsequent
'make' invocations will fail, since an included file doesn't exist.
I don't know if this a GCC bug. I'm assuming it's not -- it makes
sense to clean up if the compile fails; the compiler doesn't provide
rollback for -o, why should it provide rollback for -MF.
Here's a patch to fix this problem. (The 'if' statement looks slightly
peculiar, but it matches similar 'if's used in the rest of the file.)
from Raja R Harinath <address@hidden>
* depcomp (gcc3): Protect against the compiler deleting
the dependency output file.
Index: depcomp
===================================================================
RCS file: /cvs/automake/automake/depcomp,v
retrieving revision 1.17
diff -u -p -u -r1.17 depcomp
--- depcomp 2001/02/10 01:26:54 1.17
+++ depcomp 2001/02/18 00:52:27
@@ -51,8 +51,14 @@ case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay!
- exec "$@" -MT "$object" -MF "$depfile" -MD -MP
- ;;
+ if "$@" -MT "$object" -MF "$tmpdepfile" -MD -MP; then :
+ else
+ stat=$?
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
gcc)
## There are various ways to get dependency output from gcc. Here's
- Hari
--
Raja R Harinath ------------------------------ address@hidden
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash
- [PATCH] depcomp and gcc3 still not safe enough,
Raja R Harinath <=