Re: bitwise enums

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

 



On Tue, Feb 20, 2018 at 02:18:28PM -0800, Linus Torvalds wrote:
> 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".

Actually, I do want bitwise; I'm looking at creating vm_fault_t so that
we don't get fault handlers returning -EFOO instead of VM_FAULT_FOO.
This would also be good for gfp_t.  I don't have a particularly strong
feeling about other enums, but it would probably be good to find someone
with strong feelings so that we're not passing up an opportunity to do
something better than what I've asked for.

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