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

Matt Turner mattst88 at gmail.com
Wed Jun 4 18:20:27 PDT 2014

On Wed, Jun 4, 2014 at 4:48 PM, Vinson Lee <vlee at freedesktop.org> 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]
>                                ^  ~~~~~~~~~~~

Sorry about the warnings, but I think the code is fine as is. These
are supposed to be constant operands. Look at how the macros are
defined and used:

#define IND (0)
#define TAG(x) x
#include "tnl_dd/t_dd_tritmp.h"

#define IND (R200_TWOSIDE_BIT)
#define TAG(x) x##_twoside
#include "tnl_dd/t_dd_tritmp.h"

If anything, you should modify the definition to something like

#define DO_TWOSIDE  ((IND & R200_TWOSIDE_BIT) != 0)

and hope clang doesn't complain, since they'll still be able to be
evaluated at compile time. Changing to bitwise operations isn't right.

More information about the mesa-dev mailing list