Sunos4 bootstrap failure, bug in cpp's implicit extern "C" marking
Zack Weinberg
zack@wolery.cumb.org
Wed Mar 1 13:29:00 GMT 2000
On Wed, Mar 01, 2000 at 02:52:14PM -0500, Kaveh R. Ghazi wrote:
> I'm still getting the following error when bootstrapping on
> sunos4 when compiling libstdc++/cinst.cc:
>
> > ../../../egcs-CVS20000229/libstdc++/cinst.cc -o fcomplex.o
> > In file included from ../../../egcs-CVS20000229/libstdc++/complex:7,
> > from ../../../egcs-CVS20000229/libstdc++/std/complext.cc:28,
> > from ../../../egcs-CVS20000229/libstdc++/cinst.cc:29:
> > /a/caip/a99/u99/ghazi/gcc-testing/sunos-test/build/gcc/include/math.h:67:
> > previous declaration of `double hypot (double, double)' with C++ linkage
> > ../../../egcs-CVS20000229/libstdc++/std/complext.h:314:
> > conflicts with new declaration with C linkage
> > make[2]: *** [bigstmp-complx] Error 1
>
> Note that the "fixed" math.h on sunos4 is giving C++ linkage to its
> functions. This has been happening since at least as far back as:
>
> http://gcc.gnu.org/ml/gcc-bugs/2000-02/msg00142.html
>
> I thought this would have been fixed with the patch that corrected the
> "in system header" stuff, but its not.
>
> I looked a bit at the code to do implicit extern "C" on system headers
> and saw this in cpplib.c:output_line_command()
>
> > /* Tell cc1 if following text comes from a system header file. */
> > if (ip->system_header_p)
> > {
> > CPP_PUTC_Q (pfile, ' ');
> > CPP_PUTC_Q (pfile, '3');
> > }
> > #ifndef NO_IMPLICIT_EXTERN_C
> > /* Tell cc1plus if following text should be treated as C. */
> > if (ip->system_header_p == 2 && CPP_OPTIONS (pfile)->cplusplus)
> > {
> > CPP_PUTC_Q (pfile, ' ');
> > CPP_PUTC_Q (pfile, '4');
> > }
> > #endif
>
> For Sunos4, NO_IMPLICIT_EXTERN_C is not defined, so the code above is
> activated and I verified this by looking at cpplib.i.
>
> When I look at cinst.ii, I see the following line directives for math.h:
>
> # 1 "/a/caip/a99/u99/ghazi/gcc-testing/sunos-test/build/gcc/include/math.h" 1 3
> # 57 "/a/caip/a99/u99/ghazi/gcc-testing/sunos-test/build/gcc/include/math.h" 2 3
> # 165 "/a/caip/a99/u99/ghazi/gcc-testing/sunos-test/build/gcc/include/math.h" 3
>
> I see the 3, indicating math.h is a system header, but I don't see a 4
> to indicate implicit extern "C".
Indeed - ip->system_header_p is never set to 2. I am testing a fix
for this right now, but there are complications. Should be out
sometime today.
zw
More information about the Gcc-bugs
mailing list