$ gcc -v Reading specs from /fs/pkgs/mount/package/misc/spf/gcc-3.4.0/bin/../lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/package/misc/spf/gcc-3.4.0 --disable-nls --enable-libgcj --with-as=/package/misc/spf/gcc-3.4.0/spf/as --with-ld=/package/misc/spf/gcc-3.4.0/spf/ld --enable-threads Thread model: posix gcc version 3.4.0 $ echo $'#include <foo.h>\n#include "bar.h"' | gcc -xc /dev/stdin -E -MM -MG stdin.o: /dev/stdin foo.h bar.h Previous versions of gcc (I checked 2.95.3, 3.2.3, and 3.3.3) do not include foo.h in the output, which is appropriate, since foo.h would not be searched for in the source directory when actually compiling the file. Jim Wilson has some ideas: http://gcc.gnu.org/ml/gcc/2004-04/msg01413.html
Confirmed but something else is a regression from 3.2.3. Before 3.3, GCC used to warn about foo.h being missing so there might be more to what caused it than what Jim thinks.
Retargeting to 3.4.1, being a regression on that release branch.
Neil, I'm not going to hold up 3.4.1 for this patch, but would you please take a look at this problem?
Postponed until GCC 3.4.3.
Postponed until GCC 3.4.4.
Ow. The dependencies are emitted in open_file_failed in libcpp/files.c; but that routine *doesn't know* whether the file was called for in a <> or a "" directive. Fixing this requires some restructuring of libcpp code so that the dependencies are emitted in a place which does know (perhaps the same place, but that requires a lot of extra information passing).
Subject: Re: [3.3/3.4/4.0 regression] "gcc -E -MM -MG" reports missing system headers in source directory neroden at gcc dot gnu dot org wrote:- > > ------- Additional Comments From neroden at gcc dot gnu dot org 2004-11-27 23:18 ------- > Ow. The dependencies are emitted in open_file_failed in libcpp/files.c; but > that routine *doesn't know* whether the file was called for in a <> or a "" > directive. > > Fixing this requires some restructuring of libcpp code so that the > dependencies are emitted in a place which does know (perhaps the same place, > but that requires a lot of extra information passing). Note that current behaviour was discussed and agreed in a thread in 2003, on a previous bug report about prior behaviour. Neil.
Neil, would you mind updating the status of this bug so that it doesn't appear as a critical regression against 3.4.x and 4.0? If the observed behaviour is the intended one, please close the bug as WONTFIX.
3.4 is a lost cause by this point, but I'd really like to see this fixed for 4.0. My build system needs this to track dependencies. What exactly was agreed before - the lack of the warning, or the misleading outfor for missing <foo.h> files? (I don't care about the warning.) Got a link to that thread?
I believe the bug Neil referred to in comment #7 is bug preprocessor/6521 from May 2002.
Ok, bug preprocessor/6521 looks like it had the same symptom I see now with 3.4. Neil and Zack didn't think it was worth fixing at first, but it did get fixed, and managed to stay fixed through 3.3. I agree with the comments that it's not very important how -MG handles <> headers, but what does matter to me is that they are not made to look like "" headers. I use "gcc -E -MM -MG foo.c 2> /dev/null" and parse the output to find out which "" headers would need to be generated in order to compile this file. If <> headers are included in that list, I get unnecessary build failures, since some headers that I can't provide appear to be needed (but actually aren't). It would be ok with me if <> headers were ignored entirely for -MG. As it is, they are ignored only if they exist - otherwise, 3.4 gives misleading output, 3.3 is silent, and earlier versions warn.
I don't see why this is critical.
Moving to 4.0.2 pre Mark.
Subject: Bug 15220 CVSROOT: /cvs/gcc Module name: gcc Changes by: wilson@gcc.gnu.org 2005-10-21 17:54:20 Modified files: libcpp : ChangeLog files.c init.c internal.h Log message: Fix bug with -MM -MG. PR preprocessor/15220 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all callers. Pass to open_file_failed. (open_file_failed): New parameter angle_brackets. Fix all callers. Use in print_dep assignment. * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file. * internal.h (_cpp_find_file): Add new parm to declaration. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/ChangeLog.diff?cvsroot=gcc&r1=1.79&r2=1.80 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/files.c.diff?cvsroot=gcc&r1=1.13&r2=1.14 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/init.c.diff?cvsroot=gcc&r1=1.11&r2=1.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/internal.h.diff?cvsroot=gcc&r1=1.16&r2=1.17
Subject: Bug 15220 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: wilson@gcc.gnu.org 2005-10-21 17:56:51 Modified files: libcpp : ChangeLog files.c internal.h init.c Log message: Fix bug with -MM -MG. PR preprocessor/15220 * files.c (_cpp_find_file): New parameter angle_brackets. Fix all callers. Pass to open_file_failed. (open_file_failed): New parameter angle_brackets. Fix all callers. Use in print_dep assignment. * init.c (cpp_read_main_file): Pass additional arg to _cpp_find_file. * internal.h (_cpp_find_file): Add new parm to declaration. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.56.2.11&r2=1.56.2.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/files.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9.6.1&r2=1.9.6.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/internal.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.13&r2=1.13.6.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libcpp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.7&r2=1.7.6.1
Subject: Bug 15220 CVSROOT: /cvs/gcc Module name: gcc Changes by: wilson@gcc.gnu.org 2005-10-21 18:04:22 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.misc-tests: mg-2.exp mg-2.c Log message: Fix -MM -MG bug. PR preprocessor/15220 * gcc.misc-tests/mg-2.c, gcc.misc-tests/mg-2.exp: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6226&r2=1.6227 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.misc-tests/mg-2.exp.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.misc-tests/mg-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 15220 Author: wilson Date: Mon Nov 7 19:49:04 2005 New Revision: 106608 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106608 Log: Fix problem with -MM -MG and missing system header files. PR preprocessor/15220 * cppfiles.c (_cpp_find_file): New parameter angle_brackets. Fix all callers. Pass to open_file_failed. (open_file_failed): New parameter angle_brackets. Fix all callers. use in print_dep assignment. * cpphash.h (_cpp_find_file): Add new parm to declaration. * cppinit.c (cpp_read_main_file): Pass another arg to _cpp_find_file. Modified: branches/gcc-3_4-branch/gcc/ChangeLog branches/gcc-3_4-branch/gcc/cppfiles.c branches/gcc-3_4-branch/gcc/cpphash.h branches/gcc-3_4-branch/gcc/cppinit.c
Mine.
Fixed on gcc-3.4.x branch, gcc-4.0.x branch, and mainline.