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

Vinson Lee vlee at kemper.freedesktop.org
Wed Sep 29 20:31:30 UTC 2010


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

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

r300/compiler: Move declaration before code.

Fixes these GCC warning on linux-x86 build.
radeon_optimize.c: In function ‘constant_folding’:
radeon_optimize.c:419: warning: ISO C90 forbids mixed declarations and code
radeon_optimize.c:425: warning: ISO C90 forbids mixed declarations and code
radeon_optimize.c:432: warning: ISO C90 forbids mixed declarations and code

---

 .../drivers/dri/r300/compiler/radeon_optimize.c    |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
index 3be50b9..41769e3 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -411,27 +411,34 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction *
 
 	/* Replace 0.0, 1.0 and 0.5 immediates by their explicit swizzles */
 	for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
+		struct rc_constant * constant;
+		struct rc_src_register newsrc;
+		int have_real_reference;
+
 		if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT ||
 		    inst->U.I.SrcReg[src].RelAddr ||
 		    inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count)
 			continue;
 
-		struct rc_constant * constant =
+		constant =
 			&c->Program.Constants.Constants[inst->U.I.SrcReg[src].Index];
 
 		if (constant->Type != RC_CONSTANT_IMMEDIATE)
 			continue;
 
-		struct rc_src_register newsrc = inst->U.I.SrcReg[src];
-		int have_real_reference = 0;
+		newsrc = inst->U.I.SrcReg[src];
+		have_real_reference = 0;
 		for(unsigned int chan = 0; chan < 4; ++chan) {
 			unsigned int swz = GET_SWZ(newsrc.Swizzle, chan);
+			unsigned int newswz;
+			float imm;
+			float baseimm;
+
 			if (swz >= 4)
 				continue;
 
-			unsigned int newswz;
-			float imm = constant->u.Immediate[swz];
-			float baseimm = imm;
+			imm = constant->u.Immediate[swz];
+			baseimm = imm;
 			if (imm < 0.0)
 				baseimm = -baseimm;
 




More information about the mesa-commit mailing list