* gfortran.h (GFC_STD_LEGACY): New "standard" macro. Reindent.
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 May 2005 22:16:08 +0000 (22:16 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 May 2005 22:16:08 +0000 (22:16 +0000)
* options.c (gfc_init_options): By default, allow legacy extensions
but warn about them.
(gfc_post_options): Make -pedantic warn about legacy extensions
even with -std=legacy.
(gfc_handle_option): Make -std=gnu follow the default behaviour
of warning about legacy extensions, but allowing them. Make the
new -std=legacy accept everything and warn about nothing.
* lang.opt (std=legacy): New F95 command line option.
* invoke.texi: Document both -std=f2003 and -std=legacy.
* gfortran.texi: Explain the two types of extensions and document
how they are affected by the various -std= command line options.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100377 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/gfortran.texi
gcc/fortran/invoke.texi
gcc/fortran/lang.opt
gcc/fortran/options.c

index ca24ff6..d225332 100644 (file)
@@ -1,3 +1,18 @@
+2005-05-30  Roger Sayle  <roger@eyesopen.com>
+
+       * gfortran.h (GFC_STD_LEGACY): New "standard" macro.  Reindent.
+       * options.c (gfc_init_options): By default, allow legacy extensions
+       but warn about them.
+       (gfc_post_options): Make -pedantic warn about legacy extensions
+       even with -std=legacy.
+       (gfc_handle_option): Make -std=gnu follow the default behaviour
+       of warning about legacy extensions, but allowing them. Make the
+       new -std=legacy accept everything and warn about nothing.
+       * lang.opt (std=legacy): New F95 command line option.
+       * invoke.texi: Document both -std=f2003 and -std=legacy.
+       * gfortran.texi: Explain the two types of extensions and document
+       how they are affected by the various -std= command line options.
+
 2005-05-30  Kazu Hirata  <kazu@cs.umass.edu>
 
        * trans-expr.c: Remove trailing ^M.
index d17f388..69a56e1 100644 (file)
@@ -92,13 +92,14 @@ mstring;
 
 
 /* Flags to specify which standard/extension contains a feature.  */
-#define GFC_STD_GNU                (1<<5)    /* GNU Fortran extension.  */
-#define GFC_STD_F2003             (1<<4)    /* New in F2003.  */
+#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.  */
 /* Note that no features were obsoleted nor deleted 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)    /* Obsoleted in F95.  */
-#define GFC_STD_F77                 (1<<0)    /* Up to and including F77.  */
+#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)    /* Obsoleted in F95.  */
+#define GFC_STD_F77            (1<<0)    /* Up to and including F77.  */
 
 /*************************** Enums *****************************/
 
index 2644e40..7ea5909 100644 (file)
@@ -618,7 +618,14 @@ Variable for swapping Endianness during unformatted write.
 
 @command{gfortran} implements a number of extensions over standard
 Fortran. This chapter contains information on their syntax and
-meaning.
+meaning.  There are currently two categories of @command{gfortran}
+extensions, those that provide functionality beyond that provided
+by any standard, and those that are supported by @command{gfortran}
+purely for backward compatibility with legacy compilers.  By default,
+@option{-std=gnu} allows the compiler to accept both types of
+extensions, but to warn about the use of the latter.  Specifying
+either @option{-std=f95} or @option{-std=f2003} disables both types
+of extensions, and @option{-std=legacy} allows both without warning.
 
 @menu
 * Old-style kind specifications::
index 996556f..098882e 100644 (file)
@@ -248,7 +248,7 @@ Specify that no implicit typing is allowed, unless overridden by explicit
 @cindex option, -std=@var{std}
 @item -std=@var{std}
 Conform to the specified standard.  Allowed values for @var{std} are
-@samp{gnu} and @samp{f95}.
+@samp{gnu}, @samp{f95}, @samp{f2003} and @samp{legacy}.
 
 @end table
 
index d1ca5f0..6798b6d 100644 (file)
@@ -161,4 +161,8 @@ std=gnu
 F95
 Conform nothing in particular.
 
+std=legacy
+F95
+Accept extensions to support legacy code.
+
 ; This comment is to ensure we retain the blank line above.
index 2603caa..347f706 100644 (file)
@@ -77,9 +77,10 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
   flag_errno_math = 0;
 
   gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
-    | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU;
+    | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU
+    | GFC_STD_LEGACY;
   gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
-    | GFC_STD_F2003;
+    | GFC_STD_F2003 | GFC_STD_LEGACY;
 
   gfc_option.warn_nonstd_intrinsics = 0;
 
@@ -113,6 +114,9 @@ gfc_post_options (const char **pfilename)
   /* If -pedantic, warn about the use of GNU extensions.  */
   if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
     gfc_option.warn_std |= GFC_STD_GNU;
+  /* -std=legacy -pedantic is effectively -std=gnu.  */
+  if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
+    gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_LEGACY;
 
   /* If the user didn't explicitly specify -f(no)-second-underscore we
      use it if we're trying to be compatible with f2c, and not
@@ -333,8 +337,16 @@ gfc_handle_option (size_t scode, const char *arg, int value)
     case OPT_std_gnu:
       gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
        | GFC_STD_F77 | GFC_STD_F95 | GFC_STD_F2003
-       | GFC_STD_GNU;
-      gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL;
+       | GFC_STD_GNU | GFC_STD_LEGACY;
+      gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
+       | GFC_STD_LEGACY;
+      break;
+
+    case OPT_std_legacy:
+      gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
+       | GFC_STD_F77 | GFC_STD_F95 | GFC_STD_F2003
+       | GFC_STD_GNU | GFC_STD_LEGACY;
+      gfc_option.warn_std = 0;
       break;
 
     case OPT_Wnonstd_intrinsics: