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

Vinson Lee vlee at kemper.freedesktop.org
Wed Sep 29 21:14:58 UTC 2010


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

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

r300/compiler: Move declaration before code.

Fixes these GCC warnings on linux-x86 build.
r500_fragprog_emit.c: In function ‘emit_paired’:
r500_fragprog_emit.c:237: warning: ISO C90 forbids mixed declarations and code
r500_fragprog_emit.c: In function ‘emit_tex’:
r500_fragprog_emit.c:367: warning: ISO C90 forbids mixed declarations and code
r500_fragprog_emit.c: In function ‘emit_flowcontrol’:
r500_fragprog_emit.c:415: warning: ISO C90 forbids mixed declarations and code
r500_fragprog_emit.c: In function ‘r500BuildFragmentProgramHwCode’:
r500_fragprog_emit.c:633: warning: ISO C90 forbids mixed declarations and code

---

 .../drivers/dri/r300/compiler/r500_fragprog_emit.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index 407d925..6f101c6 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -227,6 +227,7 @@ static void alu_nop(struct r300_fragment_program_compiler *c, int ip)
  */
 static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst)
 {
+	int ip;
 	PROG_CODE;
 
 	if (code->inst_end >= c->Base.max_alu_insts-1) {
@@ -234,7 +235,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
 		return;
 	}
 
-	int ip = ++code->inst_end;
+	ip = ++code->inst_end;
 
 	/* Quirk: MDH/MDV (DDX/DDY) need a NOP on previous non-TEX instructions. */
 	if (inst->RGB.Opcode == RC_OPCODE_DDX || inst->Alpha.Opcode == RC_OPCODE_DDX ||
@@ -357,6 +358,7 @@ static unsigned int translate_strq_swizzle(unsigned int swizzle)
  */
 static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_instruction *inst)
 {
+	int ip;
 	PROG_CODE;
 
 	if (code->inst_end >= c->Base.max_alu_insts-1) {
@@ -364,7 +366,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst
 		return 0;
 	}
 
-	int ip = ++code->inst_end;
+	ip = ++code->inst_end;
 
 	code->inst[ip].inst0 = R500_INST_TYPE_TEX
 		| (inst->DstReg.WriteMask << 11)
@@ -407,12 +409,14 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst
 
 static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst)
 {
+	unsigned int newip;
+
 	if (s->Code->inst_end >= s->C->max_alu_insts-1) {
 		rc_error(s->C, "emit_tex: Too many instructions");
 		return;
 	}
 
-	unsigned int newip = ++s->Code->inst_end;
+	newip = ++s->Code->inst_end;
 
 	/* Currently all loops use the same integer constant to intialize
 	 * the loop variables. */
@@ -623,6 +627,8 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user)
 
 	if (code->inst_end == -1 ||
 	    (code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
+		int ip;
+
 		/* This may happen when dead-code elimination is disabled or
 		 * when most of the fragment program logic is leading to a KIL */
 		if (code->inst_end >= compiler->Base.max_alu_insts-1) {
@@ -630,7 +636,7 @@ void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user)
 			return;
 		}
 
-		int ip = ++code->inst_end;
+		ip = ++code->inst_end;
 		code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT;
 	}
 




More information about the mesa-commit mailing list