tree.h (warn_about_unused_variables): Declare.
* tree.h (warn_about_unused_variables): Declare. * stmt.c (warn_about_unused_variables): New function, split out from ... (expand_end_bindings): Here. From-SVN: r29486
This commit is contained in:
parent
086925d8cc
commit
ba7166773b
|
@ -1,3 +1,10 @@
|
|||
Fri Sep 17 15:11:20 1999 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* tree.h (warn_about_unused_variables): Declare.
|
||||
* stmt.c (warn_about_unused_variables): New function, split out
|
||||
from ...
|
||||
(expand_end_bindings): Here.
|
||||
|
||||
Fri Sep 17 15:07:37 1999 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* stmt.c (preserve_subexpressions_p): Don't crash when
|
||||
|
|
29
gcc/stmt.c
29
gcc/stmt.c
|
@ -3492,6 +3492,25 @@ expand_nl_goto_receivers (thisblock)
|
|||
emit_label (afterward);
|
||||
}
|
||||
|
||||
/* Warn about any unused VARS (which may contain nodes other than
|
||||
VAR_DECLs, but such nodes are ignored). The nodes are connected
|
||||
via the TREE_CHAIN field. */
|
||||
|
||||
void
|
||||
warn_about_unused_variables (vars)
|
||||
tree vars;
|
||||
{
|
||||
tree decl;
|
||||
|
||||
if (warn_unused)
|
||||
for (decl = vars; decl; decl = TREE_CHAIN (decl))
|
||||
if (TREE_CODE (decl) == VAR_DECL
|
||||
&& ! TREE_USED (decl)
|
||||
&& ! DECL_IN_SYSTEM_HEADER (decl)
|
||||
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
|
||||
warning_with_decl (decl, "unused variable `%s'");
|
||||
}
|
||||
|
||||
/* Generate RTL code to terminate a binding contour.
|
||||
|
||||
VARS is the chain of VAR_DECL nodes for the variables bound in this
|
||||
|
@ -3532,13 +3551,9 @@ expand_end_bindings (vars, mark_ends, dont_jump_in)
|
|||
|
||||
thisblock = block_stack;
|
||||
|
||||
if (warn_unused)
|
||||
for (decl = vars; decl; decl = TREE_CHAIN (decl))
|
||||
if (TREE_CODE (decl) == VAR_DECL
|
||||
&& ! TREE_USED (decl)
|
||||
&& ! DECL_IN_SYSTEM_HEADER (decl)
|
||||
&& DECL_NAME (decl) && ! DECL_ARTIFICIAL (decl))
|
||||
warning_with_decl (decl, "unused variable `%s'");
|
||||
/* If any of the variables in this scope were not used, warn the
|
||||
user. */
|
||||
warn_about_unused_variables (vars);
|
||||
|
||||
if (thisblock->exit_label)
|
||||
{
|
||||
|
|
|
@ -2054,6 +2054,7 @@ extern void expand_return PROTO((tree));
|
|||
extern int optimize_tail_recursion PROTO((tree, struct rtx_def *));
|
||||
extern void expand_start_bindings PROTO((int));
|
||||
extern void expand_end_bindings PROTO((tree, int, int));
|
||||
extern void warn_about_unused_variables PROTO((tree));
|
||||
extern void start_cleanup_deferral PROTO((void));
|
||||
extern void end_cleanup_deferral PROTO((void));
|
||||
extern void mark_block_as_eh_region PROTO((void));
|
||||
|
|
Loading…
Reference in New Issue