[Mesa-dev] [PATCH] mesa/tnl_dd: Fix clang constant-logical-operand warnings.

Brian Paul brianp at vmware.com
Wed Jun 4 17:48:19 PDT 2014


Reviewed-by: Brian Paul <brianp at vmware.com>

But I think you could trim down the commit message to give just one example.


On 06/04/2014 04:48 PM, Vinson Lee wrote:
> This patch fixes these clang constant-logical-operand warnings.
>
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:130:32: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
>     if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
>                                 ^  ~~~~~~~~~~~
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:130:32: note: use '|' for a bitwise operation
>     if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
>                                 ^~
>                                 |
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:138:22: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
>        if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
>                       ^  ~~~~~~~~~~~
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:138:22: note: use '|' for a bitwise operation
>        if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
>                       ^~
>                       |
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:355:32: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
>     if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
>                                 ^  ~~~~~~~~~~~
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:355:32: note: use '|' for a bitwise operation
>     if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
>                                 ^~
>                                 |
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:363:22: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
>        if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
>                       ^  ~~~~~~~~~~~
> ../../../../../src/mesa/tnl_dd/t_dd_tritmp.h:363:22: note: use '|' for a bitwise operation
>        if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
>                       ^~
>                       |
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   src/mesa/tnl_dd/t_dd_tritmp.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
> index c1eb2de..8eccfca 100644
> --- a/src/mesa/tnl_dd/t_dd_tritmp.h
> +++ b/src/mesa/tnl_dd/t_dd_tritmp.h
> @@ -127,7 +127,7 @@ static void TAG(triangle)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint
>      v[1] = (VERTEX *)GET_VERTEX(e1);
>      v[2] = (VERTEX *)GET_VERTEX(e2);
>
> -   if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
> +   if (DO_TWOSIDE | DO_OFFSET | DO_UNFILLED | DO_TWOSTENCIL)
>      {
>         GLfloat ex = VERT_X(v[0]) - VERT_X(v[2]);
>         GLfloat ey = VERT_Y(v[0]) - VERT_Y(v[2]);
> @@ -135,7 +135,7 @@ static void TAG(triangle)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint
>         GLfloat fy = VERT_Y(v[1]) - VERT_Y(v[2]);
>         GLfloat cc = ex*fy - ey*fx;
>
> -      if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
> +      if (DO_TWOSIDE | DO_UNFILLED | DO_TWOSTENCIL)
>         {
>   	 facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
>
> @@ -352,7 +352,7 @@ static void TAG(quadr)( struct gl_context *ctx,
>      v[2] = (VERTEX *)GET_VERTEX(e2);
>      v[3] = (VERTEX *)GET_VERTEX(e3);
>
> -   if (DO_TWOSIDE || DO_OFFSET || DO_UNFILLED || DO_TWOSTENCIL)
> +   if (DO_TWOSIDE | DO_OFFSET | DO_UNFILLED | DO_TWOSTENCIL)
>      {
>         GLfloat ex = VERT_X(v[2]) - VERT_X(v[0]);
>         GLfloat ey = VERT_Y(v[2]) - VERT_Y(v[0]);
> @@ -360,7 +360,7 @@ static void TAG(quadr)( struct gl_context *ctx,
>         GLfloat fy = VERT_Y(v[3]) - VERT_Y(v[1]);
>         GLfloat cc = ex*fy - ey*fx;
>
> -      if (DO_TWOSIDE || DO_UNFILLED || DO_TWOSTENCIL)
> +      if (DO_TWOSIDE | DO_UNFILLED | DO_TWOSTENCIL)
>         {
>   	 facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
>
>



More information about the mesa-dev mailing list