[Mesa-dev] [PATCH 1/6] gallium: use enums in p_defines.h

Emil Velikov emil.l.velikov at gmail.com
Sat Apr 16 23:22:54 UTC 2016

On 16 April 2016 at 22:04, Marek Olšák <maraeo at gmail.com> wrote:
> On Sat, Apr 16, 2016 at 9:40 PM, Rob Clark <robdclark at gmail.com> wrote:
>> On Sat, Apr 16, 2016 at 8:50 AM, Marek Olšák <maraeo at gmail.com> wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>> and remove number assignments which are consecutive
>>> ---
>>>  src/gallium/include/pipe/p_defines.h | 378 +++++++++++++++++++----------------
>>>  1 file changed, 205 insertions(+), 173 deletions(-)
>>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>>> index 1aef21d..6bb180d 100644
>>> --- a/src/gallium/include/pipe/p_defines.h
>>> +++ b/src/gallium/include/pipe/p_defines.h
>>> @@ -51,49 +51,56 @@ enum pipe_error
>>>     /* TODO */
>>>  };
>>> +enum {
>> so, I would kinda like to use named enums, and then update the state
>> structs to use 'em (since it would make gcc and gdb grok them
>> better).. ofc it is a big change and doesn't have to be done in all
>> one go, but why not give the enum's names in this first step?
> Enum type names can't be used everywhere. A lot of states are packed
> (unsigned x:n). Not sure how enums work with that. In any case, let's
> add the names later if needed.
Please name the new enums. All of the ones in gallium/include have names.

On the topic of using the enums in the structs (and passing them
around in the functions) yes that is a very good idea imho. Although
could/should happen in the long term. Because a) one has to explicitly
pack them and b) one has to be wary of buggy GCC [1] [2].

Note: i965 recently started using packed enums, so we might want to
check exactly when that happened and bump the requirement to GCC
4.3.6+ as per the second bug report.


[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14124
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39219

More information about the mesa-dev mailing list