===================================================================
@@ -230,6 +230,10 @@ Wconversion-extra
Fortran Warning
Warn about most implicit conversions
+Wextra
+Fortran Warning
+Print extra (possibly unwanted) warnings
+
Wfunction-elimination
Fortran Warning
Warn about function call elimination
===================================================================
@@ -727,7 +727,7 @@ warnings.
Enables commonly used warning options pertaining to usage that
we recommend avoiding and that we believe are easy to avoid.
This currently includes @option{-Waliasing}, @option{-Wampersand},
-@option{-Wconversion}, @option{-Wsurprising},
+@option{-Wconversion}, @option{-Wsurprising}, @option{-Wc-binding-type},
@option{-Wintrinsics-std}, @option{-Wno-tabs}, @option{-Wintrinsic-shadow},
@option{-Wline-truncation}, @option{-Wtarget-lifetime},
@option{-Wreal-q-constant} and @option{-Wunused}.
@@ -778,7 +778,8 @@ avoid such temporaries.
Warn if the a variable might not be C interoperable. In particular, warn if
the variable has been declared using an intrinsic type with default kind
instead of using a kind parameter defined for C interoperability in the
-intrinsic @code{ISO_C_Binding} module.
+intrinsic @code{ISO_C_Binding} module. This option is implied by
+@option{-Wall}.
@item -Wcharacter-truncation
@opindex @code{Wcharacter-truncation}
@@ -788,7 +789,8 @@ Warn when a character assignment will truncate the
@item -Wline-truncation
@opindex @code{Wline-truncation}
@cindex warnings, line truncation
-Warn when a source code line will be truncated.
+Warn when a source code line will be truncated. This option is
+implied by @option{-Wall}.
@item -Wconversion
@opindex @code{Wconversion}
@@ -803,6 +805,14 @@ the expression after conversion. Implied by @optio
@cindex conversion
Warn about implicit conversions between different types and kinds.
+@item -Wextra
+@opindex @code{Wextra}
+@cindex extra warnings
+@cindex warnings, extra
+Enables some warning options for usages of language features which
+may be problematic. This currently includes @option{-Wcompare-reals}
+and @option{-Wunused-parameter}.
+
@item -Wimplicit-interface
@opindex @code{Wimplicit-interface}
@cindex warnings, implicit interface
@@ -884,7 +894,7 @@ encountered, which yield an UNDERFLOW during compi
Warn if a user-defined procedure or module procedure has the same name as an
intrinsic; in this case, an explicit interface or @code{EXTERNAL} or
@code{INTRINSIC} declaration might be needed to get calls later resolved to
-the desired intrinsic/procedure.
+the desired intrinsic/procedure. This option is implied by @option{-Wall}.
@item -Wunused-dummy-argument
@opindex @code{Wunused-dummy-argument}
@@ -939,6 +949,7 @@ allocatable variable; this includes scalars and de
@item -Wcompare-reals
@opindex @code{Wcompare-reals}
Warn when comparing real or complex types for equality or inequality.
+This option is implied by @option{-Wextra}.
@item -Wtarget-lifetime
@opindex @code{Wtargt-lifetime}
===================================================================
@@ -814,26 +814,23 @@ gfc_allocate_allocatable (stmtblock_t * block, tre
}
-/* Free a given variable, if it's not NULL. */
+/* Free a given variable. If it is NULL, free takes care of this
+ automatically. */
tree
gfc_call_free (tree var)
{
stmtblock_t block;
- tree tmp, cond, call;
+ tree call;
if (TREE_TYPE (var) != TREE_TYPE (pvoid_type_node))
var = fold_convert (pvoid_type_node, var);
gfc_start_block (&block);
var = gfc_evaluate_now (var, &block);
- cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, var,
- build_int_cst (pvoid_type_node, 0));
call = build_call_expr_loc (input_location,
builtin_decl_explicit (BUILT_IN_FREE),
1, var);
- tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond, call,
- build_empty_stmt (input_location));
- gfc_add_expr_to_block (&block, tmp);
+ gfc_add_expr_to_block (&block, call);
return gfc_finish_block (&block);
}
@@ -861,11 +858,10 @@ gfc_call_free (tree var)
}
}
- In this front-end version, status doesn't have to be GFC_INTEGER_4.
- Moreover, if CAN_FAIL is true, then we will not emit a runtime error,
- even when no status variable is passed to us (this is used for
- unconditional deallocation generated by the front-end at end of
- each procedure).
+ In this front-end version, status doesn't have to be GFC_INTEGER_4. If
+ CAN_FAIL is true, no status variable is passed and we are not dealing with
+ a coarray, we will simply call free(). This is used for unconditional
+ deallocation generated by the front-end at end of each procedure.
If a runtime-message is possible, `expr' must point to the original
expression being deallocated for its locus and variable name.
@@ -890,6 +886,14 @@ gfc_deallocate_with_status (tree pointer, tree sta
STRIP_NOPS (pointer);
}
+ else if (can_fail && status == NULL_TREE)
+ {
+ tmp = build_call_expr_loc (input_location,
+ builtin_decl_explicit (BUILT_IN_FREE), 1,
+ fold_convert (pvoid_type_node, pointer));
+ return tmp;
+ }
+
cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, pointer,
build_int_cst (TREE_TYPE (pointer), 0));
===================================================================
@@ -483,8 +483,15 @@ set_Wall (int 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)
{
@@ -653,6 +660,15 @@ gfc_handle_option (size_t scode, const char *arg,
gfc_option.warn_conversion_extra = value;
break;
+ case OPT_Wextra:
+ handle_generated_option (&global_options, &global_options_set,
+ OPT_Wunused_parameter, NULL, value,
+ gfc_option_lang_mask (), kind, loc,
+ handlers, global_dc);
+ set_Wextra (value);
+
+ break;
+
case OPT_Wfunction_elimination:
gfc_option.warn_function_elimination = value;
break;