glsl/glcpp: Fix preprocessor error condition for macro redefinition
authorAnuj Phogat <anuj.phogat@gmail.com>
Fri, 6 Jun 2014 23:56:59 +0000 (16:56 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 9 Jul 2014 19:05:13 +0000 (12:05 -0700)
commita6e9cd14cad555520ad98213adf541a7687a7498
treec65ecb070b0d7d6cbc364882134ecf3d55206925
parent1a46dd6edd6a50624fd5cc876bc22dce99bd9326
glsl/glcpp: Fix preprocessor error condition for macro redefinition

This patch specifically fixes redefinition condition for white space
changes. #define and #undef functionality in GLSL follows the standard
for C++ preprocessors for macro definitions.

From https://gcc.gnu.org/onlinedocs/cpp/Undefining-and-Redefining-Macros.html:

These definitions are effectively the same:

     #define FOUR (2 + 2)
     #define FOUR         (2    +    2)
     #define FOUR (2 /* two */ + 2)

but these are not:

     #define FOUR (2 + 2)
     #define FOUR ( 2+2 )
     #define FOUR (2 * 2)
     #define FOUR(score,and,seven,years,ago) (2 + 2)

Fixes Khronos GLES3 CTS tests;
invalid_object_whitespace_vertex
invalid_object_whitespace_fragment

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
src/glsl/glcpp/glcpp-parse.y