Re: [PATCH 03/10] fast-export: use value from correct enum
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 12, 2018, 09:12 UTC
- Message-ID
- <CACBZZX6Ck-M7UPK85UW4ZOYWeodSJo0gp7Kgs__on5SfZDmojA@mail.gmail.com>
- In-Reply-To
- <87va532x5i.fsf@evledraar.gmail.com>
On Sun, Nov 11, 2018 at 9:10 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 36 quoted lines
>
>
> On Sun, Nov 11 2018, Jeff King wrote:
>
> > On Sat, Nov 10, 2018 at 10:23:05PM -0800, Elijah Newren wrote:
> >
> >> ABORT and ERROR happen to have the same value, but come from differnt
> >> enums. Use the one from the correct enum.
> >
> > Yikes. :)
> >
> > This is a good argument for naming these SIGNED_TAG_ABORT, etc. But this
> > is obviously an improvement in the meantime.
>
> In C enum values aren't the types of the enum, but I'd thought someone
> would have added a warning for this:
>
> #include <stdio.h>
>
> enum { A, B } foo = A;
> enum { C, D } bar = C;
>
> int main(void)
> {
> switch (foo) {
> case C:
> puts("A");
> break;
> case B:
> puts("B");
> break;
> }
> }
>
> But none of the 4 C compilers (gcc, clang, suncc & xlc) I have warn
> about it. Good to know.Asked GCC to implement it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87983