This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ does not set correct Preprocessorvariable if Fileextension is .cpp
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: g++ does not set correct Preprocessorvariable if Fileextension is .cpp
- From: Klaus Steinberger <Klaus dot Steinberger at Physik dot Uni-Muenchen dot DE>
- Date: Tue, 8 Jun 1999 14:15:44 +0200
Hello,
I've trying to port KDE to an SGI IRIX system. Through this work, I discovered
a bug in g++. It does not set the correct preprocessor variables if the
extension is not the usual .C,.cxx,.c++. The KDE people did use .cpp (for
whatever reason). g++ then defines -D__LANGUAGE_C instead of the correct
value -D__LANGUAGE_C_PLUS_PLUS, which is needed for IRIX include Files.
egcs Version:
distr@beethoven> gcc -v
Reading specs from /usr/local/lib/gcc-lib/mips-sgi-irix6.4/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
I append a patch which adds the necessary things to gcc/config/mips/mips.h,
but I think the mechanism in mips.h to decide between C and C++ should be
changed to more generic way.
Sincerely,
Klaus
--
Klaus Steinberger Beschleunigerlabor der TU und LMU Muenchen
Phone: (+49 89)289 14287 Hochschulgelaende, D-85748 Garching, Germany
FAX: (+49 89)289 14280 EMail: Klaus.Steinberger@Physik.Uni-Muenchen.DE
URL: http://www.bl.physik.tu-muenchen.de/~k2/
In a world without fences and walls, who needs Windows and Gates?
*** mips.h.orig Tue Jun 8 14:11:01 1999
--- mips.h Tue Jun 8 14:11:30 1999
***************
*** 918,929 ****
#ifndef CPP_SPEC
#define CPP_SPEC "\
%{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C -D__LANGUAGE_C -D_LANGUAGE_C} \
%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
%{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
! %{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \
%(subtarget_cpp_size_spec) \
%{mips3:-U__mips -D__mips=3 -D__mips64} \
%{mips4:-U__mips -D__mips=4 -D__mips64} \
--- 918,930 ----
#ifndef CPP_SPEC
#define CPP_SPEC "\
%{.cc: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
+ %{.cpp: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.cxx: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.C: -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS} \
%{.m: -D__LANGUAGE_OBJECTIVE_C -D_LANGUAGE_OBJECTIVE_C -D__LANGUAGE_C -D_LANGUAGE_C} \
%{.S: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
%{.s: -D__LANGUAGE_ASSEMBLY -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
! %{!.S: %{!.s: %{!.cc: %{!.cpp: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}}} \
%(subtarget_cpp_size_spec) \
%{mips3:-U__mips -D__mips=3 -D__mips64} \
%{mips4:-U__mips -D__mips=4 -D__mips64} \
PGP signature