Mesa (master): r300/compiler: Remove declaration before code.

Vinson Lee vlee at kemper.freedesktop.org
Wed Sep 29 20:45:11 UTC 2010


Module: Mesa
Branch: master
Commit: b96a391d14bdfcb4a7183a0767a9b45440330034
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b96a391d14bdfcb4a7183a0767a9b45440330034

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Sep 29 13:44:10 2010 -0700

r300/compiler: Remove declaration before code.

Fixes these GCC warnings on linux-x86 build.
r300_fragprog_swizzle.c: In function ‘r300_swizzle_is_native’:
r300_fragprog_swizzle.c:120: warning: ISO C90 forbids mixed declarations and code
r300_fragprog_swizzle.c: In function ‘r300_swizzle_split’:
r300_fragprog_swizzle.c:159: warning: ISO C90 forbids mixed declarations and code

---

 .../dri/r300/compiler/r300_fragprog_swizzle.c      |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
index caa48fe..2d28b06 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
@@ -94,6 +94,9 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle)
  */
 static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
 {
+	unsigned int relevant;
+	int j;
+
 	if (reg.Abs)
 		reg.Negate = RC_MASK_NONE;
 
@@ -101,8 +104,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
 	    opcode == RC_OPCODE_TEX ||
 	    opcode == RC_OPCODE_TXB ||
 	    opcode == RC_OPCODE_TXP) {
-		int j;
-
 		if (reg.Abs || reg.Negate)
 			return 0;
 
@@ -117,8 +118,7 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
 		return 1;
 	}
 
-	unsigned int relevant = 0;
-	int j;
+	relevant = 0;
 
 	for(j = 0; j < 3; ++j)
 		if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED)
@@ -154,9 +154,10 @@ static void r300_swizzle_split(
 			unsigned int matchcount = 0;
 			unsigned int matchmask = 0;
 			for(comp = 0; comp < 3; ++comp) {
+				unsigned int swz;
 				if (!GET_BIT(mask, comp))
 					continue;
-				unsigned int swz = GET_SWZ(src.Swizzle, comp);
+				swz = GET_SWZ(src.Swizzle, comp);
 				if (swz == RC_SWIZZLE_UNUSED)
 					continue;
 				if (swz == GET_SWZ(sd->hash, comp)) {




More information about the mesa-commit mailing list