Mesa (glsl2): glsl2: Remove unnecessary use of 'struct' before type names

Ian Romanick idr at kemper.freedesktop.org
Fri Aug 13 23:53:17 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 768b55a5268572ff9fd03e57e92775882eb0a821
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=768b55a5268572ff9fd03e57e92775882eb0a821

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Aug 13 16:46:43 2010 -0700

glsl2: Remove unnecessary use of 'struct' before type names

In C++ you don't have to say 'struct' or 'class' if the declaration of
the type has been seen.  Some compilers will complain if you use
'struct' when 'class' should have been used and vice versa.

Fixes bugzilla #29539.

---

 src/glsl/ast.h                   |    5 ++---
 src/glsl/ast_to_hir.cpp          |   10 +++++-----
 src/glsl/glsl_parser.cpp         |   36 ++++++++++++++++++------------------
 src/glsl/glsl_parser.h           |   26 +++++++++++++-------------
 src/glsl/glsl_parser.ypp         |   36 ++++++++++++++++++------------------
 src/glsl/hir_field_selection.cpp |    2 +-
 6 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index 7ce879b..44c31b6 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -29,7 +29,6 @@
 #include "list.h"
 #include "glsl_parser_extras.h"
 
-struct ir_instruction;
 struct _mesa_glsl_parse_state;
 
 struct YYLTYPE;
@@ -657,8 +656,8 @@ public:
 extern void
 _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state);
 
