gfortran.h (gfc_option_t): Remove warn_aliasing,

2014-11-30  Tobias Burnus  <burnus@net-b.de>

        * gfortran.h (gfc_option_t): Remove warn_aliasing,
        * warn_ampersand,
        warn_function_elimination, warn_implicit_interface,
        warn_implicit_procedure, warn_line_truncation,
        warn_surprising, warn_underflow, warn_intrinsic_shadow,
        warn_array_temp, warn_align_commons, warn_real_q_constant,
        warn_unused_dummy_argument, warn_zerotrip, warn_realloc_lhs,
        warn_realloc_lhs_all, warn_compare_reals, warn_target_lifetime.
        * arith.c (check_result, gfc_real2real, gfc_real2complex,
        gfc_complex2real, gfc_complex2complex): Honor changed
        variable names.
        * check.c (gfc_check_transfer): Ditto.
        * expr.c (gfc_check_assign, gfc_check_pointer_assign): Ditto.
        * interface.c (compare_parameter, gfc_procedure_use,
        * gfc_ppc_use,
        gfc_arglist_matches_symbol): Ditto.
        * intrinsic.c (gfc_warn_intrinsic_shadow): Ditto.
        * primary.c (match_real_constant, match_string_constant): Ditto.
        * resolve.c (gfc_resolve_intrinsic, resolve_operator,
        gfc_resolve_iterator, resolve_select, resolve_ordinary_assign,
        resolve_charlen, gfc_resolve_finalizers): Ditto.
        * scanner.c (gfc_next_char_literal): Ditto.
        * simplify.c (simplify_achar_char, gfc_simplify_iachar): Ditto.
        * trans-array.c (gfc_trans_create_temp_array,
        gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Ditto.
        * trans-common.c (translate_common):
        * trans-decl.c (generate_local_decl): Ditto.
        * trans-expr.c (realloc_lhs_warning): Ditto.
        * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto.
        * decl.c (do_warn_intrinsic_shadow): Ditto. Renamed from
        warn_intrinsic_shadow.
        * frontend-passes.c (do_warn_function_elimination): Honor
        changed variable names. Renamed from do_warn_function_elimination.
        * invoke.texi (Wunderflow): Document that it is enabled by
        * default.
        * lang.opt (Waliasing, Walign-commons, Warray-temporaries,
        Wcompare-reals, Wfunction-elimination, Wimplicit-interface,
        Wimplicit-procedure, Wline-truncation, Wreal-q-constant, Wrealloc-lhs,
        Wrealloc-lhs-all, Wtarget-lifetime, Wsurprising, Wunderflow,
        Wintrinsic-shadow, Wunused-dummy-argument, Wzerotrip): Use Var(),
        add Init() and LangEnabledBy() were required.
        (Wmaybe-uninitialized, Wreturn-type, Wuninitialized): Add
        LangEnabledBy.
        * options.c (gfc_init_options, gfc_post_options,
        * gfc_handle_option):
        Remove options handled in lang.opt; handle renaming.
        (set_Wall, set_Wextra): Remove.

From-SVN: r218188
This commit is contained in:
Tobias Burnus 2014-11-30 09:33:25 +01:00
parent daa38cc13d
commit 73e42eef16
20 changed files with 94 additions and 246 deletions

View File

@ -544,7 +544,7 @@ check_result (arith rc, gfc_expr *x, gfc_expr *r, gfc_expr **rp)
if (val == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (val), &x->where);
val = ARITH_OK;
}
@ -2077,7 +2077,7 @@ gfc_real2real (gfc_expr *src, int kind)
if (rc == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (rc), &src->where);
mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
}
@ -2108,7 +2108,7 @@ gfc_real2complex (gfc_expr *src, int kind)
if (rc == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (rc), &src->where);
mpfr_set_ui (mpc_realref (result->value.complex), 0, GFC_RND_MODE);
}
@ -2163,7 +2163,7 @@ gfc_complex2real (gfc_expr *src, int kind)
if (rc == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (rc), &src->where);
mpfr_set_ui (result->value.real, 0, GFC_RND_MODE);
}
@ -2194,7 +2194,7 @@ gfc_complex2complex (gfc_expr *src, int kind)
if (rc == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (rc), &src->where);
mpfr_set_ui (mpc_realref (result->value.complex), 0, GFC_RND_MODE);
}
@ -2209,7 +2209,7 @@ gfc_complex2complex (gfc_expr *src, int kind)
if (rc == ARITH_UNDERFLOW)
{
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning (gfc_arith_error (rc), &src->where);
mpfr_set_ui (mpc_imagref (result->value.complex), 0, GFC_RND_MODE);
}

