PR 15051 Allow empty interface blocks

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sat May 8 15:54:00 GMT 2004


Currently gfortran gives an error when it sees an empty interface block. 
  this is allowed by the standard, see R1201. Alternatively one could 
issue a warning, if you prefer this you only have to change the 
gfc_error to a gfc_warning.

Bootstrapped and regtested on i686-pc-linux. This also passed Steve 
Kargl's tests without any new failures.

BTW what is the convention for the date in the ChangeLog? I have changed 
those to today in some mails but I forgot in others.

- Tobi

testcase:
! Program to test empty interfaces PR15051
INTERFACE empty
END INTERFACE
END


2004-05-08  Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/15051
	* parse.c (parse_interface): Allow empty INTERFACE, remove
	seen_body.

Index: parse.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/Attic/parse.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 parse.c
--- parse.c	1 Jan 2004 12:09:12 -0000	1.1.2.4
+++ parse.c	8 May 2004 11:48:03 -0000
@@ -1409,7 +1410,6 @@ parse_interface (void)
    gfc_interface_info save;
    gfc_state_data s1, s2;
    gfc_statement st;
-  int seen_body;

    accept_statement (ST_INTERFACE);

@@ -1420,7 +1420,6 @@ parse_interface (void)
  	 || current_interface.type == INTERFACE_USER_OP) ? gfc_new_block : NULL;

    push_state (&s1, COMP_INTERFACE, sym);
-  seen_body = 0;
    current_state = COMP_NONE;

  loop:
@@ -1446,7 +1445,6 @@ loop:

      case ST_MODULE_PROC:	/* The module procedure matcher makes
  				   sure the context is correct.  */
-      seen_body = 1;
        accept_statement (st);
        gfc_free_namespace (gfc_current_ns);
        goto loop;
@@ -1512,8 +1510,6 @@ decl:
        goto decl;
      }

-  seen_body = 1;
-
    current_interface = save;
    gfc_add_interface (prog_unit);

@@ -1521,9 +1517,6 @@ decl:
    goto loop;

  done:
-  if (!seen_body)
-    gfc_error ("INTERFACE block at %C is empty");
-
    pop_state ();
  }



More information about the Fortran mailing list