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

Vinson Lee vlee at kemper.freedesktop.org
Wed Sep 29 18:42:08 UTC 2010


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

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Sep 29 11:41:14 2010 -0700

r300/compiler: Move declaration before code.

Fixes these GCC warnings on linux-x86 build.
radeon_pair_translate.c: In function ‘set_pair_instruction’:
radeon_pair_translate.c:153: warning: ISO C90 forbids mixed declarations and code
radeon_pair_translate.c:170: warning: ISO C90 forbids mixed declarations and code
radeon_pair_translate.c: In function ‘rc_pair_translate’:
radeon_pair_translate.c:336: warning: ISO C90 forbids mixed declarations and code
radeon_pair_translate.c:341: warning: ISO C90 forbids mixed declarations and code

---

 .../dri/r300/compiler/radeon_pair_translate.c      |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
index ff82584..c549be5 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
@@ -148,9 +148,12 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
 	struct rc_pair_instruction * pair,
 	struct rc_sub_instruction * inst)
 {
+	int needrgb, needalpha, istranscendent;
+	const struct rc_opcode_info * opcode;
+	int i;
+
 	memset(pair, 0, sizeof(struct rc_pair_instruction));
 
-	int needrgb, needalpha, istranscendent;
 	classify_instruction(inst, &needrgb, &needalpha, &istranscendent);
 
 	if (needrgb) {
@@ -167,8 +170,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
 			pair->Alpha.Saturate = 1;
 	}
 
-	const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
-	int i;
+	opcode = rc_get_opcode_info(inst->Opcode);
 
 	/* Presubtract handling:
 	 * We need to make sure that the values used by the presubtract
@@ -330,15 +332,18 @@ void rc_pair_translate(struct radeon_compiler *cc, void *user)
 	for(struct rc_instruction * inst = c->Base.Program.Instructions.Next;
 	    inst != &c->Base.Program.Instructions;
 	    inst = inst->Next) {
+		const struct rc_opcode_info * opcode;
+		struct rc_sub_instruction copy;
+
 		if (inst->Type != RC_INSTRUCTION_NORMAL)
 			continue;
 
-		const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
+		opcode = rc_get_opcode_info(inst->U.I.Opcode);
 
 		if (opcode->HasTexture || opcode->IsFlowControl || opcode->Opcode == RC_OPCODE_KIL)
 			continue;
 
-		struct rc_sub_instruction copy = inst->U.I;
+		copy = inst->U.I;
 
 		check_opcode_support(c, &copy);
 




More information about the mesa-commit mailing list