]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/49265 (Double colon in procedure-stmt (generic interface))
authorTobias Burnus <burnus@net-b.de>
Tue, 17 Jul 2012 08:59:18 +0000 (10:59 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 17 Jul 2012 08:59:18 +0000 (10:59 +0200)
2012-07-17  Tobias Burnus  <burnus@net-b.de>
            Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/49265
        * decl.c (match_procedure_in_interface): Support "::" for
        Fortran 2008 and later.

2012-07-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/49265
        * gfortran.dg/module_procedure_double_colon_3.f90: New.
        * gfortran.dg/module_procedure_double_colon_4.f90: New.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r189562

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/module_procedure_double_colon_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/module_procedure_double_colon_4.f90 [new file with mode: 0644]

index c080e5afd9357f6868005a97453514999d077e7a..fede706c0c65f9486c81b16ac173fb130a3963da 100644 (file)
@@ -1,3 +1,10 @@
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+           Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/49265
+       * decl.c (match_procedure_in_interface): Support "::" for
+       Fortran 2008 and later.
+
 2012-07-16  Thomas König  <tkoenig@gcc.gnu.org>
 
        PR fortran/53824
index c3644b6d8f8dffb7341e62ed2d367411c8210fff..9bd3dc3a688a769b701d60153c2ff2884e976721 100644 (file)
@@ -5108,6 +5108,7 @@ match_procedure_in_interface (void)
   match m;
   gfc_symbol *sym;
   char name[GFC_MAX_SYMBOL_LEN + 1];
+  locus old_locus;
 
   if (current_interface.type == INTERFACE_NAMELESS
       || current_interface.type == INTERFACE_ABSTRACT)
@@ -5116,6 +5117,19 @@ match_procedure_in_interface (void)
       return MATCH_ERROR;
     }
 
+  /* Check if the F2008 optional double colon appears.  */
+  gfc_gobble_whitespace ();
+  old_locus = gfc_current_locus;
+  if (gfc_match ("::") == MATCH_YES)
+    {
+      if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: double colon in "
+                        "MODULE PROCEDURE statement at %L", &old_locus)
+         == FAILURE)
+       return MATCH_ERROR;
+    }
+  else
+    gfc_current_locus = old_locus;
+
   for(;;)
     {
       m = gfc_match_name (name);
index f0a13ab3c67372fca43574e44a643f7c53e45fb9..b978c907e0402da0ff365cc3a25465977c7d744a 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-17  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/49265
+       * gfortran.dg/module_procedure_double_colon_3.f90: New.
+       * gfortran.dg/module_procedure_double_colon_4.f90: New.
+
 2012-07-16  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/parse/access8.C: Adjust.
diff --git a/gcc/testsuite/gfortran.dg/module_procedure_double_colon_3.f90 b/gcc/testsuite/gfortran.dg/module_procedure_double_colon_3.f90
new file mode 100644 (file)
index 0000000..620f82a
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/49265
+!
+! Contributed by Erik Toussaint
+!
+module m1
+  implicit none
+  interface foo
+     procedure :: bar ! { dg-error "Fortran 2008: double colon in MODULE PROCEDURE statement" }
+  end interface
+contains
+  subroutine bar
+  end subroutine
+end module
diff --git a/gcc/testsuite/gfortran.dg/module_procedure_double_colon_4.f90 b/gcc/testsuite/gfortran.dg/module_procedure_double_colon_4.f90
new file mode 100644 (file)
index 0000000..d56823c
--- /dev/null
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+! PR fortran/49265
+!
+! Contributed by Erik Toussaint
+!
+module m1
+  implicit none
+  interface foo
+     procedure :: bar ! "::" is valid since Fortran 2008
+  end interface
+contains
+  subroutine bar
+  end subroutine
+end module