public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/5480: -Wall doesn't issue warning for enumerated type mismatch
@ 2002-11-05  8:09 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2002-11-05  8:09 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, olsenc

Synopsis: -Wall doesn't issue warning for enumerated type mismatch

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Nov  5 08:09:20 2002
State-Changed-Why:
    Confirmed. That's probably just because enum variables
    decay to integers, but anyway.
    
    In C++, you could at least stick the enum into a namespace
    to enforce that people use scoping ;-)

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5480


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

* Re: c/5480: -Wall doesn't issue warning for enumerated type mismatch
@ 2003-04-16 14:33 ehrhardt
  0 siblings, 0 replies; 3+ messages in thread
From: ehrhardt @ 2003-04-16 14:33 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, olsenc

Synopsis: -Wall doesn't issue warning for enumerated type mismatch

State-Changed-From-To: analyzed->closed
State-Changed-By: cae
State-Changed-When: Wed Apr 16 14:33:38 2003
State-Changed-Why:
    Essentially a duplicate of 6024.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5480


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

* c/5480: -Wall doesn't issue warning for enumerated type mismatch
@ 2002-01-24 11:56 olsenc
  0 siblings, 0 replies; 3+ messages in thread
From: olsenc @ 2002-01-24 11:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: ewallace


>Number:         5480
>Category:       c
>Synopsis:       -Wall doesn't issue warning for enumerated type mismatch
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 24 11:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.2
>Organization:
>Environment:
System: Linux ptdl125 2.2.19-6smp-ltd3 #2 SMP Thu Jun 7 19:50:16 PDT 2001 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.2/configure --prefix=/usr/intel/pkgs/gcc/3.0.2 --enable-shared --with-gnu-as=/usr/intel/pkgs/gcc/3.0.2/bin/gas --with-gnu-ld --with-ld=/usr/intel/pkgs/gcc/3.0.2/bin/gld
>Description:
Gcc -Wall doesn't issue a warning that an object declared of enumerated
type is compared or assigned to a different enumerated type.

If you're going to go to the trouble to ensure that all members of an
enumerated type are handled in a switch block, why not cover this case?

Although I marked this as non-critical, this has burned a few of us due to
similar naming for enumerated type choices.

>How-To-Repeat:

typedef enum { SQUARE, HEXAGON, PENTAGON } Polygon;
typedef enum { CAT, DOG, AARDVARK } Animal;

int main(int argc, char **argv)
{
   Polygon foo = PENTAGON;

   if (foo == AARDVARK)
       exit(AARDVARK);
   else
       exit(0);
}
>Fix:
I think a warning should be issued for this case.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-04-16 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05  8:09 c/5480: -Wall doesn't issue warning for enumerated type mismatch bangerth
  -- strict thread matches above, loose matches on Subject: below --
2003-04-16 14:33 ehrhardt
2002-01-24 11:56 olsenc

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).