mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-17 22:10:21 +01:00
glsl: ignore trailing whitespace when define redefined
The Nvidia/AMD binary drivers allow this, as does GCC.
This fixes shader compilation issues in the latest update of
No Mans Sky.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 0346ad3774)
This commit is contained in:
parent
9282afbca4
commit
bf21df1bb5
3 changed files with 25 additions and 3 deletions
|
|
@ -1074,6 +1074,20 @@ _token_list_equal_ignoring_space(token_list_t *a, token_list_t *b)
|
|||
|
||||
while (1)
|
||||
{
|
||||
if (node_a == NULL && node_b == NULL)
|
||||
break;
|
||||
|
||||
/* Ignore trailing whitespace */
|
||||
if (node_a == NULL && node_b->token->type == SPACE) {
|
||||
while (node_b && node_b->token->type == SPACE)
|
||||
node_b = node_b->next;
|
||||
}
|
||||
|
||||
if (node_b == NULL && node_a->token->type == SPACE) {
|
||||
while (node_a && node_a->token->type == SPACE)
|
||||
node_a = node_a->next;
|
||||
}
|
||||
|
||||
if (node_a == NULL && node_b == NULL)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define TWO ( 1+1 )
|
||||
#define FOUR (2 + 2)
|
||||
#define SIX (3 + 3)
|
||||
#define EIGHT (8 + 8)
|
||||
|
||||
/* Redefinitions with whitespace in same places, but different amounts, (so no
|
||||
* error). */
|
||||
|
|
@ -9,6 +10,9 @@
|
|||
#define FOUR (2 + 2)
|
||||
#define SIX (3/*comment is whitespace*/+ /* collapsed */ /* to */ /* one */ /* space */ 3)
|
||||
|
||||
/* Trailing whitespace (no error) */
|
||||
#define EIGHT (8 + 8)
|
||||
|
||||
/* Redefinitions with whitespace in different places. Each of these should
|
||||
* trigger an error. */
|
||||
#define TWO (1 + 1)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
0:14(9): preprocessor error: Redefinition of macro TWO
|
||||
0:18(9): preprocessor error: Redefinition of macro TWO
|
||||
|
||||
0:15(9): preprocessor error: Redefinition of macro FOUR
|
||||
0:19(9): preprocessor error: Redefinition of macro FOUR
|
||||
|
||||
0:16(9): preprocessor error: Redefinition of macro SIX
|
||||
0:20(9): preprocessor error: Redefinition of macro SIX
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -18,5 +19,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue