+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
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 "
}
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");
{
/* 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))
{
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");
int flag_init_character;
char flag_init_character_value;
- int flag_dec_structure;
-
int fpe;
int fpe_summary;
int rtcheck;
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::
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}
Treat lines with 'D' in column one as comments.
fdec
-Fortran
+Fortran Var(flag_dec)
Enable all DEC language extensions.
fdec-intrinsic-ints
Enable legacy math intrinsics for compatibility.
fdec-structure
-Fortran
+Fortran Var(flag_dec_structure)
Enable support for DEC STRUCTURE/RECORD.
fdec-static
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;
}
-/* 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;
}
break;
case OPT_fdec_structure:
- gfc_option.flag_dec_structure = 1;
+ flag_dec_structure = 1;
break;
}