From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30625 invoked by alias); 25 Apr 2007 07:42:38 -0000 Received: (qmail 30553 invoked by uid 48); 25 Apr 2007 07:42:23 -0000 Date: Wed, 25 Apr 2007 07:42:00 -0000 Subject: [Bug driver/31694] New: __GFORTRAN__ preprocessor macro X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "fxcoudert at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg01859.txt.bz2 When preprocessing Fortran code (ie when cc1 is called with -lang-fortran) we should define a __GFORTRAN__ macro. Here's a patch that does just that: Index: c-common.h =================================================================== --- c-common.h (revision 124116) +++ c-common.h (working copy) @@ -254,6 +254,9 @@ #define c_dialect_cxx() (c_language & clk_cxx) #define c_dialect_objc() (c_language & clk_objc) +/* FXC */ +extern bool lang_fortran; + /* Information about a statement tree. */ struct stmt_tree_s GTY(()) { Index: c-cppbuiltin.c =================================================================== --- c-cppbuiltin.c (revision 124116) +++ c-cppbuiltin.c (working copy) @@ -569,6 +569,9 @@ if (flag_openmp) cpp_define (pfile, "_OPENMP=200505"); + if (lang_fortran) + cpp_define (pfile, "__GFORTRAN__=1"); + builtin_define_type_sizeof ("__SIZEOF_INT__", integer_type_node); builtin_define_type_sizeof ("__SIZEOF_LONG__", long_integer_type_node); builtin_define_type_sizeof ("__SIZEOF_LONG_LONG__", Index: c-opts.c =================================================================== --- c-opts.c (revision 124116) +++ c-opts.c (working copy) @@ -73,7 +73,7 @@ static bool verbose; /* If -lang-fortran seen. */ -static bool lang_fortran = false; +bool lang_fortran = false; /* Dependency output file. */ static const char *deps_file; -- Summary: __GFORTRAN__ preprocessor macro Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: driver AssignedTo: fxcoudert at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31694