Cleanup -fdec.

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
This commit is contained in:
Fritz Reese 2016-10-25 15:13:43 +00:00 committed by Fritz Reese
parent 6ddefaa79f
commit f6d17ecdaf
8 changed files with 44 additions and 18 deletions

View 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

View 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");

View 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;

View 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::

View 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}

View 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

View 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;

View 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;
}