summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-29 21:05:58 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-29 21:05:58 +0000
commit92fccaaa535d5555bda8058c165fe3b2e0528c88 (patch)
treed2e910056e5bca216a5240901b18a528d2b8fe28 /gcc/c-common.c
parente00076da6d4b2beea95861f41ef32d6aaac272d3 (diff)
downloadgcc-92fccaaa535d5555bda8058c165fe3b2e0528c88.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121310 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 4b1718cd817..1bd59ff5e22 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -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"