preprocessor/6521: -MG creates dependency with wrong path

Neil Booth neil@daikokuya.demon.co.uk
Tue May 7 23:36:00 GMT 2002


Robert Spier wrote:-

> The only sensible patch I can think of is to remove this odd
> functionality entirely.
> 
> The below patch unifies handling for system and non-system include
> files and removes the special case.  It only affects -MG, and brings
> it in line with the documentation:
> 
>       -MG When used with -M or -MM, -MG says to treat missing
>            header files as generated files and assume they live
>            in the same directory as the source file.  It sup?
>            presses preprocessed output, as a missing header file
>            is ordinarily an error.

On further reflection, I don't think this makes any sense.
Files included with <> do not search the current directory,
so assuming the file lies there is obviously bogus.

The sensible thing to do, IMO, is to step down the <> include
path until the resulting path, when appending the file name,
exists, and to fail if all such paths don't exist.

Neil.



More information about the Gcc-bugs mailing list