Mesa (master): ast: Updated AST_NUM_OPERATORS for coherence with ast_operators

Andres Gomez tanty at kemper.freedesktop.org
Tue Aug 2 18:34:52 UTC 2016


Module: Mesa
Branch: master
Commit: 3356ac208b4bb221de455125906ab5bfe6c303db
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3356ac208b4bb221de455125906ab5bfe6c303db

Author: Andres Gomez <agomez at igalia.com>
Date:   Sun Jul 31 19:07:34 2016 +0300

ast: Updated AST_NUM_OPERATORS for coherence with ast_operators

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.

v2 (Eric Engestrom): Just place the define at the end of the
                     enumeration, not below.

Signed-off-by: Andres Gomez <agomez at igalia.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

---

 src/compiler/glsl/ast.h          | 18 +++++++++---------
 src/compiler/glsl/ast_to_hir.cpp |  1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 157895d..75018a0 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -198,6 +198,15 @@ enum ast_operators {
 
    ast_sequence,
    ast_aggregate
+
+   /**
+    * 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)
 };
 
 /**
@@ -416,15 +425,6 @@ public:
                               struct _mesa_glsl_parse_state *state);
 };
 
-/**
- * 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_sequence + 1)
-
 
 class ast_compound_statement : public ast_node {
 public:
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index d246745..ec12ff8 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1351,6 +1351,7 @@ ast_expression::do_hir(exec_list *instructions,
       -1,               /* ast_float_constant doesn't conv to ir_expression. */
       -1,               /* ast_bool_constant doesn't conv to ir_expression. */
       -1,               /* ast_sequence doesn't convert to ir_expression. */
+      -1,               /* ast_aggregate shouldn't ever even get here. */
    };
    ir_rvalue *result = NULL;
    ir_rvalue *op[3];




More information about the mesa-commit mailing list