glsl2: Remove unnecessary use of 'struct' before type names
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 13 Aug 2010 23:46:43 +0000 (16:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 13 Aug 2010 23:46:43 +0000 (16:46 -0700)
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
src/glsl/ast_to_hir.cpp
src/glsl/glsl_parser.cpp
src/glsl/glsl_parser.h
src/glsl/glsl_parser.ypp
src/glsl/hir_field_selection.cpp

index 7ce879bb79ddea2897e5f6b97a20205882a1d1ed..44c31b6e6277b89cb947e38eae6d38901ded6f1c 100644 (file)
@@ -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);
 
index 9d4448f89a83aec195f4ba2160c8ea6fe86d3973..6e5d01ee265dc197594193ce7257429cafa5ced2 100644 (file)
@@ -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.
index 8756fcb721ad154460d64fcd6dd050490a84d50f..7df9e96d16f042d1542f7e8264dee4d278a30195 100644 (file)
@@ -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;
 
index 4124c7f1d2d1420d9d23e99fd570bacdd0be8bdc..48a0a5fb3a31cbf398c78984cbff71863be8c008 100644 (file)
@@ -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;
 
 
index 1ee6da1d23af92c910f6ab5ad930df122d49ace3..e0b1d28504646f11578296674d0710fc917ec7b0 100644 (file)
       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
        {
index 6dd910d5816cff89412de7206cadd4d0590c4b97..23045ff18278b77841f03797b18f4597136b96d4 100644 (file)
@@ -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)