mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 19:50:12 +01:00
glcpp: Raise error when modulus is zero
For example, this now raises an error:
#define XXX 1 / 0
Fixes bug: https://bugs.freedesktop.org//show_bug.cgi?id=33507
Fixes Piglit test: spec/glsl-1.10/preprocessor/modulus-by-zero.vert
NOTE: This is a candidate for the 7.9 and 7.10 branches.
(cherry picked from commit fd1252ab67)
This commit is contained in:
parent
d72c16a0d3
commit
a068f7a2df
1 changed files with 6 additions and 1 deletions
|
|
@ -388,7 +388,12 @@ expression:
|
|||
$$ = $1 + $3;
|
||||
}
|
||||
| expression '%' expression {
|
||||
$$ = $1 % $3;
|
||||
if ($3 == 0) {
|
||||
yyerror (& @1, parser,
|
||||
"zero modulus in preprocessor directive");
|
||||
} else {
|
||||
$$ = $1 % $3;
|
||||
}
|
||||
}
|
||||
| expression '/' expression {
|
||||
if ($3 == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue