public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges
@ 2004-11-29 11:58 fork0 at users dot sf dot net
  2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: fork0 at users dot sf dot net @ 2004-11-29 11:58 UTC (permalink / raw)
  To: gcc-bugs

gcc (GCC) 4.0.0 20041121 (experimental)

-Wswitch-enum generates the warning even if the range in
case expression covers all possible values of a enum.
The first value of the range (a0 in the example below)
is not listed as missing (but all others, including the
last). The generated code works properly, though.

Example:

enum a { a0, a1, a2, a3 };

int error(enum a aa)
{
  switch ( aa )
  {
  case a0 ... a3:
    return 1;
  }
  return 0;
}

Output:
gcc4-enum.c: In function 'error':
gcc4-enum.c:5: warning: enumeration value 'a1' not handled in switch
gcc4-enum.c:5: warning: enumeration value 'a2' not handled in switch
gcc4-enum.c:5: warning: enumeration value 'a3' not handled in switch

GCC (from gcc-4.0-20041121 snapshot) configured and compiled:
../gcc-4.0-20041121/configure --enable-threads --with-tune=pentium4
--disable-nls --enable-languages=c,c++
(removing -mtune=pentium4 didn't help)

-- 
           Summary: warning: "enumeration value not handled in switch" for
                    '...' ranges
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fork0 at users dot sf dot net
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18715


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-08-22 16:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-29 11:58 [Bug c/18715] New: warning: "enumeration value not handled in switch" for '...' ranges fork0 at users dot sf dot net
2004-11-29 12:52 ` [Bug c/18715] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-14  6:02 ` pinskia at gcc dot gnu dot org
2004-12-14  6:31 ` pinskia at gcc dot gnu dot org
2004-12-14 14:35 ` pinskia at gcc dot gnu dot org
2005-03-20 23:34 ` [Bug c/18715] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-30 18:09 ` jsm28 at gcc dot gnu dot org
2005-04-05  1:42 ` pinskia at gcc dot gnu dot org
2005-04-08 21:48 ` mmitchel at gcc dot gnu dot org
2005-04-21  4:57 ` mmitchel at gcc dot gnu dot org
2005-07-08  1:34 ` mmitchel at gcc dot gnu dot org
2005-08-22 16:24 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:28 ` cvs-commit at gcc dot gnu dot org
2005-08-22 16:29 ` pinskia at gcc dot gnu dot org
2005-08-22 16:31 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).