This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in integrated cpp


Kaveh R. Ghazi wrote:-

> compiled as a C++ program (via gcc -save-temps -pedantic foo.cc) yields:

> cc1plus: Output filename specified twice
> foo.cc: In function `int main()':
> foo.cc:5: `printf' undeclared (first use this function)
> foo.cc:5: (Each undeclared identifier is reported only once for each
> function 
>    it appears in.)
> 
> (The fact that I used -save-temps is the trigger.)

OK, I'll look into it.

> Whereas when compiled as a C program it says:
> 
> /usr/include/stdio.h:1:28: warning: extra tokens at end of #line directive
> 
> That's triggered by -pedantic.  I don't know if the above warning is
> valid or not.  But I don't think so.

Yes, the warning is valid for #line directives, and is even tested in
the test suite I think.

However, this is reprocessed input and I think we should turn it off
in that case; probably it's better to turn it off for the "#" but not
"#line" case.  We're going to need to distinguish the two anyway to
maintain consistency with escaping.  Zack?

> Anyway I'd hazard a guess, at least for the C++ case, that there is a
> spec file problem with -save-temps WRT the integrated preprocessor.

-save-temps should invoke the external CPP, and then the integrated
CPP + cc1plus combo should read in the preprocessed input.  Obviously
this is being treated subtly different to just cc1plus on its own;
though I don't know why at present.

> The input file appears twice and the second time it doesn't get read
> in by cpp due to the input file caching cleverness.

I don't think so - they're 2 separate processes with -save-temps:
external cpp, followed by the integrated combo on the .i file.

> I don't quite grok the spec files though, so I'll leave it to you
> for finding a fix.

Gee, thanks :-) :-)

Neil.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]