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?

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.