[Mesa-dev] [PATCH] glsl: Move error message inside validation check reducing duplicate message handling

Timothy Arceri t_arceri at yahoo.com.au
Sat Oct 26 09:47:16 CEST 2013


On Fri, 2013-10-25 at 14:51 -0700, Paul Berry wrote:


+   _mesa_glsl_error(&loc, state,
>         +                    is_initializer ? "initializer" : "value"
>         +                    " of type %s cannot be assigned to "
>         +                    "variable of type %s",
>         +                    rhs->type->name, lhs_type->name);
>         +
>         
> 
> This doesn't produce the output you want.  String concatenation happens at compile time and takes precedence over everything else, so this is being interpreted as:
> 
> 
> _mesa_glsl_error(&loc, state, is_initializer ? "initializer" : "value of type %s cannot be assigned to variable of type %s", rhs->type->name, lhs_type->name);
> 
> 
> Adding parenthesis doesn't help because string concatenation only works on string literals.  I believe what you actually want is:
> 
>    _mesa_glsl_error(&loc, state,
>                     "%s of type %s cannot be assigned to "
>                     "variable of type %s",
>                     is_initializer ? "initializer" : "value",
>                     rhs->type->name, lhs_type->name);
> 

Yes that makes sense thanks. 

>With that change, this patch is:
> 
> 
> Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> 
> 
> Do you have push access?  I can push the patch for you (with this change) if you'd like. 
> 

No I don't have push access. Would be great if you could push this with the change.

Thanks for the review.

Tim


More information about the mesa-dev mailing list