OSDN Git Service

Fix short-circuiting in preprocessor.
authorNicolas Capens <capn@google.com>
Fri, 1 Apr 2016 15:00:13 +0000 (11:00 -0400)
committerNicolas Capens <capn@google.com>
Fri, 1 Apr 2016 18:35:14 +0000 (18:35 +0000)
commitfcad1bfd651716353ea9e195ac6d9359f8c11d08
tree3171255c8c3dee53a4e17acef5c9d73e3aab6271
parent7bd3d3953acd883867522213c88907ff69195e3a
Fix short-circuiting in preprocessor.

The 2nd operand in a logical and ('&&') operation is evaluated if and only if
the 1st operand evaluates to non-zero. The 2nd operand in a logical or ('||')
operation is evaluated if and only if the 1st operand evaluates to zero.
If an operand is not evaluated, the presence of undefined identifiers in the
operand will not cause an error.

Integer overflow in short-circuited expressions are still and error because
it is part of lexical analysis.

Change-Id: I6ff5e0e9874551d2e40ab4e4ad34dc36cfa703e5
Reviewed-on: https://swiftshader-review.googlesource.com/5020
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/OpenGL/compiler/preprocessor/ExpressionParser.cpp
src/OpenGL/compiler/preprocessor/ExpressionParser.y