From c3005b0f0c8081ccb719740c3c27ee13d5697add Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Thu, 24 Jul 2008 20:52:51 +0200 Subject: re PR fortran/33141 (Intrinsic procedures: Improve warning/error with -std=*) 2008-07-24 Daniel Kraft PR fortran/33141 * lang.opt (Wnonstd-intrinsics): Removed option. (Wintrinsics-std), (Wintrinsic-shadow): New options. * invoke.texi (Option Summary): Removed -Wnonstd-intrinsics from the list and added -Wintrinsics-std and -Wintrinsic-shadow. (Error and Warning Options): Documented the new options and removed the documentation for -Wnonstd-intrinsics. * gfortran.h (gfc_option_t): New members warn_intrinsic_shadow and warn_intrinsics_std, removed warn_nonstd_intrinsics. (gfc_is_intrinsic): Renamed from gfc_intrinsic_name. (gfc_warn_intrinsic_shadow), (gfc_check_intrinsic_standard): New. * decl.c (match_procedure_decl): Replaced gfc_intrinsic_name by the new name gfc_is_intrinsic. (warn_intrinsic_shadow): New helper method. (gfc_match_function_decl), (gfc_match_subroutine): Call the new method warn_intrinsic_shadow to check the just-parsed procedure. * expr.c (check_init_expr): Call new gfc_is_intrinsic to check whether the function called is really an intrinsic in the selected standard. * intrinsic.c (gfc_is_intrinsic): Renamed from gfc_intrinsic_name and extended to take into account the selected standard settings when trying to find out whether a symbol is an intrinsic or not. (gfc_check_intrinsic_standard): Made public and extended. (gfc_intrinsic_func_interface), (gfc_intrinsic_sub_interface): Removed the calls to check_intrinsic_standard, this check now happens inside gfc_is_intrinsic. (gfc_warn_intrinsic_shadow): New method defined. * options.c (gfc_init_options): Initialize new warning flags to false and removed intialization of Wnonstd-intrinsics flag. (gfc_post_options): Removed logic for Wnonstd-intrinsics flag. (set_Wall): Set new warning flags and removed Wnonstd-intrinsics flag. (gfc_handle_option): Handle the new flags and removed handling of the old Wnonstd-intrinsics flag. * primary.c (gfc_match_rvalue): Replaced call to gfc_intrinsic_name by the new name gfc_is_intrinsic. * resolve.c (resolve_actual_arglist): Ditto. (resolve_generic_f), (resolve_unknown_f): Ditto. (is_external_proc): Ditto. (resolve_generic_s), (resolve_unknown_s): Ditto. (resolve_symbol): Ditto and ensure for symbols declared INTRINSIC that they are really available in the selected standard setting. 2008-07-24 Daniel Kraft PR fortran/33141 * gfortran.dg/intrinsic_shadow_1.f03: New test for -Wintrinsic-shadow. * gfortran.dg/intrinsic_shadow_2.f03: Ditto. * gfortran.dg/intrinsic_shadow_3.f03: Ditto. * gfortran.dg/intrinsic_std_1.f90: New test for -Wintrinsics-std. * gfortran.dg/intrinsic_std_2.f90: Ditto. * gfortran.dg/intrinsic_std_3.f90: Ditto. * gfortran.dg/intrinsic_std_4.f90: Ditto. * gfortran.dg/warn_std_1.f90: Removed option -Wnonstd-intrinsics. * gfortran.dg/warn_std_2.f90: Replaced -Wnonstd-intrinsics by -Wintrinsics-std and adapted expected errors/warnings. * gfortran.dg/warn_std_3.f90: Ditto. * gfortran.dg/c_sizeof_2.f90: Adapted expected error/warning message. * gfortran.dg/gamma_2.f90: Ditto. * gfortran.dg/selected_char_kind_3.f90: Ditto. * gfortran.dg/fmt_g0_2.f08: Call with -fall-intrinsics to allow abort. From-SVN: r138122 --- gcc/fortran/options.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'gcc/fortran/options.c') diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index ca023a0..592b52d 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -76,6 +76,8 @@ gfc_init_options (unsigned int argc, const char **argv) gfc_option.warn_surprising = 0; gfc_option.warn_tabs = 1; gfc_option.warn_underflow = 1; + gfc_option.warn_intrinsic_shadow = 0; + gfc_option.warn_intrinsics_std = 0; gfc_option.max_errors = 25; gfc_option.flag_all_intrinsics = 0; @@ -124,8 +126,6 @@ gfc_init_options (unsigned int argc, const char **argv) set_default_std_flags (); - gfc_option.warn_nonstd_intrinsics = 0; - /* -fshort-enums can be default on some targets. */ gfc_option.fshort_enums = targetm.default_short_enums (); @@ -355,9 +355,6 @@ gfc_post_options (const char **pfilename) gfc_option.warn_tabs = 0; } - if (gfc_option.flag_all_intrinsics) - gfc_option.warn_nonstd_intrinsics = 0; - gfc_cpp_post_options (); /* FIXME: return gfc_cpp_preprocess_only (); @@ -379,10 +376,11 @@ set_Wall (int setting) gfc_option.warn_aliasing = setting; gfc_option.warn_ampersand = setting; gfc_option.warn_line_truncation = setting; - gfc_option.warn_nonstd_intrinsics = setting; gfc_option.warn_surprising = setting; gfc_option.warn_tabs = !setting; gfc_option.warn_underflow = setting; + gfc_option.warn_intrinsic_shadow = setting; + gfc_option.warn_intrinsics_std = setting; gfc_option.warn_character_truncation = setting; set_Wunused (setting); @@ -522,6 +520,10 @@ gfc_handle_option (size_t scode, const char *arg, int value) gfc_option.warn_underflow = value; break; + case OPT_Wintrinsic_shadow: + gfc_option.warn_intrinsic_shadow = value; + break; + case OPT_fall_intrinsics: gfc_option.flag_all_intrinsics = 1; break; @@ -783,8 +785,8 @@ gfc_handle_option (size_t scode, const char *arg, int value) gfc_option.warn_std = 0; break; - case OPT_Wnonstd_intrinsics: - gfc_option.warn_nonstd_intrinsics = value; + case OPT_Wintrinsics_std: + gfc_option.warn_intrinsics_std = value; break; case OPT_fshort_enums: -- cgit v1.1