Bug in integrated cpp
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Fri Nov 3 11:19:00 GMT 2000
With last night's CVS, the following code:
> #include <stdio.h>
>
> int main()
> {
> printf ("hello world\n");
> return 0;
> }
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.)
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.
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.
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 quite
grok the spec files though, so I'll leave it to you for finding a fix.
--Kaveh
PS: this seems platform independant, I saw this on solaris2.7, irix6.2
and x86-linux-gnu.
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc-bugs
mailing list