jkmcnk / sx-gcc

The GNU Compiler Collection port to NEC SX CPU architecture.
GNU General Public License v2.0
0 stars 2 forks source link

the "C" and "C++" linkage conflict in some test cases #140

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We are getting really close to fixing all the test case issues for sx-g++... :)

There is only one larger group of failed test cases left. Let's look at the
 "g++.dg/eh/crossjump1.C" test case, which is one of its members. When we
try to compile this test case with the command below:

<path-to-gcc-build-directory>/gcc/g++ -I
<path-to-gcc-build-directory>/gcc/include/C++
<path-to-gcc-directory>/gcc/testsuite/g++.dg/eh/crossjump1.C -O0 -o
./crossjump1.exe

we get the following compile-time error:

In file included from
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/../../../../sx8-nec-supe
rux/include/c++/4.2.2/cctype:51,
                 from
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/../../../../sx8-nec-supe
rux/include/c++/4.2.2/iosfwd:47,
                 from
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/../../../../sx8-nec-supe
rux/include/c++/4.2.2/bits/stl_algobase.h:70,
                 from
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/../../../../sx8-nec-supe
rux/include/c++/4.2.2/bits/char_traits.h:46,
                 from
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/../../../../sx8-nec-supe
rux/include/c++/4.2.2/string:47,
                 from
/nfs/home3/nec/nec/hwwnecjm/testbox/gcc/gcc/testsuite/g++.dg/eh/crossjump1.C:8:
<path-to-gcc-build-directory>/gcc/include/C++/stdlib.h:159: error: previous
declaration of ‘char _ctype []’ with ‘C++’ linkage
<path-to-sx-header-files>/lib/gcc/sx8-nec-superux/4.2.2/include/ctype.h:83:
error: conflicts with new declaration with ‘C’ linkage

The problem is the fact that we have two external declarations of the
"_ctype" variable: 
    * extern "C" char _ctype []’;
    * extern "C++" char _ctype []’;

Original issue reported on code.google.com by nou...@gmail.com on 8 Jul 2009 at 12:22

GoogleCodeExporter commented 8 years ago
On the other hand, if we take out the "-I
<path-to-gcc-build-directory>/gcc/include/C++" header path from the compilation 
command:

<path-to-gcc-build-directory>/gcc/g++
<path-to-gcc-directory>/gcc/testsuite/g++.dg/eh/crossjump1.C -O0 -o 
./crossjump1.exe

the test case compiles fine.

Original comment by nou...@gmail.com on 8 Jul 2009 at 12:25

GoogleCodeExporter commented 8 years ago
This issue is fixed in r306.

Original comment by nou...@gmail.com on 13 Jul 2009 at 4:27