-extern struct ir_rvalue *
-_mesa_ast_field_selection_to_hir(const struct ast_expression *expr,
+extern ir_rvalue *
+_mesa_ast_field_selection_to_hir(const ast_expression *expr,
 				 exec_list *instructions,
 				 struct _mesa_glsl_parse_state *state);
 
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 9d4448f..6e5d01e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -986,7 +986,7 @@ ast_expression::hir(exec_list *instructions,
 
       assert(operations[this->oper] == ir_binop_mod);
 
-      struct ir_rvalue *temp_rhs;
+      ir_rvalue *temp_rhs;
       temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
 					op[0], op[1]);
 
@@ -1107,7 +1107,7 @@ ast_expression::hir(exec_list *instructions,
 
       type = arithmetic_result_type(op[0], op[1], false, state, & loc);
 
-      struct ir_rvalue *temp_rhs;
+      ir_rvalue *temp_rhs;
       temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
 					op[0], op[1]);
 
@@ -1131,7 +1131,7 @@ ast_expression::hir(exec_list *instructions,
 
       type = arithmetic_result_type(op[0], op[1], false, state, & loc);
 
-      struct ir_rvalue *temp_rhs;
+      ir_rvalue *temp_rhs;
       temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
 					op[0], op[1]);
 
@@ -1453,7 +1453,7 @@ ast_type_specifier::glsl_type(const char **name,
 
 static void
 apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
-				 struct ir_variable *var,
+				 ir_variable *var,
 				 struct _mesa_glsl_parse_state *state,
 				 YYLTYPE *loc)
 {
@@ -1620,7 +1620,7 @@ ast_declarator_list::hir(exec_list *instructions,
 
    foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
       const struct glsl_type *var_type;
-      struct ir_variable *var;
+      ir_variable *var;
 
       /* FINISHME: Emit a warning if a variable declaration shadows a
        * FINISHME: declaration at a higher scope.
diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp
index 8756fcb..7df9e96 100644
--- a/src/glsl/glsl_parser.cpp
+++ b/src/glsl/glsl_parser.cpp
@@ -347,21 +347,21 @@ typedef union YYSTYPE
       unsigned i;
    } type_qualifier;
 
-   struct ast_node *node;
-   struct ast_type_specifier *type_specifier;
-   struct ast_fully_specified_type *fully_specified_type;
-   struct ast_function *function;
-   struct ast_parameter_declarator *parameter_declarator;
-   struct ast_function_definition *function_definition;
-   struct ast_compound_statement *compound_statement;
-   struct ast_expression *expression;
-   struct ast_declarator_list *declarator_list;
-   struct ast_struct_specifier *struct_specifier;
-   struct ast_declaration *declaration;
+   ast_node *node;
+   ast_type_specifier *type_specifier;
+   ast_fully_specified_type *fully_specified_type;
+   ast_function *function;
+   ast_parameter_declarator *parameter_declarator;
+   ast_function_definition *function_definition;
+   ast_compound_statement *compound_statement;
+   ast_expression *expression;
+   ast_declarator_list *declarator_list;
+   ast_struct_specifier *struct_specifier;
+   ast_declaration *declaration;
 
    struct {
-      struct ast_node *cond;
-      struct ast_expression *rest;
+      ast_node *cond;
+      ast_expression *rest;
    } for_rest_statement;
 
 
@@ -4609,7 +4609,7 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 1193 "glsl_parser.ypp"
     {
-	   (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].declarator_list);
+	   (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list);
 	   (yyvsp[(1) - (1)].declarator_list)->link.self_link();
 	;}
     break;
@@ -4619,7 +4619,7 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 1198 "glsl_parser.ypp"
     {
-	   (yyval.node) = (struct ast_node *) (yyvsp[(1) - (2)].node);
+	   (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node);
 	   (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link);
 	;}
     break;
@@ -4687,7 +4687,7 @@ yyreduce:
 
 /* Line 1455 of yacc.c  */
 #line 1263 "glsl_parser.ypp"
-    { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
+    { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
     break;
 
   case 234:
@@ -4730,7 +4730,7 @@ yyreduce:
 
 /* Line 1455 of yacc.c  */
 #line 1297 "glsl_parser.ypp"
-    { (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
+    { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
     break;
 
   case 242:
@@ -4855,7 +4855,7 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 1385 "glsl_parser.ypp"
     {
-	   (yyval.node) = (struct ast_node *) (yyvsp[(1) - (1)].expression);
+	   (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression);
 	;}
     break;
 
diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h
index 4124c7f..48a0a5f 100644
--- a/src/glsl/glsl_parser.h
+++ b/src/glsl/glsl_parser.h
@@ -245,21 +245,21 @@ typedef union YYSTYPE
       unsigned i;
    } type_qualifier;
 
-   struct ast_node *node;
-   struct ast_type_specifier *type_specifier;
-   struct ast_fully_specified_type *fully_specified_type;
-   struct ast_function *function;
-   struct ast_parameter_declarator *parameter_declarator;
-   struct ast_function_definition *function_definition;
-   struct ast_compound_statement *compound_statement;
-   struct ast_expression *expression;
-   struct ast_declarator_list *declarator_list;
-   struct ast_struct_specifier *struct_specifier;
-   struct ast_declaration *declaration;
+   ast_node *node;
+   ast_type_specifier *type_specifier;
+   ast_fully_specified_type *fully_specified_type;
+   ast_function *function;
+   ast_parameter_declarator *parameter_declarator;
+   ast_function_definition *function_definition;
+   ast_compound_statement *compound_statement;
+   ast_expression *expression;
+   ast_declarator_list *declarator_list;
+   ast_struct_specifier *struct_specifier;
+   ast_declaration *declaration;
 
    struct {
-      struct ast_node *cond;
-      struct ast_expression *rest;
+      ast_node *cond;
+      ast_expression *rest;
    } for_rest_statement;
 
 
diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp
index 1ee6da1..e0b1d28 100644
--- a/src/glsl/glsl_parser.ypp
+++ b/src/glsl/glsl_parser.ypp
@@ -59,21 +59,21 @@
       unsigned i;
    } type_qualifier;
 
-   struct ast_node *node;
-   struct ast_type_specifier *type_specifier;
-   struct ast_fully_specified_type *fully_specified_type;
-   struct ast_function *function;
-   struct ast_parameter_declarator *parameter_declarator;
-   struct ast_function_definition *function_definition;
-   struct ast_compound_statement *compound_statement;
-   struct ast_expression *expression;
-   struct ast_declarator_list *declarator_list;
-   struct ast_struct_specifier *struct_specifier;
-   struct ast_declaration *declaration;
+   ast_node *node;
+   ast_type_specifier *type_specifier;
+   ast_fully_specified_type *fully_specified_type;
+   ast_function *function;
+   ast_parameter_declarator *parameter_declarator;
+   ast_function_definition *function_definition;
+   ast_compound_statement *compound_statement;
+   ast_expression *expression;
+   ast_declarator_list *declarator_list;
+   ast_struct_specifier *struct_specifier;
+   ast_declaration *declaration;
 
    struct {
-      struct ast_node *cond;
-      struct ast_expression *rest;
+      ast_node *cond;
+      ast_expression *rest;
    } for_rest_statement;
 }
 
@@ -1191,12 +1191,12 @@ struct_specifier:
 struct_declaration_list:
 	struct_declaration
 	{
-	   $$ = (struct ast_node *) $1;
+	   $$ = (ast_node *) $1;
 	   $1->link.self_link();
 	}
 	| struct_declaration_list struct_declaration
 	{
-	   $$ = (struct ast_node *) $1;
+	   $$ = (ast_node *) $1;
 	   $$->link.insert_before(& $2->link);
 	}
 	;
@@ -1260,7 +1260,7 @@ statement:
 	;
 
 statement_matched:
-	compound_statement	{ $$ = (struct ast_node *) $1; }
+	compound_statement	{ $$ = (ast_node *) $1; }
 	| simple_statement
 	;
 
@@ -1294,7 +1294,7 @@ compound_statement:
 	;
 
 statement_no_new_scope:
-	compound_statement_no_new_scope { $$ = (struct ast_node *) $1; }
+	compound_statement_no_new_scope { $$ = (ast_node *) $1; }
 	| simple_statement
 	;
 
@@ -1383,7 +1383,7 @@ selection_statement_unmatched:
 condition:
 	expression
 	{
-	   $$ = (struct ast_node *) $1;
+	   $$ = (ast_node *) $1;
 	}
 	| fully_specified_type IDENTIFIER '=' initializer
 	{
diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp
index 6dd910d..23045ff 100644
--- a/src/glsl/hir_field_selection.cpp
+++ b/src/glsl/hir_field_selection.cpp
@@ -28,7 +28,7 @@
 #include "ast.h"
 #include "glsl_types.h"
 
-struct ir_rvalue *
+ir_rvalue *
 _mesa_ast_field_selection_to_hir(const ast_expression *expr,
 				 exec_list *instructions,
 				 struct _mesa_glsl_parse_state *state)




More information about the mesa-commit mailing list