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]

Re: [Fortran,patch] Add IMPORT support (PR27546)


On Wed, Nov 08, 2006 at 10:59:44AM +0100, Tobias Burnus wrote:
> :ADDPATCH fortran:
> 
> The following patch implements the IMPORT statement of Fortran 2003,
> which can be used to access derived types via host association:
> ...
> Bootstrapped and regression tested (check-gfortran only) on
> x86_64-unknown-linux-gnu (openSUSE 10.2beta2).
> 
> Tobias

Tobias,

I just realized that you are included the ChangeLog entry
in your diff.  Typically, this is discouraged because 
ChangeLog is fairly volatile and patch rejects are possible.
Include the ChangeLog entry in the body of your email.

The patch looks OK after you address the formatting issues.


Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 118545)
+++ gcc/fortran/decl.c	(working copy)
@@ -1482,7 +1489,7 @@
 
   if (gfc_match_char (')') != MATCH_YES)
     {
-      gfc_error ("Missing right paren at %C");
+      gfc_error ("Missing right parenthesis at %C");
       goto no_match;
     }

This isn't mentioned in your ChangeLog.

 
+match
+gfc_match_import (void)
+{
 
+  if (gfc_current_ns->proc_name == NULL ||
+      gfc_current_ns->proc_name->attr.if_source != IFSRC_IFBODY)
+    {
+      gfc_error("IMPORT statement at %C only permitted in "
+	        "an INTERFACE body");

You need a space. i.e., "gfc_error (".

+      return MATCH_ERROR;
+    }

I don't know if its GNU Code standard or not, but I would prefer
a blank line between blocks of code.

+  if (gfc_notify_std (GFC_STD_F2003, 
+		      "Fortran 2003: IMPORT statement at %C")
+      == FAILURE)
+    return MATCH_ERROR;
+  if (gfc_match_eos () == MATCH_YES)
+    {
+      /* All host variables should be imported */

You need a period and two spaces in the above comment.

+
+  for(;;)
+    {
+      m = gfc_match (" %n", name);
+      switch (m)
+	{
+	case MATCH_YES:
+          if (gfc_find_symbol (name, gfc_current_ns->parent, 1, &sym))
+            {
+               gfc_error ("Type name '%s' at %C is ambiguous", name);
+               return MATCH_ERROR;
+            }
+          if (sym == NULL)
+            {
+              gfc_error("Can not IMPORT '%s' from host scoping unit "
+                        "at %C - does not exist.", name);

Missing space.

+              return MATCH_ERROR;
+            }
+          if (gfc_find_symtree(gfc_current_ns->sym_root,name))

Ditto.
 
+            {
+              gfc_warning("'%s' is already IMPORTed from host scoping unit "
+                        "at %C.", name);

Ditto.
 
Index: gcc/fortran/gfortran.h
===================================================================
--- gcc/fortran/gfortran.h	(revision 118545)
+++ gcc/fortran/gfortran.h	(working copy)
@@ -1008,6 +1008,9 @@
 
   /* Set to 1 if namespace is a BLOCK DATA program unit.  */
   int is_block_data;
+
+  /* Set to 1 if namespace is an interface body with "IMPORT" used */

Period and 2 spaces.

+  int has_import_set;
 }
 gfc_namespace;
 
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(revision 118545)
+++ gcc/fortran/parse.c	(working copy)
@@ -1820,6 +1832,7 @@
       /* Fall through */

Period and 2 spaces.
 



-- 
Steve


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