From: Fritz Reese Date: Tue, 25 Oct 2016 15:13:43 +0000 (+0000) Subject: Cleanup -fdec. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6d17ecdaff0782c2114b18eb04c9be98ca1c7cf;p=gcc.git 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0050bf8cdd1..ab98c202e1c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2016-10-25 Fritz Reese + + * 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 PR fortran/77828 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index bc27f664512..e47d8ede33c 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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"); diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 33de0ffbe98..78a75e58b51 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -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; diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 301c28610bb..fa1f17cf54c 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -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:: diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 655ee6fb08e..ebf3aba8d4a 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -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} diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index b563e09c578..2e7640302ee 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -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 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index ae9e1d0ce83..aa9961c6ed5 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -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; diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 93403f7cf17..2b90654584f 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -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; }