This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: SoC fortran procedure pointers


You are right that the formatting of the patch is horrible.

Here it is attached.
Sólo en ../../../../gcc-4.1.2/gcc/fortran/: compile_procedure_ptr.diff
diff -x '*~' -u ./decl.c ../../../../gcc-4.1.2/gcc/fortran/decl.c
--- ./decl.c	2006-11-06 18:18:03.000000000 +0100
+++ ../../../../gcc-4.1.2/gcc/fortran/decl.c	2007-03-26 08:10:46.298296687 +0200
@@ -1699,24 +1699,32 @@
     }
 
   m = gfc_match (" type ( %n )", name);
-  if (m != MATCH_YES)
-    return m;
-
-  /* Search for the name but allow the components to be defined later.  */
-  if (gfc_get_ha_symbol (name, &sym))
-    {
-      gfc_error ("Type name '%s' at %C is ambiguous", name);
+  if (m == MATCH_YES) {
+    /* Search for the name but allow the components to be defined later.  */
+    if (gfc_get_ha_symbol (name, &sym))
+      {
+	gfc_error ("Type name '%s' at %C is ambiguous", name);
+	return MATCH_ERROR;
+      }
+    
+    if (sym->attr.flavor != FL_DERIVED
+	&& gfc_add_flavor (&sym->attr, FL_DERIVED, sym->name, NULL) == FAILURE)
       return MATCH_ERROR;
-    }
-
-  if (sym->attr.flavor != FL_DERIVED
-      && gfc_add_flavor (&sym->attr, FL_DERIVED, sym->name, NULL) == FAILURE)
-    return MATCH_ERROR;
+    
+    ts->type = BT_DERIVED;
+    ts->kind = 0;
+    ts->derived = sym;
+    return MATCH_YES;
+  }
 
-  ts->type = BT_DERIVED;
+  m = gfc_match (" procedure ");
+  if (m != MATCH_YES) {
+    return m;
+  }
+  m = gfc_match ("( %n ) ", name);
+  ts->type = BT_PROCEDURE;
   ts->kind = 0;
-  ts->derived = sym;
-
+  ts->derived = NULL; /* FIXME: in case of match, lookup name in symbol table */
   return MATCH_YES;
 
 get_kind:
@@ -2935,7 +2943,6 @@
   return MATCH_YES;
 }
 
-
 /* Return nonzero if we're currently compiling a contained procedure.  */
 
 static int
@@ -2952,6 +2959,7 @@
   return 0;
 }
 
+
 /* Set the kind of each enumerator.  The kind is selected such that it is 
    interoperable with the corresponding C enumeration type, making
    sure that -fshort-enums is honored.  */
Sólo en ../../../../gcc-4.1.2/gcc/fortran/: decl.c.match_proc

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