From: Dave Airlie Date: Tue, 13 Mar 2012 16:05:26 +0000 (+0000) Subject: glsl: fix compiling warning from gcc 4.7 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba3a4d79a7bad959c0d9efbe0daa8d73c281d664;p=mesa.git glsl: fix compiling warning from gcc 4.7 ir_validate.cpp: In member function ‘virtual ir_visitor_status ir_validate::visit_leave(ir_swizzle*)’: ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::x’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing] ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::y’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing] ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::z’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing] ir_validate.cpp:458:66: warning: narrowing conversion of ‘ir->ir_swizzle::mask.ir_swizzle_mask::w’ from ‘unsigned int’ to ‘int’ inside { } is ill-formed in C++11 [-Wnarrowing] Signed-off-by: Dave Airlie Reviewed-by: Brian Paul --- diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 20a0377d456..101d9992da2 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -455,7 +455,7 @@ ir_validate::visit_leave(ir_expression *ir) ir_visitor_status ir_validate::visit_leave(ir_swizzle *ir) { - int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w}; + unsigned int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w}; for (unsigned int i = 0; i < ir->type->vector_elements; i++) { if (chans[i] >= ir->val->type->vector_elements) {