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. cp/ * decl.c (pop_label): Replace warning with call to warn_for_unused_label. From-SVN: r121310
This commit is contained in:
parent
971005966f
commit
c616e51b00
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
|
|
@ -6758,5 +6758,18 @@ warn_about_parentheses (enum tree_code code, enum tree_code code_left,
|
|||
"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"
|
||||
|
|
|
@ -868,6 +868,7 @@ extern tree builtin_type_for_size (int, bool);
|
|||
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 */
|
||||
|
|
10
gcc/c-decl.c
10
gcc/c-decl.c
|
@ -761,13 +761,9 @@ pop_scope (void)
|
|||
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;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -365,8 +365,8 @@ pop_label (tree label, tree old_value)
|
|||
/* 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);
|
||||
|
|
Loading…
Reference in New Issue