Bug 7358 - Changes to Sun's make Dependencies
Summary: Changes to Sun's make Dependencies
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.0.4
: P3 normal
Target Milestone: ---
Assignee: Neil Booth
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-19 07:16 UTC by pickina
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pickina 2002-07-19 07:16:01 UTC
Sun Dependencies make object files dependent on C source
even thought this may be a temporary file.

This can make builds fail when using Sun's make.

Release:
3.0.4+

Environment:
Solaris

How-To-Repeat:
If we consider the make file dependency

.c.o:
    @cp $(@:.o=.c) /tmp/tmp.c
    gcc -c /tmp/tmp.c -o $@
    @rm /tmp/tmp.c

[ Don't ask why I'm doing this, I'm not, but it demonstrates the point ]

and we have a single source file main.c

Version 2.9.5 produced dependency

main.o: ...
    <system headers>
    ..... 
    cp main.c /tmp/tmp.c
    gcc -g -O2 -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c

Whereas 3.0.4 produces:

main.o: /tmp/tmp.c 
    ...
    <system headers>
    ..... 
    cp main.c /tmp/tmp.c 
    gcc -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c 

Whereas 3.1.0 produces:

main.o: /tmp/tmp.c 
    cp main.c /tmp/tmp.c 
    gcc -g -O2 -c /tmp/tmp.c -o main.o
    rm /tmp/tmp.c

I have raised the problem with the System Headers previously
[7357] but GCC 3 has introduced a new dependency of object file on the source.

This means that in the best case everything will be compiles twice the first time around, as Sun's make re-reads the dependency list again and identifies a new dependency. In the worst case builds fail as temporary files may nolonger be present.

This is indeed what happens if one uses ccache 
(see ccache.samba.org).
Comment 1 Neil Booth 2002-07-19 13:56:04 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: I haven't a clue what your bug report is trying to say.
    
    1) Is it really a gmake issue?
    2) If it is a GCC issue, please give some code that
       clearly reproduces the problem.
    
    You should also be aware that 3.0.4 had bugs in dependency
    generation.  These are fixed in the unreleased 3.0.5 that
    is in CVS if you need it.  3.0.5, 3.1, 3.2 and 2.95 all
    behave the same way to the best of my knowledge.
Comment 2 Neil Booth 2002-07-22 11:23:40 UTC
Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-Why: Patch being tested.
Comment 3 Neil Booth 2002-07-22 11:23:40 UTC
State-Changed-From-To: feedback->analyzed
State-Changed-Why: Confirmed in 3.1 and 3.2, not in 3.0.  This is the same as
    your other PR/7357, effectively.
Comment 4 Neil Booth 2002-08-14 15:35:10 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed.
Comment 5 Neil Booth 2002-08-14 22:34:51 UTC
From: neil@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: preprocessor/7358
Date: 14 Aug 2002 22:34:51 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	neil@gcc.gnu.org	2002-08-14 15:34:50
 
 Modified files:
 	gcc            : cpplib.h c-opts.c cppfiles.c ChangeLog 
 	gcc/doc        : cppenv.texi 
 
 Log message:
 	PR preprocessor/7358
 	* c-opts.c (check_deps_environment_vars): Ignore main file
 	for SUNPRO_DEPENDENCIES.
 	* cppfiles.c (stack_include_file): Ignore main file if
 	appropriate.
 	* cpplib.h (struct cpp_options): New member in deps.
 	* doc/cppenv.texi: Update.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cpplib.h.diff?cvsroot=gcc&r1=1.233&r2=1.234
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-opts.c.diff?cvsroot=gcc&r1=1.13&r2=1.14
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cppfiles.c.diff?cvsroot=gcc&r1=1.153&r2=1.154
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.15187&r2=1.15188
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/cppenv.texi.diff?cvsroot=gcc&r1=1.3&r2=1.4
 

Comment 6 Neil Booth 2002-08-15 19:46:45 UTC
From: neil@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: preprocessor/7358
Date: 15 Aug 2002 19:46:45 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	neil@gcc.gnu.org	2002-08-15 12:46:44
 
 Modified files:
 	gcc            : ChangeLog cppfiles.c cppinit.c cpplib.h 
 	                 cpplib.c 
 	gcc/testsuite  : ChangeLog 
 	gcc/doc        : cpp.texi cppenv.texi 
 Added files:
 	gcc/testsuite/gcc.dg/cpp: _Pragma3.c vararg3.c vararg4.c 
 
 Log message:
 	PR preprocessor/7358
 	PR preprocessor/7357
 	PR preprocessor/7526
 	* cppfiles.c (stack_include_file): Ignore main file if
 	appropriate.  Correct test of whether a dependency should
 	be output.
 	* cppinit.c (init_dependency_output): Ignore main file
 	for SUNPRO_DEPENDENCIES.
 	(struct lang_flags): Rename trigraphs std.
 	(set_lang): Update.
 	* cpplib.c (run_directive): Kludge so _Pragma dependency works.
 	* cpplib.h (struct cpp_options): New members.
 	* cppmacro.c (collect_args): Flag whether to swallow a possible
 	future comma pasted with varargs.
 	(replace_args): Use this flag.
 	* doc/cpp.texi: Update varargs extension documentation.
 	* doc/cppenv.texi: Update.
 	testsuite:
 	* gcc.dg/cpp/_Pragma3.c, gcc.dg/cpp/vararg3.c, gcc.dg/cpp/vararg4.c:
 	New tests.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.12&r2=1.13152.2.657.2.13
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cppfiles.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.144&r2=1.144.6.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cppinit.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.202.2.5&r2=1.202.2.5.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cpplib.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.201.2.1&r2=1.201.2.1.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cpplib.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.290.2.1&r2=1.290.2.1.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.5&r2=1.1672.2.166.2.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/cpp.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.24.2.3&r2=1.24.2.3.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/cppenv.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1.2.1&r2=1.1.2.1.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/_Pragma3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/vararg3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.8.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/cpp/vararg4.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.8.1
 

Comment 7 Neil Booth 2002-08-15 19:47:46 UTC
From: neil@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: preprocessor/7358
Date: 15 Aug 2002 19:47:46 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	neil@gcc.gnu.org	2002-08-15 12:47:46
 
 Modified files:
 	gcc            : cppmacro.c 
 
 Log message:
 	PR preprocessor/7358
 	PR preprocessor/7357
 	PR preprocessor/7526
 	* cppfiles.c (stack_include_file): Ignore main file if
 	appropriate.  Correct test of whether a dependency should
 	be output.
 	* cppinit.c (init_dependency_output): Ignore main file
 	for SUNPRO_DEPENDENCIES.
 	(struct lang_flags): Rename trigraphs std.
 	(set_lang): Update.
 	* cpplib.c (run_directive): Kludge so _Pragma dependency works.
 	* cpplib.h (struct cpp_options): New members.
 	* cppmacro.c (collect_args): Flag whether to swallow a possible
 	future comma pasted with varargs.
 	(replace_args): Use this flag.
 	* doc/cpp.texi: Update varargs extension documentation.
 	* doc/cppenv.texi: Update.
 	testsuite:
 	* gcc.dg/cpp/_Pragma3.c, gcc.dg/cpp/vararg3.c, gcc.dg/cpp/vararg4.c:
 	New tests.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cppmacro.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.91.6.6&r2=1.91.6.6.2.1