public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran] PR 49265 - allow :: for "procedure :: list"
@ 2012-07-17  8:14 Tobias Burnus
  2012-07-17  8:53 ` Janus Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2012-07-17  8:14 UTC (permalink / raw)
  To: gcc patches, gfortran

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

Fortran 2008 now also allows the "::" in module interfaces: "[module] 
procedure [::] procedure-name-list"

The bug is also a sign for bad quality assurance as we previously only 
fixed the issue for "module procedure" and not also for "procedure".

Build and regtested on x86-64-linux.
OK for the trunk?

Tobias

[-- Attachment #2: module-colon.diff --]
[-- Type: text/x-patch, Size: 2264 bytes --]

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.

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index c3644b6..c6ba43e 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5108,6 +5113,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 +5122,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);
--- /dev/null	2012-07-17 07:28:04.995717470 +0200
+++ gcc/gcc/testsuite/gfortran.dg/module_procedure_double_colon_3.f90	2012-07-17 09:02:29.000000000 +0200
@@ -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
--- /dev/null	2012-07-17 07:28:04.995717470 +0200
+++ gcc/gcc/testsuite/gfortran.dg/module_procedure_double_colon_4.f90	2012-07-17 09:07:04.000000000 +0200
@@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, Fortran] PR 49265 - allow :: for "procedure :: list"
  2012-07-17  8:14 [Patch, Fortran] PR 49265 - allow :: for "procedure :: list" Tobias Burnus
@ 2012-07-17  8:53 ` Janus Weil
  0 siblings, 0 replies; 2+ messages in thread
From: Janus Weil @ 2012-07-17  8:53 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches, gfortran

Hi Tobias,

> Fortran 2008 now also allows the "::" in module interfaces: "[module]
> procedure [::] procedure-name-list"
>
> The bug is also a sign for bad quality assurance as we previously only fixed
> the issue for "module procedure" and not also for "procedure".
>
> Build and regtested on x86-64-linux.
> OK for the trunk?

certainly ok. Thanks for the fix!

Cheers,
Janus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-17  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-17  8:14 [Patch, Fortran] PR 49265 - allow :: for "procedure :: list" Tobias Burnus
2012-07-17  8:53 ` Janus Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).