[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Re: SoC fortran procedure pointers
From:       "=?UTF-8?Q?Ram=C3=B3n_Garc=C3=ADa?=" <ramon.garcia.f () gmail ! com>
Date:       2007-03-29 20:25:11
Message-ID: daa40b5d0703291325p6d35082ave719c70e87b5bb07 () mail ! gmail ! com
[Download RAW message or body]

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

Here it is attached.

["fortran.diff" (text/x-patch)]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic