* c-decl.c (pop_scope): Replace warnings with call to
warn_for_unused_label.
* c-common.h (warn_for_unused_label): Declare.
* c-common.c (warn_for_unused_label): Define.
cp/
* decl.c (pop_label): Replace warning with call to
warn_for_unused_label.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121310
138bc75d-0d04-0410-961f-
82ee72b054a4
+007-01-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * c-decl.c (pop_scope): Replace warnings with call to
+ warn_for_unused_label.
+ * c-common.h (warn_for_unused_label): Declare.
+ * c-common.c (warn_for_unused_label): Define.
+
2007-01-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* tree-optimize.c (update_inlined_to_pointers): Delete unused
"have their mathematical meaning");
}
+/* If LABEL (a LABEL_DECL) has not been used, issue a warning. */
+
+void
+warn_for_unused_label (tree label)
+{
+ if (!TREE_USED (label))
+ {
+ if (DECL_INITIAL (label))
+ warning (OPT_Wunused_label, "label %q+D defined but not used", label);
+ else
+ warning (OPT_Wunused_label, "label %q+D declared but not defined", label);
+ }
+}
#include "gt-c-common.h"
extern void warn_array_subscript_with_type_char (tree);
extern void warn_about_parentheses (enum tree_code, enum tree_code,
enum tree_code);
+extern void warn_for_unused_label (tree label);
/* In c-gimplify.c */
error ("label %q+D used but not defined", p);
DECL_INITIAL (p) = error_mark_node;
}
- else if (!TREE_USED (p) && warn_unused_label)
- {
- if (DECL_INITIAL (p))
- warning (0, "label %q+D defined but not used", p);
- else
- warning (0, "label %q+D declared but not defined", p);
- }
+ else
+ warn_for_unused_label (p);
+
/* Labels go in BLOCK_VARS. */
TREE_CHAIN (p) = BLOCK_VARS (block);
BLOCK_VARS (block) = p;
+2007-01-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * decl.c (pop_label): Replace warning with call to
+ warn_for_unused_label.
+
2007-01-28 Andrew Pinski <pinskia@gmail.com>
PR C++/28988
/* Avoid crashing later. */
define_label (location, DECL_NAME (label));
}
- else if (!TREE_USED (label))
- warning (OPT_Wunused_label, "label %q+D defined but not used", label);
+ else
+ warn_for_unused_label (label);
}
SET_IDENTIFIER_LABEL_VALUE (DECL_NAME (label), old_value);