aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
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 4b1718c..1bd59ff 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"