summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 22:16:08 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 22:16:08 +0000
commitc667e11dfe53a1541911e3465f391693abc00569 (patch)
treebecb120b72d22a9e2b88e2936d6e3da4b6a7cec4 /gcc/fortran
parent24079773bcf3b4a4ddf713db9dbace26d58a497e (diff)
downloadgcc-c667e11dfe53a1541911e3465f391693abc00569.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100377 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog15
-rw-r--r--gcc/fortran/gfortran.h13
-rw-r--r--gcc/fortran/gfortran.texi9
-rw-r--r--gcc/fortran/invoke.texi2
-rw-r--r--gcc/fortran/lang.opt4
-rw-r--r--gcc/fortran/options.c20
6 files changed, 51 insertions, 12 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ca24ff6e7c5..d2253328760 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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.
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index d17f388212c..69a56e188ac 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -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 *****************************/
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 2644e40257e..7ea59096a62 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -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::
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 996556fb5bc..098882ecbe3 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -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
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index d1ca5f02ebd..6798b6d4f14 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -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.
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 2603caa67a8..347f7068b96 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -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: