Re: bitwise enums

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 20, 2018 at 2:00 PM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
>
> One detail about the syntax: my understanding of the attribute
> syntax is that in:
>         typedef __bitwise enum foobar { FOO, BAR, } my_t;
> which is essentially the same as:
>         enum foobar { FOO, BAR, };
>         typedef __bitwise enum foobar my_t;
> the attribute relate to the typedef/my_t and not to the enum type.

You are correct, and I didn't think of that wrinkle.

And it's a fundamental wrinkle. A big part of the __bitwise thing
really is that it creates a private type for each typedef, which is
important for things like "big-endian u32".

Now, arguably the typedef that actually is part of the definition of
the type could be special, but I'm getting the feeling that what Willy
really wants is "nocast", not "bitwise".

Except the sparse "nocast" is so weak as to be almost useless, and
doesn't work at all for this case.

Oh well.

But maybe we could make "nocast" work on enums. They are special enough.

           Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux