This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: cpp seems not to include # line "file" output for empty files
"E. Jay Berkenbilt" <ejb@ql.org> writes:
> > It appears that cpp is deciding that it doesn't have to generate the #
> > line output if there is no output from the file. This makes sense for
> > the intend use of these directives for telling the compiler what
> > filename/line number a line of cpp output came from, but it badly
> > hoses dependency generators and other programs that rely on this
> > output for getting a list of files that cpp read. Such functionality
> > is essential for writing portable dependency generators. I feel like
> > I've read this in the ISO standard but I can't seem to find any
> > documentation that firmly states that ISO requires this behavior.
>
> > If you want dependency info from cpp, use the switches to tell it to
> > give you dependency info.
>
> Not portable.
Oh, but expecting a certain format of preprocessor line info is.
>
> > Also, if the file generates no output, then a.c really wasn't dependent
> > on it.
>
> Wrong -- see my example. a.c is most definitely dependent upon a.h.
Um, no.
If it's not using any of a.h, it's not dependent on it, or else it's
output would be necessary.
You are using a definition of dependent that happens to fit your task,
which happens to not be the general definition of dependent.
You could remove the line including a.h, as it stands now, and a.c
would not be affected.
Therefore, a.c is not directly dependending on a.h
--Dan