diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-01-29 21:05:58 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-01-29 21:05:58 +0000 |
commit | c616e51b000fcbc426ce51a92688c775493906e0 (patch) | |
tree | d2e910056e5bca216a5240901b18a528d2b8fe28 /gcc/c-common.c | |
parent | 971005966f30c246ab1cfcaa537497a852d1be52 (diff) | |
download | gcc-c616e51b000fcbc426ce51a92688c775493906e0.zip gcc-c616e51b000fcbc426ce51a92688c775493906e0.tar.gz gcc-c616e51b000fcbc426ce51a92688c775493906e0.tar.bz2 |
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
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 13 |
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" |