aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/glcpp/glcpp-parse.y
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-12 20:34:04 +0000
committermarha <marha@users.sourceforge.net>2011-01-12 20:34:04 +0000
commit2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85 (patch)
tree276bf91b61421f0043fc8ac00a13af467ecc10f2 /mesalib/src/glsl/glcpp/glcpp-parse.y
parent4613071e75e4828ce69ac1f17d73b0b7b6275578 (diff)
downloadvcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.tar.gz
vcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.tar.bz2
vcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.zip
xkeyboard-config libX11 mesalib git update 12 jan 2011
Diffstat (limited to 'mesalib/src/glsl/glcpp/glcpp-parse.y')
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y28
1 files changed, 27 insertions, 1 deletions
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index e88e48057..5ece8b3bb 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -398,7 +398,12 @@ expression:
$$ = $1 % $3;
}
| expression '/' expression {
- $$ = $1 / $3;
+ if ($3 == 0) {
+ yyerror (& @1, parser,
+ "division by 0 in preprocessor directive");
+ } else {
+ $$ = $1 / $3;
+ }
}
| expression '*' expression {
$$ = $1 * $3;
@@ -825,10 +830,31 @@ _token_list_trim_trailing_space (token_list_t *list)
}
int
+_token_list_is_empty_ignoring_space (token_list_t *l)
+{
+ token_node_t *n;
+
+ if (l == NULL)
+ return 1;
+
+ n = l->head;
+ while (n != NULL && n->token->type == SPACE)
+ n = n->next;
+
+ return n == NULL;
+}
+
+int
_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
{
token_node_t *node_a, *node_b;
+ if (a == NULL || b == NULL) {
+ int a_empty = _token_list_is_empty_ignoring_space(a);
+ int b_empty = _token_list_is_empty_ignoring_space(b);
+ return a_empty == b_empty;
+ }
+
node_a = a->head;
node_b = b->head;