This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH]: Avoid C++ keywords in the FORTRAN directory
On Fri, 18 Jul 2008, Tobias Burnus wrote:
> >> try -> gfc_try if gfc_try is not already used
> >> protected -> is_protected
> >> operator -> oper
> >>
> >
> > Go with op. If you look in gfc_expr, you'll find uop is
> > used with the gfc_user_op structure.
> >
> I also prefer "op".
>
> >> new -> gfc_new if not already used
> >>
> >> Also, since this is a fairly mechanical patch, I do not see why it can
> >> not just go straight in as long as it is bootstrapped. Or, one could
> >> consider doing one patch for each keyword. That will simplify the
> >> review process.
> >>
> > Otherwise, I agree with everything you wrote
> Ditto from my side.
Okay, patch below is what I installed using "gfc_try", "is_protected",
"op" and "gfc_new".
Did you want to review the mechanical patches to finish the conversion, or
would you like to preapprove those changes?
Thanks,
--Kaveh
2008-07-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* arith.c (eval_type_intrinsic0): Avoid C++ keywords.
* gfortran.h (try, protected, operator, new): Likewise.
diff -rup orig/egcc-SVN20080718/gcc/fortran/arith.c egcc-SVN20080718/gcc/fortran/arith.c
--- orig/egcc-SVN20080718/gcc/fortran/arith.c 2008-06-20 08:19:02.000000000 +0200
+++ egcc-SVN20080718/gcc/fortran/arith.c 2008-07-18 19:28:20.000000000 +0200
@@ -1739,12 +1739,12 @@ runtime:
/* Modify type of expression for zero size array. */
static gfc_expr *
-eval_type_intrinsic0 (gfc_intrinsic_op operator, gfc_expr *op)
+eval_type_intrinsic0 (gfc_intrinsic_op iop, gfc_expr *op)
{
if (op == NULL)
gfc_internal_error ("eval_type_intrinsic0(): op NULL");
- switch (operator)
+ switch (iop)
{
case INTRINSIC_GE:
case INTRINSIC_GE_OS:
diff -rup orig/egcc-SVN20080718/gcc/fortran/gfortran.h egcc-SVN20080718/gcc/fortran/gfortran.h
--- orig/egcc-SVN20080718/gcc/fortran/gfortran.h 2008-07-03 02:00:14.000000000 +0200
+++ egcc-SVN20080718/gcc/fortran/gfortran.h 2008-07-18 19:28:36.000000000 +0200
@@ -114,9 +114,11 @@ io_kind;
following enum makes things much more readable. We also start
values off at one instead of zero. */
+/* FIXME: This macro is temporary until we convert everything. */
+#define try gfc_try
typedef enum
{ SUCCESS = 1, FAILURE }
-try;
+gfc_try;
/* This is returned by gfc_notification_std to know if, given the flags
that were given (-std=, -pedantic) we should issue an error, a warning
@@ -625,7 +627,9 @@ typedef struct
ENUM_BITFIELD (save_state) save:2;
unsigned data:1, /* Symbol is named in a DATA statement. */
- protected:1, /* Symbol has been marked as protected. */
+ /* FIXME: This macro is temporary until we convert everything. */
+#define protected is_protected
+ is_protected:1, /* Symbol has been marked as protected. */
use_assoc:1, /* Symbol has been use-associated. */
use_only:1, /* Symbol has been use-associated, with ONLY. */
use_rename:1, /* Symbol has been use-associated and renamed. */
@@ -980,13 +984,14 @@ gfc_interface;
#define gfc_get_interface() XCNEW (gfc_interface)
-
+/* FIXME: This macro is temporary until we convert everything. */
+#define operator op
/* User operator nodes. These are like stripped down symbols. */
typedef struct
{
const char *name;
- gfc_interface *operator;
+ gfc_interface *op;
struct gfc_namespace *ns;
gfc_access access;
}
@@ -1052,7 +1057,9 @@ typedef struct gfc_symbol
the old symbol. */
struct gfc_symbol *old_symbol, *tlink;
- unsigned mark:1, new:1;
+ /* FIXME: This macro is temporary until we convert everything. */
+#define new gfc_new
+ unsigned mark:1, gfc_new:1;
/* Nonzero if all equivalences associated with this symbol have been
processed. */
unsigned equiv_built:1;