[Bug c/71110] label "caseN" should be warned about

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 15 21:31:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71110

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dmalcolm at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug.

We already issue a warning for this within -Wall, via -Wunused-label (since
sometime at or before gcc 4.4, I think):

test.c: In function ‘main’:
test.c:18:3: warning: label ‘case2’ defined but not used [-Wunused-label]
   case2:
   ^~~~~

I think that if the user accidentally omits the space between the "case" and
the value, they're unlikely to also have a reference to that label name.

Marking this one as resolved.  Feel free to reopen if I'm missing something
here.


More information about the Gcc-bugs mailing list