From 2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 12 Jan 2011 20:34:04 +0000 Subject: xkeyboard-config libX11 mesalib git update 12 jan 2011 --- mesalib/src/glsl/glcpp/glcpp-parse.y | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'mesalib/src/glsl/glcpp/glcpp-parse.y') 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; @@ -824,11 +829,32 @@ _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; -- cgit v1.2.3