[Mesa-dev] [PATCH] ast: Updated AST_NUM_OPERATORS for coherence with ast_operators

Matt Turner mattst88 at gmail.com
Mon Aug 1 18:12:57 UTC 2016


On Mon, Aug 1, 2016 at 6:02 AM, Eric Engestrom
<eric.engestrom at imgtec.com> wrote:
> On Sun, Jul 31, 2016 at 07:07:34PM +0300, Andres Gomez wrote:
>> AST_NUM_OPERATORS stores the dimension of the ast_operators
>> enumeration but was not updated after its last modification.
>>
>> This doesn't add any real modification for any code paths but it makes
>> sense for coherence.
>>
>> Signed-off-by: Andres Gomez <agomez at igalia.com>
>> ---
>>  src/compiler/glsl/ast.h          | 19 ++++++++++---------
>>  src/compiler/glsl/ast_to_hir.cpp |  1 +
>>  2 files changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
>> index 157895d..89f531c 100644
>> --- a/src/compiler/glsl/ast.h
>> +++ b/src/compiler/glsl/ast.h
>> @@ -198,9 +198,19 @@ enum ast_operators {
>>
>>     ast_sequence,
>>     ast_aggregate
>> +   /** Update AST_NUM_OPERATORS if more are appended */
>>  };
>>
>>  /**
>> + * Number of possible operators for an ast_expression
>> + *
>> + * This is done as a define instead of as an additional value in the enum so
>> + * that the compiler won't generate spurious messages like "warning:
>> + * enumeration value ‘ast_num_operators’ not handled in switch"
>> + */
>> +#define AST_NUM_OPERATORS (ast_aggregate + 1)
>
> Since you're moving the #define, why not move it at the end of the enum,
> instead of adding the message there to go and look for the define?
> Other than that, the change looks good :)

Indeed. With that addressed,

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list