summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-10-05 16:23:32 -0700
committerIan Romanick <[email protected]>2010-10-08 14:21:22 -0700
commit5ff4cfb788291ef7c8d6412d65aee708b41bac86 (patch)
treecba173efb19a8a0c96cdfe1d7baae9ee9799e351
parentfd2aa7d313b2546dc25f9f7810a0b3767ee679f9 (diff)
glsl: Clear type_qualifier using memset
-rw-r--r--src/glsl/glsl_parser.ypp105
1 files changed, 86 insertions, 19 deletions
diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp
index 649f4379af9..be763ed9f03 100644
--- a/src/glsl/glsl_parser.ypp
+++ b/src/glsl/glsl_parser.ypp
@@ -793,10 +793,25 @@ parameter_declaration:
;
parameter_qualifier:
- /* empty */ { $$.i = 0; }
- | IN_TOK { $$.i = 0; $$.q.in = 1; }
- | OUT_TOK { $$.i = 0; $$.q.out = 1; }
- | INOUT_TOK { $$.i = 0; $$.q.in = 1; $$.q.out = 1; }
+ /* empty */
+ {
+ memset(& $$, 0, sizeof($$));
+ }
+ | IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.in = 1;
+ }
+ | OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.out = 1;
+ }
+ | INOUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.in = 1; $$.q.out = 1;
+ }
;
parameter_type_specifier:
@@ -979,7 +994,7 @@ layout_qualifier_id:
{
bool got_one = false;
- $$.i = 0;
+ memset(& $$, 0, sizeof($$));
if (state->ARB_fragment_coord_conventions_enable) {
if (strcmp($1, "origin_upper_left") == 0) {
@@ -1007,13 +1022,29 @@ layout_qualifier_id:
;
interpolation_qualifier:
- SMOOTH { $$.i = 0; $$.q.smooth = 1; }
- | FLAT { $$.i = 0; $$.q.flat = 1; }
- | NOPERSPECTIVE { $$.i = 0; $$.q.noperspective = 1; }
+ SMOOTH
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.smooth = 1;
+ }
+ | FLAT
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.flat = 1;
+ }
+ | NOPERSPECTIVE
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.noperspective = 1;
+ }
;
parameter_type_qualifier:
- CONST_TOK { $$.i = 0; $$.q.constant = 1; }
+ CONST_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.constant = 1;
+ }
;
type_qualifier:
@@ -1040,21 +1071,57 @@ type_qualifier:
}
| INVARIANT
{
- $$.i = 0;
+ memset(& $$, 0, sizeof($$));
$$.q.invariant = 1;
}
;
storage_qualifier:
- CONST_TOK { $$.i = 0; $$.q.constant = 1; }
- | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; }
- | VARYING { $$.i = 0; $$.q.varying = 1; }
- | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; }
- | IN_TOK { $$.i = 0; $$.q.in = 1; }
- | OUT_TOK { $$.i = 0; $$.q.out = 1; }
- | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; }
- | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; }
- | UNIFORM { $$.i = 0; $$.q.uniform = 1; }
+ CONST_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.constant = 1;
+ }
+ | ATTRIBUTE
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.attribute = 1;
+ }
+ | VARYING
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.varying = 1;
+ }
+ | CENTROID VARYING
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.centroid = 1; $$.q.varying = 1;
+ }
+ | IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.in = 1;
+ }
+ | OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.out = 1;
+ }
+ | CENTROID IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.centroid = 1; $$.q.in = 1;
+ }
+ | CENTROID OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.centroid = 1; $$.q.out = 1;
+ }
+ | UNIFORM
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.q.uniform = 1;
+ }
;
type_specifier: