public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Basile Starynkevitch <basile@starynkevitch.net>,
	Andrea Monaco <andrea.monaco@autistici.org>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: No warning about duplicate values in enum
Date: Mon, 13 Mar 2023 09:29:56 -0400	[thread overview]
Message-ID: <ZA8lVJnTHtMtEWEx@redhat.com> (raw)
In-Reply-To: <CAH6eHdRioQx5qhxDBvx6wndS+i8AX9m7zTX05BqKSRCOx_j89w@mail.gmail.com>

On Sat, Mar 11, 2023 at 04:48:14PM +0000, Jonathan Wakely via Gcc wrote:
> On Sat, 11 Mar 2023, 12:53 Basile Starynkevitch, <basile@starynkevitch.net>
> wrote:
> 
> > Hello all,
> >
> >
> > Andrea observed that:
> >
> > In gcc 8.3.0, compiling
> >
> >
> > enum
> > test
> >    {
> >      FIRST = 1,
> >      SECOND = 1,
> >      THIRD = 2
> >    };
> >
> > int
> > main (void)
> > {
> >    return 0;
> > }
> >
> >
> > generates no warning even with -Wextra.
> >
> > I believe that the C standard (which I don't have here, but see also
> > https://port70.net/~nsz/c/c11/n1570.html or buy it from ISO) explicitly
> > allow duplicate values in enum.
> >
> 
> 
> Of course it does, it's perfectly valid. Nobody has said it should be
> rejected. The request is for a warning, because for *some* uses of enums
> duplicates are not wanted.

And as I said in the other thread about the very same issue, it's
<https://gcc.gnu.org/PR16186> which is assigned to me and I hope to
implement it for GC 14.

Marek


  reply	other threads:[~2023-03-13 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 12:54 Basile Starynkevitch
2023-03-11 16:48 ` Jonathan Wakely
2023-03-13 13:29   ` Marek Polacek [this message]
2023-03-13 13:38     ` Basile Starynkevitch
  -- strict thread matches above, loose matches on Subject: below --
2023-03-10 12:57 Andrea Monaco
2023-03-10 13:05 ` Marek Polacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZA8lVJnTHtMtEWEx@redhat.com \
    --to=polacek@redhat.com \
    --cc=andrea.monaco@autistici.org \
    --cc=basile@starynkevitch.net \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).