]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Cleanup -fdec.
authorFritz Reese <fritzoreese@gmail.com>
Tue, 25 Oct 2016 15:13:43 +0000 (15:13 +0000)
committerFritz Reese <foreese@gcc.gnu.org>
Tue, 25 Oct 2016 15:13:43 +0000 (15:13 +0000)
gcc/fortran/
* invoke.texi, gfortran.texi: Touch up documentation of -fdec.
* gfortran.h (gfc_option): Move flag_dec_structure out of gfc_option.
* decl.c (match_record_decl, gfc_match_decl_type_spec,
gfc_match_structure_decl): Ditto.
* match.c (gfc_match_member_sep): Ditto.
* options.c (gfc_handle_option): Ditto.
* lang.opt (fdec-structure): Use Fortran Var for flag_dec_structure.
* lang.opt (fdec): Use Fortran Var to create flag_dec.
* options.c (set_dec_flags): With -fdec enable -fcray-pointer,
-fd-lines-as-comments (default), -fdollar-ok, and legacy std flags.

From-SVN: r241516

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

index 0050bf8cdd1b18c538ba6a3ba5c848ba471402db..ab98c202e1c8ba4742145ea03ede4ef17ff841da 100644 (file)
@@ -1,3 +1,15 @@
+2016-10-25  Fritz Reese <fritzoreese@gmail.com>
+
+       * invoke.texi, gfortran.texi: Touch up documentation of -fdec.
+       * gfortran.h (gfc_option): Move flag_dec_structure out of gfc_option.
+       * decl.c (match_record_decl, gfc_match_decl_type_spec,
+       gfc_match_structure_decl): Ditto.
+       * match.c (gfc_match_member_sep): Ditto.
+       * options.c (gfc_handle_option): Ditto.
+       * lang.opt (fdec-structure): Use Fortran Var for flag_dec_structure.
+       * lang.opt (fdec): Use Fortran Var to create flag_dec.
+       * options.c (set_dec_flags): With -fdec enable -fcray-pointer,
+       -fd-lines-as-comments (default), -fdollar-ok, and legacy std flags.
 2016-10-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/77828
