Patchwork [Fortran] Add Fortran 2008 obsolescent support for ENTRY

login
register
mail settings
Submitter Tobias Burnus
Date June 23, 2010, 9:38 p.m.
Message ID <4C227EE1.3000503@net-b.de>
Download mbox | patch
Permalink /patch/56729/
State New
Headers show

Comments

Tobias Burnus - June 23, 2010, 9:38 p.m.
Fortran 2008 declares ENTRY as obsolescent. This patch adds the required
diagnostics for -std=f2008; with -std=f95/f2003/gnu/legacy it is still
supported - with -std=f2008 a warning is printed.

Build and currently regtesting on x86-64-linux. If it succeeds:
OK for the trunk?

Tobias
Steve Kargl - June 23, 2010, 10:19 p.m.
On Wed, Jun 23, 2010 at 11:38:41PM +0200, Tobias Burnus wrote:
> Fortran 2008 declares ENTRY as obsolescent. This patch adds the required
> diagnostics for -std=f2008; with -std=f95/f2003/gnu/legacy it is still
> supported - with -std=f2008 a warning is printed.
> 
> Build and currently regtesting on x86-64-linux. If it succeeds:
> OK for the trunk?
> 

No.

+#define GFC_STD_F2008_OBS      (1<<7)  /* Obsolescent in F2008.  */
+#define GFC_STD_F2008          (1<<7)  /* New in F2008.  */

Shouldn't one of these be (1<<8)?

Patch

2010-06-23  Tobias Burnus  <burnus@net-b.de>

	* decl.c (gfc_match_entry): Mark ENTRY as GFC_STD_F2008_OBS.
	* gfortran.texi (_gfortran_set_options): Update for
	GFC_STD_F2008_OBS addition.
	* libgfortran.h: Add GFC_STD_F2008_OBS.
	* options.c (set_default_std_flags,gfc_handle_option): Handle
	GFC_STD_F2008_OBS.

2010-06-23  Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/entry_19.f90: New.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(Revision 161288)
+++ gcc/fortran/decl.c	(Arbeitskopie)
@@ -4963,6 +4963,10 @@  gfc_match_entry (void)
   if (m != MATCH_YES)
     return m;
 
+  if (gfc_notify_std (GFC_STD_F2008_OBS, "Fortran 2008 obsolescent feature: "
+		      "ENTRY statement at %C") == FAILURE)
+    return MATCH_ERROR;
+
   state = gfc_current_state ();
   if (state != COMP_SUBROUTINE && state != COMP_FUNCTION)
     {
Index: gcc/fortran/gfortran.texi
===================================================================
--- gcc/fortran/gfortran.texi	(Revision 161288)
+++ gcc/fortran/gfortran.texi	(Arbeitskopie)
@@ -2335,9 +2335,10 @@  if e.g. an input-output edit descriptor
 Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1),
 @code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95}
 (8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32),
-@code{GFC_STD_LEGACY} (64), and @code{GFC_STD_F2008} (128).
-Default: @code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003
-| GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}.
+@code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128), and
+@code{GFC_STD_F2008_OBS} (256).  Default: @code{GFC_STD_F95_OBS
+| GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003 | GFC_STD_F2008
+| GFC_STD_F2008_OBS | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}.
 @item @var{option}[1] @tab Standard-warning flag; prints a warning to
 standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
 @item @var{option}[2] @tab If non zero, enable pedantic checking.
Index: gcc/fortran/libgfortran.h
===================================================================
--- gcc/fortran/libgfortran.h	(Revision 161288)
+++ gcc/fortran/libgfortran.h	(Arbeitskopie)
@@ -23,15 +23,16 @@  along with GCC; see the file COPYING3.
    Note that no features were obsoleted nor deleted in F2003.
    Please remember to keep those definitions in sync with
    gfortran.texi.  */
-#define GFC_STD_F2008	(1<<7)	/* New in F2008.  */
-#define GFC_STD_LEGACY	(1<<6)	/* Backward compatibility.  */
-#define GFC_STD_GNU	(1<<5)	/* GNU Fortran extension.  */
-#define GFC_STD_F2003	(1<<4)	/* New in F2003.  */
-#define GFC_STD_F95	(1<<3)	/* New in F95.  */
-#define GFC_STD_F95_DEL	(1<<2)	/* Deleted in F95.  */
-#define GFC_STD_F95_OBS	(1<<1)	/* Obsolescent in F95.  */
-#define GFC_STD_F77	(1<<0)	/* Included in F77, but not deleted or
-				   obsolescent in later standards.  */
+#define GFC_STD_F2008_OBS	(1<<7)	/* Obsolescent in F2008.  */
+#define GFC_STD_F2008		(1<<7)	/* New in F2008.  */
+#define GFC_STD_LEGACY		(1<<6)	/* Backward compatibility.  */
+#define GFC_STD_GNU		(1<<5)	/* GNU Fortran extension.  */
+#define GFC_STD_F2003		(1<<4)	/* New in F2003.  */
+#define GFC_STD_F95		(1<<3)	/* New in F95.  */
+#define GFC_STD_F95_DEL		(1<<2)	/* Deleted in F95.  */
+#define GFC_STD_F95_OBS		(1<<1)	/* Obsolescent in F95.  */
+#define GFC_STD_F77		(1<<0)	/* Included in F77, but not deleted or
+					   obsolescent in later standards.  */
 
 
 /* Bitmasks for the various FPE that can be enabled.  */
Index: gcc/fortran/options.c
===================================================================
--- gcc/fortran/options.c	(Revision 161288)
+++ gcc/fortran/options.c	(Arbeitskopie)
@@ -48,7 +48,7 @@  set_default_std_flags (void)
 {
   gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
     | GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
-    | GFC_STD_GNU | GFC_STD_LEGACY;
+    | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY;
   gfc_option.warn_std = GFC_STD_F95_DEL | GFC_STD_LEGACY;
 }
 
@@ -857,7 +857,8 @@  gfc_handle_option (size_t scode, const c
       break;
 
     case OPT_std_f95:
-      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77;
+      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95 | GFC_STD_F77
+			     | GFC_STD_F2008_OBS;
       gfc_option.warn_std = GFC_STD_F95_OBS;
       gfc_option.max_continue_fixed = 19;
       gfc_option.max_continue_free = 39;
@@ -868,7 +869,7 @@  gfc_handle_option (size_t scode, const c
 
     case OPT_std_f2003:
       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 
-	| GFC_STD_F2003 | GFC_STD_F95;
+	| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008_OBS;
       gfc_option.warn_std = GFC_STD_F95_OBS;
       gfc_option.max_identifier_length = 63;
       gfc_option.warn_ampersand = 1;
@@ -877,8 +878,8 @@  gfc_handle_option (size_t scode, const c
 
     case OPT_std_f2008:
       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F77 
-	| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008;
-      gfc_option.warn_std = GFC_STD_F95_OBS;
+	| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS;
+      gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
       gfc_option.max_identifier_length = 63;
       gfc_option.warn_ampersand = 1;
       gfc_option.warn_tabs = 0;
Index: gcc/testsuite/gfortran.dg/entry_19.f90
===================================================================
--- gcc/testsuite/gfortran.dg/entry_19.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/entry_19.f90	(Revision 0)
@@ -0,0 +1,9 @@ 
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+! 
+!
+! Entry is obsolete in Fortran 2008
+!
+subroutine foo()
+entry bar() ! { dg-error "Fortran 2008 obsolescent feature: ENTRY" }
+end