+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
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
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)
{
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));