index bc27f664512636a5a29c88422ea73d1f156e3925..e47d8ede33cf5368f7d5abd99e93f58c18d51105 100644 (file)
@@ -2929,7 +2929,7 @@ match_record_decl (char *name)
     m = gfc_match (" record /");
     if (m == MATCH_YES)
       {
-          if (!gfc_option.flag_dec_structure)
+          if (!flag_dec_structure)
             {
                 gfc_current_locus = old_loc;
                 gfc_error ("RECORD at %C is an extension, enable it with "
@@ -2942,7 +2942,7 @@ match_record_decl (char *name)
       }
 
   gfc_current_locus = old_loc;
-  if (gfc_option.flag_dec_structure
+  if (flag_dec_structure
       && (gfc_match (" record% ") == MATCH_YES
           || gfc_match (" record%t") == MATCH_YES))
     gfc_error ("Structure name expected after RECORD at %C");
@@ -3145,7 +3145,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
     {
       /* Match nested STRUCTURE declarations; only valid within another
         structure declaration.  */
-      if (gfc_option.flag_dec_structure
+      if (flag_dec_structure
          && (gfc_current_state () == COMP_STRUCTURE
              || gfc_current_state () == COMP_MAP))
        {
@@ -8654,7 +8654,7 @@ gfc_match_structure_decl (void)
     match m;
     locus where;
 
-    if(!gfc_option.flag_dec_structure)
+    if(!flag_dec_structure)
       {
           gfc_error ("STRUCTURE at %C is a DEC extension, enable with "
                      "-fdec-structure");
index 33de0ffbe98cac27da1068082afc0a50e174bb52..78a75e58b51641515ce59350c13e8c57171b69bb 100644 (file)
@@ -2549,8 +2549,6 @@ typedef struct
   int flag_init_character;
   char flag_init_character_value;
 
-  int flag_dec_structure;
-
   int fpe;
   int fpe_summary;
   int rtcheck;
index 301c28610bbea6bffd3a7ae504cf666850bcc8d8..fa1f17cf54cf3146f9a8bdee4591b91cbaf25e43 100644 (file)
@@ -1437,7 +1437,8 @@ purely for backward compatibility with legacy compilers.  By default,
 extensions, but to warn about the use of the latter.  Specifying
 either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008}
 disables both types of extensions, and @option{-std=legacy} allows both
-without warning.
+without warning.  The special compile flag @option{-fdec} enables additional
+compatibility extensions along with those enabled by @option{-std=legacy}.
 
 @menu
 * Old-style kind specifications::
index 655ee6fb08e8e697fffdd3f28979578a0a108733..ebf3aba8d4a134dd4299f6edb8e3259a1c185c03 100644 (file)
@@ -236,12 +236,15 @@ comment lines.
 DEC compatibility mode. Enables extensions and other features that mimic
 the default behavior of older compilers (such as DEC).
 These features are non-standard and should be avoided at all costs.
-For details on GNU Fortran's implementation of these extensions see the 
+For details on GNU Fortran's implementation of these extensions see the
 full documentation.
 
 Other flags enabled by this switch are:
 @option{-fdollar-ok} @option{-fcray-pointer} @option{-fdec-structure}
-@option{-fdec-intrinsic-ints} @option{-fdec-static}
+@option{-fdec-intrinsic-ints} @option{-fdec-static} @option{-fdec-math}
+
+If @option{-fd-lines-as-code}/@option{-fd-lines-as-comments} are unset, then
+@option{-fdec} also sets @option{-fd-lines-as-comments}.
 
 @item -fdec-structure
 @opindex @code{fdec-structure}
index b563e09c578d0903a03512a84a6ef48e2c170dc0..2e7640302ee6f11106e923ebeef65ff55b86f965 100644 (file)
@@ -421,7 +421,7 @@ Fortran RejectNegative
 Treat lines with 'D' in column one as comments.
 
 fdec
-Fortran
+Fortran Var(flag_dec)
 Enable all DEC language extensions.
 
 fdec-intrinsic-ints
@@ -433,7 +433,7 @@ Fortran Var(flag_dec_math)
 Enable legacy math intrinsics for compatibility.
 
 fdec-structure
-Fortran
+Fortran Var(flag_dec_structure)
 Enable support for DEC STRUCTURE/RECORD.
 
 fdec-static
index ae9e1d0ce8301ae4f08ca51a2b9ddb875166e046..aa9961c6ed5ac3fd0a6a369073ab9a55c9ec1b66 100644 (file)
@@ -159,7 +159,7 @@ gfc_match_member_sep(gfc_symbol *sym)
     return MATCH_YES;
 
   /* Beware ye who enter here.  */
-  if (!gfc_option.flag_dec_structure || !sym)
+  if (!flag_dec_structure || !sym)
     return MATCH_NO;
 
   tsym = NULL;
index 93403f7cf17582d43a689e373ad42c3a730f350b..2b90654584fe693391e3100e65d1f623f7c53b50 100644 (file)
@@ -47,15 +47,27 @@ set_default_std_flags (void)
 }
 
 
-/* Set all the DEC extension flags. */
+/* Set all the DEC extension flags.  */
 
 static void
 set_dec_flags (int value)
 {
-    gfc_option.flag_dec_structure  = value;
-    flag_dec_intrinsic_ints = value;
-    flag_dec_static = value;
-    flag_dec_math = value;
+  /* Allow legacy code without warnings.  */
+  gfc_option.allow_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL
+    | GFC_STD_GNU | GFC_STD_LEGACY;
+  gfc_option.warn_std &= ~(GFC_STD_LEGACY | GFC_STD_F95_DEL);
+
+  /* Set -fd-lines-as-comments by default.  */
+  if (value && gfc_current_form != FORM_FREE && gfc_option.flag_d_lines == -1)
+    gfc_option.flag_d_lines = 0;
+
+  /* Set other DEC compatibility extensions.  */
+  flag_dollar_ok |= value;
+  flag_cray_pointer |= value;
+  flag_dec_structure |= value;
+  flag_dec_intrinsic_ints |= value;
+  flag_dec_static |= value;
+  flag_dec_math |= value;
 }
 
 
@@ -729,7 +741,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
       break;
 
     case OPT_fdec_structure:
-      gfc_option.flag_dec_structure = 1;
+      flag_dec_structure = 1;
       break;
     }