[Bug driver/31694] New: __GFORTRAN__ preprocessor macro
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Apr 25 07:42:00 GMT 2007
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
More information about the Gcc-bugs
mailing list