[PATCH wayland] Add "enum" attribute to "arg" elements

Auke Booij auke at tulcod.com
Mon Apr 27 05:20:09 PDT 2015


On 21 Apr 2015 09:18, "Pekka Paalanen" <ppaalanen at gmail.com> wrote:
> Two things I came up with in the IRC discussion was that only <arg>
> types of int an uint are eligible for enums, and only uint for
> bitfields. I think wayland-scanner should enforce that.

I just realised another aspect of this. Can a (non-bitfield) enum be used
both as an int and a uint? So some *int* argument somewhere has enum="bla",
and a *uint* argument somewhere else has enum="bla" as well. What about
enums that list negative values, can they be used as uints?

I feel that this would be extremely prone to bugs, and in fact I think this
is a situation where semantic information of enum style arguments can help
catch bugs in C code (which so far we haven't seen yet in this debate).

Should this be enforced by the scanner? Or is there some crazy situation in
which it makes sense?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150427/1ca1c6e6/attachment-0001.html>


More information about the wayland-devel mailing list