[Mesa-stable] [PATCH] glsl: ignore trailing whitespace when define redefined

Juan A. Suarez Romero jasuarez at igalia.com
Thu Oct 11 06:58:16 UTC 2018


On Thu, 2018-10-11 at 08:26 +1100, Timothy Arceri wrote:
> On 11/10/18 2:47 am, Juan A. Suarez Romero wrote:
> > On Wed, 2018-10-10 at 11:03 +1100, Timothy Arceri wrote:
> > > The Nvidia/AMD binary drivers allow this, as does GCC.
> > > 
> > > This fixes shader compilation issues in the latest update of
> > > No Mans Sky.
> > > 
> > > Cc: mesa-stable at lists.freedesktop.org
> > 
> > 
> > This patch landed in upstream without the CC: mesa-stable.
> > 
> > I guess this was done on purpose, and that the patch is not intended to be
> > applied in 18.2. So I'll ignore it. If not, please, let me know.
> 
> In the past I've been told to remove the tags when committing. I'd like 
> this to be applied to stable. I'll leave the tags there next time. Thanks.
> 

Yeah, just remove the tag only if you decide the patch is not worth to be in
stable. Otherwise, keep it.


Added to the 18.2 queue. Thanks.


> > 
> > Thanks.
> > 
> > 	J.A.
> > 
> > 
> > > ---
> > >   src/compiler/glsl/glcpp/glcpp-parse.y              | 14 ++++++++++++++
> > >   .../glsl/glcpp/tests/122-redefine-whitespace.c     |  4 ++++
> > >   .../glcpp/tests/122-redefine-whitespace.c.expected | 10 +++++++---
> > >   3 files changed, 25 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
> > > index 4be5cfa3d54..1c095cb66f9 100644
> > > --- a/src/compiler/glsl/glcpp/glcpp-parse.y
> > > +++ b/src/compiler/glsl/glcpp/glcpp-parse.y
> > > @@ -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;
> > >   
> > > diff --git a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c
> > > index ae7ea09f67e..2b084e0960a 100644
> > > --- a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c
> > > +++ b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c
> > > @@ -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)
> > > diff --git a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected
> > > index 602bdef94c2..766849e34a9 100644
> > > --- a/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected
> > > +++ b/src/compiler/glsl/glcpp/tests/122-redefine-whitespace.c.expected
> > > @@ -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 @@
> > >    
> > >   
> > >   
> > > +
> > > +
> > > +
> > >   
> > >   
> 
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-stable



More information about the mesa-stable mailing list