[gnu.gcc.bug] incorrect preprocessor vars when compiling c++ with gcc

metz@iam.unibe.ch (Igor Metz) (10/18/89)

Michael Tiemann writes:
   ... you can compike C++ programs with 'gcc' (as opposed to 'g++) and the
   right things will happen, provided you have named your files with the
   right extension....

Well, this is not exactly true! Watch this:

1) compiling foo.c with gcc -v gives
 gcc version 1.36
  /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -
 __sun__ -D__unix__ foo.c /usr/tmp/cca05299.cpp
 GNU CPP version 1.36
  /usr/local/lib/gcc-cc1 /usr/tmp/cca05299.cpp -quiet -dumpbase foo.c -version -
  /usr/tmp/cca05299.s
 GNU C version 1.36 (sparc) compiled by GNU C version 1.36.
 default target switches: -mfpu -mepilogue
  as -o foo.o /usr/tmp/cca05299.s
  ld -e start -dc -dp /lib/crt0.o foo.o /usr/local/lib/gcc-gnulib -lc

2) compiling foo.cc with gcc -v gives
 gcc version 1.36
  /usr/local/lib/gcc-cpp -+ -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc_
 _ -D__sun__ -D__unix__ foo.cc /usr/tmp/cca05305.cpp
 GNU CPP version 1.36
  /usr/local/lib/gcc-cc1plus /usr/tmp/cca05305.cpp -quiet -dumpbase foo.cc -vers
 ion -o /usr/tmp/cca05305.s
 GNU C++ version 1.35.1- (sparc) compiled by GNU C version 1.35.
  as -o foo.o /usr/tmp/cca05305.s
  ld -e start -dc -dp /lib/crt0.o foo.o /usr/local/lib/gcc-gnulib -lc

When compiling foo.cc, gcc should:

 - define -D__GNUG__ instead of -D__GNUC__
 - call ld with -lg++ and with /usr/local/lib/crt0+ (is this obsolete with
   g++ 1.36.0 ?)

Igor Metz                    X400: metz@iam.unibe.ch
Institut fuer Informatik     ARPA: metz%iam.unibe.ch@relay.cs.net
und angewandte Mathematik    UUCP: ..!uunet!mcvax!iam.unibe.ch!metz
Universitaet Bern            Phone: (0041) 31 65 49 90
Switzerland		     Fax:   (0041) 31 65 39 65