[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more on gcc 2.95 C++ problem



joel at oarcorp.com wrote:

> Hi,
>
> I have not investigated this much but have found a hint that may trip
> someone else into figuring this one out. :)

FYI: I managed to create a small example to reproduce at least one bug
related to RTEMS's problems with gcc-2.95.

To reproduce:
* Untar the archive below
* configure it:
# cd cxx-specs-test-0
# CXX=<target>-g++ RANLIB=<target>-ranlib ./configure
* try to build it
# make

I am able to successfully compile this example with a native gcc-2.95 and all
egcs-1.1.2 cross-compilers I have tried so far on a i686-pc-linux-gnu host.

However, gcc-2.95.1 (from CVS) for sh-rtems fails:

# make
Making all in src
make[1]: Entering directory `/users/rtems/cxx-specs-test-0/src'
sh-rtems-g++ -I../lib/include \
-Wall -ansi -fasm -g -O2 -c -o tmp.o tmp.cc
sh-rtems-g++ -B../lib/ -specs specs    \
-Wall -ansi -fasm -g -O2 -o tmp1.o -c tmp.cc
In file included from tmp.cc:1:
../lib/include/tmp.h:8: declaration of `const int rtemsTask::rtemsTask'
../lib/include/tmp.h:5: conflicts with previous declaration `void
rtemsTask::rtemsTask(int)'
../lib/include/tmp.h:8: parse error before `&'
make[1]: *** [tmp1.o] Error 1
make[1]: Leaving directory `/users/rtems/cxx-specs-test-0/src'
make: *** [all-recursive] Error 1

IMO, this shows that the bug probably is related to using -B (-specs doesn't
seem to matter).

Adding -v to CXXFLAGS shows that
* the include paths are identical in both cases
* the commands to invoke cc1plus are identical
* the arguments to cpp differ in one option (-isystem ../lib/include vs
-I../lib/include)

With -B:
 /opt/rtems/gcc-2.95/lib/gcc-lib/sh-rtems/2.95/cpp -lang-c++ -v -isystem
../lib/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus
-trigraphs -D__STRICT_ANSI__ -D__sh__ -D__rtems__ -D__rtems__ -D__rtems
-Asystem(rtems) -Acpu(sh) -Amachine(sh) -D__EXCEPTIONS -Wall -D__sh1__ tmp.cc
/tmp/cckOFNvr.ii

Using -I:
 /opt/rtems/gcc-2.95/lib/gcc-lib/sh-rtems/2.95/cpp -lang-c++ -v
-I../lib/include -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus
-trigraphs -D__STRICT_ANSI__ -D__sh__ -D__rtems__ -D__rtems__ -D__rtems
-Asystem(rtems) -Acpu(sh) -Amachine(sh) -D__EXCEPTIONS -Wall -D__sh1__
tmp.cc /tmp/cc5vyD4j.ii

AFAIS, this indicates that cpp might have problem with -isystem ...

Ralf.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cxx-specs-test-0.tar.gz
Type: application/x-gzip
Size: 22436 bytes
Desc: not available
Url : http://rtems.rtems.org/pipermail/rtems-users/attachments/19990805/e02ecf94/attachment.gz