From ba3a4d79a7bad959c0d9efbe0daa8d73c281d664 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 13 Mar 2012 16:05:26 +0000 Subject: [PATCH] glsl: fix compiling warning from gcc 4.7 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/glsl/ir_validate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.30.2