This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran, committed] readability updates to resolve.c



This is another patch that had been lying in one of my trees. It adds an explaining comment to resolve_symbol, and makes the code in check_data_variable more readable by not using numbers for the mark variable, but ar_type values instead, and therefore explaining what is meant.


Built and tested on i686-pc-linux.

- Tobi

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/ChangeLog,v
retrieving revision 1.79
diff -u -p -r1.79 ChangeLog
--- ChangeLog   21 Jun 2004 17:16:24 -0000      1.79
+++ ChangeLog   21 Jun 2004 17:23:24 -0000
@@ -1,5 +1,11 @@
 2004-06-21  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

+       * resolve.c (resolve_symbol): Add comment in function body.
+       (check_data_variable): Change type of mark to ar_type, adapt code
+       accordingly.
+
+2004-06-21  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
        * array.c (gfc_insert_constructor): Avoid redundant call to
        mpz_comp. Add 2004 to copyright years.

Index: resolve.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/resolve.c,v
retrieving revision 1.6
diff -u -p -r1.6 resolve.c
--- resolve.c   15 Jun 2004 21:50:48 -0000      1.6
+++ resolve.c   21 Jun 2004 17:23:24 -0000
@@ -3724,6 +3724,9 @@ resolve_symbol (gfc_symbol * sym)
        }
     }

+  /* Assumed size arrays and assumed shape arrays must be dummy
+     arguments.  */
+
   if (sym->as != NULL
       && (sym->as->type == AS_ASSUMED_SIZE
          || sym->as->type == AS_ASSUMED_SHAPE)
@@ -3945,7 +3948,7 @@ check_data_variable (gfc_data_variable *
   mpz_t size;
   mpz_t offset;
   try t;
-  int mark = 0;
+  ar_type mark = AR_UNKNOWN;
   int i;
   mpz_t section_index[GFC_MAX_DIMENSIONS];
   gfc_ref *ref;
@@ -3982,14 +3985,14 @@ check_data_variable (gfc_data_variable *
       switch (ref->u.ar.type)
        {
        case AR_FULL:
-         mark = 1;
+         mark = AR_FULL;
          break;

        case AR_SECTION:
           ar = &ref->u.ar;
           /* Get the start position of array section.  */
           gfc_get_section_index (ar, section_index, &offset);
-          mark = 2;
+          mark = AR_SECTION;
          break;

        default:
@@ -4024,17 +4027,17 @@ check_data_variable (gfc_data_variable *
       /* Assign initial value to symbol.  */
       gfc_assign_data_value (var->expr, values.vnode->expr, offset);

-      if (mark == 1)
+      if (mark == AR_FULL)
         mpz_add_ui (offset, offset, 1);

       /* Modify the array section indexes and recalculate the offset for
          next element.  */
-      else if (mark == 2)
+      else if (mark == AR_SECTION)
         gfc_advance_section (section_index, ar, &offset);

       mpz_sub_ui (size, size, 1);
     }
-  if (mark == 2)
+  if (mark == AR_SECTION)
     {
       for (i = 0; i < ar->dimen; i++)
         mpz_clear (section_index[i]);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]