View File

@ -5070,7 +5070,7 @@ gfc_check_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
return false;
}
if (!gfc_option.warn_surprising)
if (!warn_surprising)
return true;
/* If we can't calculate the sizes, we cannot check any more.

View File

@ -5284,7 +5284,7 @@ gfc_match_procedure (void)
parser-state-stack to find out whether we're in a module. */
static void
warn_intrinsic_shadow (const gfc_symbol* sym, bool func)
do_warn_intrinsic_shadow (const gfc_symbol* sym, bool func)
{
bool in_module;
@ -5420,7 +5420,7 @@ gfc_match_function_decl (void)
}
/* Warn if this procedure has the same name as an intrinsic. */
warn_intrinsic_shadow (sym, true);
do_warn_intrinsic_shadow (sym, true);
return MATCH_YES;
}
@ -5851,7 +5851,7 @@ gfc_match_subroutine (void)
return MATCH_ERROR;
/* Warn if it has the same name as an intrinsic. */
warn_intrinsic_shadow (sym, false);
do_warn_intrinsic_shadow (sym, false);
return MATCH_YES;
}

View File

@ -3171,7 +3171,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
}
/* This is possibly a typo: x = f() instead of x => f(). */
if (gfc_option.warn_surprising
if (warn_surprising
&& rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer)
gfc_warning ("POINTER-valued function appears on right-hand side of "
"assignment at %L", &rvalue->where);
@ -3197,7 +3197,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
if (rvalue->is_boz && lvalue->ts.type != BT_INTEGER)
{
int rc;
if (gfc_option.warn_surprising)
if (warn_surprising)
gfc_warning ("BOZ literal at %L is bitwise transferred "
"non-integer symbol '%s'", &rvalue->where,
lvalue->symtree->n.sym->name);
@ -3750,7 +3750,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
}
/* Warn if it is the LHS pointer may lives longer than the RHS target. */
if (gfc_option.warn_target_lifetime
if (warn_target_lifetime
&& rvalue->expr_type == EXPR_VARIABLE
&& !rvalue->symtree->n.sym->attr.save
&& !attr.pointer && !rvalue->symtree->n.sym->attr.host_assoc

View File

@ -546,7 +546,7 @@ create_var (gfc_expr * e)
result->ref->u.ar.where = e->where;
result->ref->u.ar.as = symbol->ts.type == BT_CLASS
? CLASS_DATA (symbol)->as : symbol->as;
if (gfc_option.warn_array_temp)
if (warn_array_temporaries)
gfc_warning ("Creating array temporary at %L", &(e->where));
}
@ -565,7 +565,7 @@ create_var (gfc_expr * e)
/* Warn about function elimination. */
static void
warn_function_elimination (gfc_expr *e)
do_warn_function_elimination (gfc_expr *e)
{
if (e->expr_type != EXPR_FUNCTION)
return;
@ -618,8 +618,8 @@ cfe_expr_0 (gfc_expr **e, int *walk_subtrees,
if (newvar == NULL)
newvar = create_var (*ei);
if (gfc_option.warn_function_elimination)
warn_function_elimination (*ej);
if (warn_function_elimination)
do_warn_function_elimination (*ej);
free (*ej);
*ej = gfc_copy_expr (newvar);

View File

@ -2442,24 +2442,6 @@ typedef struct
int dump_fortran_original;
int dump_fortran_optimized;
int warn_aliasing;
int warn_ampersand;
int warn_function_elimination;
int warn_implicit_interface;
int warn_implicit_procedure;
int warn_line_truncation;
int warn_surprising;
int warn_underflow;
int warn_intrinsic_shadow;
int warn_array_temp;
int warn_align_commons;
int warn_real_q_constant;
int warn_unused_dummy_argument;
int warn_zerotrip;
int warn_realloc_lhs;
int warn_realloc_lhs_all;
int warn_compare_reals;
int warn_target_lifetime;
int max_errors;
int flag_all_intrinsics;

View File

@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "flags.h"
#include "gfortran.h"
#include "match.h"
#include "arith.h"
@ -2145,8 +2146,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
formal->name);
return 0;
}
else if (gfc_option.warn_surprising && where
&& formal->attr.intent != INTENT_IN)
else if (warn_surprising && where && formal->attr.intent != INTENT_IN)
gfc_warning ("Passing coarray at %L to allocatable, noncoarray dummy "
"argument '%s', which is invalid if the allocation status"
" is modified", &actual->where, formal->name);
@ -3260,11 +3260,10 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
sym->name, where);
return false;
}
if (gfc_option.warn_implicit_interface)
if (warn_implicit_interface)
gfc_warning ("Procedure '%s' called with an implicit interface at %L",
sym->name, where);
else if (gfc_option.warn_implicit_procedure
&& sym->attr.proc == PROC_UNKNOWN)
else if (warn_implicit_procedure && sym->attr.proc == PROC_UNKNOWN)
gfc_warning ("Procedure '%s' called at %L is not explicitly declared",
sym->name, where);
}
@ -3357,7 +3356,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
if (!check_intents (dummy_args, *ap))
return false;
if (gfc_option.warn_aliasing)
if (warn_aliasing)
check_some_aliasing (dummy_args, *ap);
return true;
@ -3374,7 +3373,7 @@ gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
/* Warn about calls with an implicit interface. Special case
for calling a ISO_C_BINDING because c_loc and c_funloc
are pseudo-unknown. */
if (gfc_option.warn_implicit_interface
if (warn_implicit_interface
&& comp->attr.if_source == IFSRC_UNKNOWN
&& !comp->attr.is_iso_c)
gfc_warning ("Procedure pointer component '%s' called with an implicit "
@ -3403,7 +3402,7 @@ gfc_ppc_use (gfc_component *comp, gfc_actual_arglist **ap, locus *where)
return;
check_intents (comp->ts.interface->formal, *ap);
if (gfc_option.warn_aliasing)
if (warn_aliasing)
check_some_aliasing (comp->ts.interface->formal, *ap);
}
@ -3426,7 +3425,7 @@ gfc_arglist_matches_symbol (gfc_actual_arglist** args, gfc_symbol* sym)
if (compare_actual_formal (args, dummy_args, r, !r, NULL))
{
check_intents (dummy_args, *args);
if (gfc_option.warn_aliasing)
if (warn_aliasing)
check_some_aliasing (dummy_args, *args);
return true;
}

View File

@ -4807,7 +4807,7 @@ gfc_warn_intrinsic_shadow (const gfc_symbol* sym, bool in_module, bool func)
gfc_intrinsic_sym* isym;
/* If the warning is disabled, do nothing at all. */
if (!gfc_option.warn_intrinsic_shadow)
if (!warn_intrinsic_shadow)
return;
/* Try to find an intrinsic of the same name. */

View File

@ -886,7 +886,7 @@ is active for @option{-pedantic}, @option{-std=f95}, @option{-std=f2003},
@cindex warnings, underflow
@cindex underflow
Produce a warning when numerical constant expressions are
encountered, which yield an UNDERFLOW during compilation.
encountered, which yield an UNDERFLOW during compilation. Enabled by default.
@item -Wintrinsic-shadow
@opindex @code{Wintrinsic-shadow}

View File

@ -194,19 +194,19 @@ Fortran
; Documented in C
Waliasing
Fortran Warning
Fortran Warning Var(warn_aliasing) LangEnabledBy(Fortran,Wall)
Warn about possible aliasing of dummy arguments
Walign-commons
Fortran Warning
Fortran Warning Var(warn_align_commons) Init(1)
Warn about alignment of COMMON blocks
Wampersand
Fortran Warning
Fortran Warning Var(warn_ampersand) LangEnabledBy(Fortran,Wall || Wpedantic)
Warn about missing ampersand in continued character constants
Warray-temporaries
Fortran Warning
Fortran Warning Var(warn_array_temporaries)
Warn about creation of array temporaries
Wc-binding-type
@ -222,7 +222,7 @@ Fortran Var(warn_character_truncation) Warning LangEnabledBy(Fortran,Wall)
Warn about truncated character expressions
Wcompare-reals
Fortran Warning
Fortran Warning Var(warn_compare_reals) LangEnabledBy(Fortran,Wextra)
Warn about equality comparisons involving REAL or COMPLEX expressions
Wconversion
@ -235,28 +235,32 @@ Warn about most implicit conversions
Wextra
Fortran Warning
Print extra (possibly unwanted) warnings
; Documented in common
Wfunction-elimination
Fortran Warning
Fortran Warning Var(warn_function_elimination)
Warn about function call elimination
Wimplicit-interface
Fortran Warning
Fortran Warning Var(warn_implicit_interface)
Warn about calls with implicit interface
Wimplicit-procedure
Fortran Warning
Fortran Warning Var(warn_implicit_procedure)
Warn about called procedures not explicitly declared
Wline-truncation
Fortran Warning
Fortran Warning Var(warn_line_truncation) LangEnabledBy(Fortran,Wall)
Warn about truncated source lines
Wintrinsics-std
Fortran Var(warn_intrinsics_std) Warning LangEnabledBy(Fortran,Wall)
Warn on intrinsics not part of the selected standard
Wmaybe-uninitialized
Fortran LangEnabledBy(Fortran,Wall)
; Documented in common.opt
Wmissing-include-dirs
Fortran
; Documented in C/C++
@ -274,27 +278,27 @@ Fortran
; Documented in common.opt
Wreal-q-constant
Fortran Warning
Fortran Warning Var(warn_real_q_constant) LangEnabledBy(Fortran,Wall)
Warn about real-literal-constants with 'q' exponent-letter
Wrealloc-lhs
Fortran Warning
Fortran Warning Var(warn_realloc_lhs) LangEnabledBy(Fortran,Wrealloc-lhs-all)
Warn when a left-hand-side array variable is reallocated
Wrealloc-lhs-all
Fortran Warning
Fortran Warning Var(warn_realloc_lhs_all)
Warn when a left-hand-side variable is reallocated
Wtarget-lifetime
Fortran Warning
Fortran Warning Var(warn_target_lifetime) LangEnabledBy(Fortran,Wall)
Warn if the pointer in a pointer assignment might outlive its target
Wreturn-type
Fortran Warning
Fortran Warning LangEnabledBy(Fortran,Wall)
; Documented in C
Wsurprising
Fortran Warning
Fortran Warning Var(warn_surprising) LangEnabledBy(Fortran,Wall)
Warn about \"suspicious\" constructs
Wtabs
@ -302,19 +306,27 @@ Fortran Warning Var(warn_tabs) LangEnabledBy(Fortran,Wall || Wpedantic)
Permit nonconforming uses of the tab character
Wunderflow
Fortran Warning
Fortran Warning Var(warn_underflow) Init(1)
Warn about underflow of numerical constant expressions
Wuninitialized
Fortran LangEnabledBy(Fortran,Wall)
; Documented in common.opt
Wintrinsic-shadow
Fortran Warning
Fortran Warning Var(warn_intrinsic_shadow) LangEnabledBy(Fortran,Wall)
Warn if a user-procedure has the same name as an intrinsic
Wunused
LangEnabledBy(Fortran,Wall)
; Documented in common.opt
Wunused-dummy-argument
Fortran Warning
Fortran Warning Var(warn_unused_dummy_argument) LangEnabledBy(Fortran,Wall)
Warn about unused dummy arguments.
Wzerotrip
Fortran Warning
Fortran Warning Var(warn_zerotrip) LangEnabledBy(Fortran,Wall)
Warn about zero-trip DO loops
cpp

View File

@ -93,23 +93,6 @@ gfc_init_options (unsigned int decoded_options_count,
gfc_option.dump_fortran_original = 0;
gfc_option.dump_fortran_optimized = 0;
gfc_option.warn_aliasing = 0;
gfc_option.warn_ampersand = 0;
gfc_option.warn_array_temp = 0;
gfc_option.warn_function_elimination = 0;
gfc_option.warn_implicit_interface = 0;
gfc_option.warn_line_truncation = 0;
gfc_option.warn_surprising = 0;
gfc_option.warn_underflow = 1;
gfc_option.warn_intrinsic_shadow = 0;
gfc_option.warn_align_commons = 1;
gfc_option.warn_real_q_constant = 0;
gfc_option.warn_unused_dummy_argument = 0;
gfc_option.warn_zerotrip = 0;
gfc_option.warn_realloc_lhs = 0;
gfc_option.warn_realloc_lhs_all = 0;
gfc_option.warn_compare_reals = 0;
gfc_option.warn_target_lifetime = 0;
gfc_option.max_errors = 25;
gfc_option.flag_all_intrinsics = 0;
@ -423,53 +406,18 @@ gfc_post_options (const char **pfilename)
if (!gfc_option.flag_automatic)
gfc_option.flag_max_stack_var_size = 0;
if (pedantic)
gfc_option.warn_ampersand = 1;
/* Optimization implies front end optimization, unless the user
specified it directly. */
if (gfc_option.flag_frontend_optimize == -1)
gfc_option.flag_frontend_optimize = optimize;
if (gfc_option.warn_realloc_lhs_all)
gfc_option.warn_realloc_lhs = 1;
gfc_cpp_post_options ();
return gfc_cpp_preprocess_only ();
}
/* Set the options for -Wall. */
static void
set_Wall (int setting)
{
gfc_option.warn_aliasing = setting;
gfc_option.warn_ampersand = setting;
gfc_option.warn_line_truncation = setting;
gfc_option.warn_surprising = setting;
gfc_option.warn_underflow = setting;
gfc_option.warn_intrinsic_shadow = setting;
gfc_option.warn_real_q_constant = setting;
gfc_option.warn_unused_dummy_argument = setting;
gfc_option.warn_target_lifetime = setting;
gfc_option.warn_zerotrip = setting;
warn_return_type = setting;
warn_uninitialized = setting;
warn_maybe_uninitialized = setting;
}
/* Set the options for -Wextra. */
static void
set_Wextra (int setting)
{
gfc_option.warn_compare_reals = setting;
}
static void
gfc_handle_module_path_options (const char *arg)
{
@ -630,94 +578,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
result = false;
break;
case OPT_Wall:
handle_generated_option (&global_options, &global_options_set,
OPT_Wunused, NULL, value,
gfc_option_lang_mask (), kind, loc,
handlers, global_dc);
set_Wall (value);
break;
case OPT_Waliasing:
gfc_option.warn_aliasing = value;
break;
case OPT_Wampersand:
gfc_option.warn_ampersand = value;
break;
case OPT_Warray_temporaries:
gfc_option.warn_array_temp = value;
break;
case OPT_Wcompare_reals:
gfc_option.warn_compare_reals = value;
break;
case OPT_Wextra:
set_Wextra (value);
break;
case OPT_Wfunction_elimination:
gfc_option.warn_function_elimination = value;
break;
case OPT_Wimplicit_interface:
gfc_option.warn_implicit_interface = value;
break;
case OPT_Wimplicit_procedure:
gfc_option.warn_implicit_procedure = value;
break;
case OPT_Wline_truncation:
gfc_option.warn_line_truncation = value;
break;
case OPT_Wrealloc_lhs:
gfc_option.warn_realloc_lhs = value;
break;
case OPT_Wrealloc_lhs_all:
gfc_option.warn_realloc_lhs_all = value;
break;
case OPT_Wreturn_type:
warn_return_type = value;
break;
case OPT_Wsurprising:
gfc_option.warn_surprising = value;
break;
case OPT_Wtarget_lifetime:
gfc_option.warn_target_lifetime = value;
break;
case OPT_Wunderflow:
gfc_option.warn_underflow = value;
break;
case OPT_Wintrinsic_shadow:
gfc_option.warn_intrinsic_shadow = value;
break;
case OPT_Walign_commons:
gfc_option.warn_align_commons = value;
break;
case OPT_Wreal_q_constant:
gfc_option.warn_real_q_constant = value;
break;
case OPT_Wunused_dummy_argument:
gfc_option.warn_unused_dummy_argument = value;
break;
case OPT_Wzerotrip:
gfc_option.warn_zerotrip = value;
break;
case OPT_fall_intrinsics:
gfc_option.flag_all_intrinsics = 1;
break;
@ -1003,7 +863,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_option.max_continue_fixed = 19;
gfc_option.max_continue_free = 39;
gfc_option.max_identifier_length = 31;
gfc_option.warn_ampersand = 1;
warn_ampersand = 1;
warn_tabs = 1;
break;
@ -1012,7 +872,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008_OBS;
gfc_option.warn_std = GFC_STD_F95_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
warn_ampersand = 1;
warn_tabs = 1;
break;
@ -1021,7 +881,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F2008 | GFC_STD_F2008_OBS;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
warn_ampersand = 1;
warn_tabs = 1;
break;
@ -1031,7 +891,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
| GFC_STD_F2008_TS;
gfc_option.warn_std = GFC_STD_F95_OBS | GFC_STD_F2008_OBS;
gfc_option.max_identifier_length = 63;
gfc_option.warn_ampersand = 1;
warn_ampersand = 1;
warn_tabs = 1;
break;

View File

@ -557,7 +557,7 @@ match_real_constant (gfc_expr **result, int signflag)
if (!gfc_notify_std (GFC_STD_GNU, "exponent-letter 'q' in "
"real-literal-constant at %C"))
return MATCH_ERROR;
else if (gfc_option.warn_real_q_constant)
else if (warn_real_q_constant)
gfc_warning("Extension: exponent-letter 'q' in real-literal-constant "
"at %C");
}
@ -726,7 +726,7 @@ done:
goto cleanup;
case ARITH_UNDERFLOW:
if (gfc_option.warn_underflow)
if (warn_underflow)
gfc_warning ("Real constant underflows its kind at %C");
mpfr_set_ui (e->value.real, 0, GFC_RND_MODE);
break;
@ -951,7 +951,7 @@ static match
match_string_constant (gfc_expr **result)
{
char name[GFC_MAX_SYMBOL_LEN + 1], peek;
int i, kind, length, warn_ampersand, ret;
int i, kind, length, save_warn_ampersand, ret;
locus old_locus, start_locus;
gfc_symbol *sym;
gfc_expr *e;
@ -1071,8 +1071,8 @@ got_delim:
/* We disable the warning for the following loop as the warning has already
been printed in the loop above. */
warn_ampersand = gfc_option.warn_ampersand;
gfc_option.warn_ampersand = 0;
save_warn_ampersand = warn_ampersand;
warn_ampersand = 0;
p = e->value.character.string;
for (i = 0; i < length; i++)
@ -1091,7 +1091,7 @@ got_delim:
}
*p = '\0'; /* TODO: C-style string is for development/debug purposes. */
gfc_option.warn_ampersand = warn_ampersand;
warn_ampersand = save_warn_ampersand;
next_string_char (delimiter, &ret);
if (ret != -1)

View File

@ -1643,7 +1643,7 @@ gfc_resolve_intrinsic (gfc_symbol *sym, locus *loc)
if (isym && !sym->attr.subroutine)
{
if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising
if (sym->ts.type != BT_UNKNOWN && warn_surprising
&& !sym->attr.implicit_type)
gfc_warning ("Type specified for intrinsic function '%s' at %L is"
" ignored", sym->name, &sym->declared_at);
@ -3571,7 +3571,7 @@ resolve_operator (gfc_expr *e)
e->ts.type = BT_LOGICAL;
e->ts.kind = gfc_default_logical_kind;
if (gfc_option.warn_compare_reals)
if (warn_compare_reals)
{
gfc_intrinsic_op op = e->value.op.op;
@ -6331,8 +6331,7 @@ gfc_resolve_iterator (gfc_iterator *iter, bool real_ok, bool own_scope)
sgn = mpfr_sgn (iter->step->value.real);
cmp = mpfr_cmp (iter->end->value.real, iter->start->value.real);
}
if (gfc_option.warn_zerotrip &&
((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0)))
if (warn_zerotrip && ((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0)))
gfc_warning ("DO loop at %L will be executed zero times"
" (use -Wno-zerotrip to suppress)",
&iter->step->where);
@ -7709,7 +7708,7 @@ resolve_select (gfc_code *code, bool select_type)
&& cp->low != cp->high
&& gfc_compare_expr (cp->low, cp->high, INTRINSIC_GT) > 0)
{
if (gfc_option.warn_surprising)
if (warn_surprising)
gfc_warning ("Range specification at %L can never "
"be matched", &cp->where);
@ -7811,8 +7810,7 @@ resolve_select (gfc_code *code, bool select_type)
/* More than two cases is legal but insane for logical selects.
Issue a warning for it. */
if (gfc_option.warn_surprising && type == BT_LOGICAL
&& ncases > 2)
if (warn_surprising && type == BT_LOGICAL && ncases > 2)
gfc_warning ("Logical SELECT CASE block at %L has more that two cases",
&code->loc);
}
@ -9182,7 +9180,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (rhs->is_boz && lhs->ts.type != BT_INTEGER)
{
int rc;
if (gfc_option.warn_surprising)
if (warn_surprising)
gfc_warning ("BOZ literal at %L is bitwise transferred "
"non-integer symbol '%s'", &code->loc,
lhs->symtree->n.sym->name);
@ -10483,7 +10481,7 @@ resolve_charlen (gfc_charlen *cl)
value, the length of character entities declared is zero." */
if (cl->length && !gfc_extract_int (cl->length, &i) && i < 0)
{
if (gfc_option.warn_surprising)
if (warn_surprising)
gfc_warning_now ("CHARACTER variable at %L has negative length %d,"
" the length has been set to zero",
&cl->length->where, i);
@ -11499,7 +11497,7 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool *finalizable)
}
/* Warn if the procedure is non-scalar and not assumed shape. */
if (gfc_option.warn_surprising && arg->as && arg->as->rank != 0
if (warn_surprising && arg->as && arg->as->rank != 0
&& arg->as->type != AS_ASSUMED_SHAPE)
gfc_warning ("Non-scalar FINAL procedure at %L should have assumed"
" shape argument", &arg->declared_at);
@ -11558,7 +11556,7 @@ error:
/* Warn if we haven't seen a scalar finalizer procedure (but we know there
were nodes in the list, must have been for arrays. It is surely a good
idea to have a scalar version there if there's something to finalize. */
if (gfc_option.warn_surprising && result && !seen_scalar)
if (warn_surprising && result && !seen_scalar)
gfc_warning ("Only array FINAL procedures declared for derived type '%s'"
" defined at %L, suggest also scalar one",
derived->name, &derived->declared_at);

View File

@ -1048,7 +1048,7 @@ restart:
}
/* Check to see if the continuation line was truncated. */
if (gfc_option.warn_line_truncation && gfc_current_locus.lb != NULL
if (warn_line_truncation && gfc_current_locus.lb != NULL
&& gfc_current_locus.lb->truncated)
{
int maxlen = gfc_option.free_line_length;
@ -1154,7 +1154,7 @@ restart:
if (in_string)
{
gfc_current_locus.nextc--;
if (gfc_option.warn_ampersand && in_string == INSTRING_WARN)
if (warn_ampersand && in_string == INSTRING_WARN)
gfc_warning ("Missing '&' in continued character "
"constant at %C");
}
@ -1190,7 +1190,7 @@ restart:
goto done;
/* Check to see if the continuation line was truncated. */
if (gfc_option.warn_line_truncation && gfc_current_locus.lb != NULL
if (warn_line_truncation && gfc_current_locus.lb != NULL
&& gfc_current_locus.lb->truncated)
{
gfc_current_locus.lb->truncated = 0;

View File

@ -715,8 +715,7 @@ simplify_achar_char (gfc_expr *e, gfc_expr *k, const char *name, bool ascii)
return &gfc_bad_expr;
}
if (ascii && gfc_option.warn_surprising
&& mpz_cmp_si (e->value.integer, 127) > 0)
if (ascii && warn_surprising && mpz_cmp_si (e->value.integer, 127) > 0)
gfc_warning ("Argument of %s function at %L outside of range [0,127]",
name, &e->where);
@ -2505,7 +2504,7 @@ gfc_simplify_iachar (gfc_expr *e, gfc_expr *kind)
index = e->value.character.string[0];
if (gfc_option.warn_surprising && index > 127)
if (warn_surprising && index > 127)
gfc_warning ("Argument of IACHAR function at %L outside of range 0..127",
&e->where);

View File

@ -1041,7 +1041,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss,
gcc_assert (ss->dimen > 0);
gcc_assert (ss->loop->dimen == ss->dimen);
if (gfc_option.warn_array_temp && where)
if (warn_array_temporaries && where)
gfc_warning ("Creating array temporary at %L", where);
/* Set the lower bound to zero. */
@ -5921,7 +5921,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
stride = gfc_index_one_node;
if (gfc_option.warn_array_temp)
if (warn_array_temporaries)
gfc_warning ("Creating array temporary at %L", &loc);
}
@ -7202,7 +7202,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
}
/* Repack the array. */
if (gfc_option.warn_array_temp)
if (warn_array_temporaries)
{
if (fsym)
gfc_warning ("Creating array temporary at %L for argument '%s'",

View File

@ -1133,7 +1133,7 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
/* The required offset conflicts with previous alignment
requirements. Insert padding immediately before this
segment. */
if (gfc_option.warn_align_commons)
if (warn_align_commons)
{
if (strcmp (common->name, BLANK_COMMON_NAME))
gfc_warning ("Padding of %d bytes required before '%s' in "
@ -1167,7 +1167,7 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
return;
}
if (common_segment->offset != 0 && gfc_option.warn_align_commons)
if (common_segment->offset != 0 && warn_align_commons)
{
if (strcmp (common->name, BLANK_COMMON_NAME))
gfc_warning ("COMMON '%s' at %L requires %d bytes of padding; "

View File

@ -4989,8 +4989,7 @@ generate_local_decl (gfc_symbol * sym)
else if (sym->attr.dummy && !sym->attr.in_namelist)
{
/* INTENT(out) dummy arguments are likely meant to be set. */
if (gfc_option.warn_unused_dummy_argument
&& sym->attr.intent == INTENT_OUT)
if (warn_unused_dummy_argument && sym->attr.intent == INTENT_OUT)
{
if (sym->ts.type != BT_DERIVED)
gfc_warning ("Dummy argument '%s' at %L was declared "
@ -5005,7 +5004,7 @@ generate_local_decl (gfc_symbol * sym)
if (sym->backend_decl != NULL_TREE)
TREE_NO_WARNING(sym->backend_decl) = 1;
}
else if (gfc_option.warn_unused_dummy_argument)
else if (warn_unused_dummy_argument)
{
gfc_warning ("Unused dummy argument '%s' at %L", sym->name,
&sym->declared_at);
@ -5121,7 +5120,7 @@ generate_local_decl (gfc_symbol * sym)
{
if (!sym->attr.referenced)
{
if (gfc_option.warn_unused_dummy_argument)
if (warn_unused_dummy_argument)
gfc_warning ("Unused dummy argument '%s' at %L", sym->name,
&sym->declared_at);
}

View File

@ -1111,11 +1111,10 @@ assign:
static void
realloc_lhs_warning (bt type, bool array, locus *where)
{
if (array && type != BT_CLASS && type != BT_DERIVED
&& gfc_option.warn_realloc_lhs)
if (array && type != BT_CLASS && type != BT_DERIVED && warn_realloc_lhs)
gfc_warning ("Code for reallocating the allocatable array at %L will "
"be added", where);
else if (gfc_option.warn_realloc_lhs_all)
else if (warn_realloc_lhs_all)
gfc_warning ("Code for reallocating the allocatable variable at %L "
"will be added", where);
}

View File

@ -6146,7 +6146,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr)
{
tmp = gfc_build_addr_expr (NULL_TREE, argse.expr);
if (gfc_option.warn_array_temp)
if (warn_array_temporaries)
gfc_warning ("Creating array temporary at %L", &expr->where);
source = build_call_expr_loc (input_location,