[iortcw] 58/89: All: Fix set-but-not-used variable warnings in vm_armv7l.c

Simon McVittie smcv at debian.org
Fri Sep 8 10:44:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51b
in repository iortcw.

commit f7c20822d45080036b88bda9b1f5d7a36e1d2705
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Thu Jul 20 11:24:59 2017 -0400

    All: Fix set-but-not-used variable warnings in vm_armv7l.c
---
 MP/code/qcommon/vm_armv7l.c | 28 ++++++++++++++++++++--------
 SP/code/qcommon/vm_armv7l.c | 28 ++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/MP/code/qcommon/vm_armv7l.c b/MP/code/qcommon/vm_armv7l.c
index dd63f5c..8f2bd8c 100644
--- a/MP/code/qcommon/vm_armv7l.c
+++ b/MP/code/qcommon/vm_armv7l.c
@@ -599,11 +599,11 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 	unsigned char *code;
 	int i_count, pc = 0;
 	int pass;
-	int codeoffsets[1024];
+	int codeoffsets[2]; // was 1024 but it's only used for OFF_CODE and OFF_IMMEDIATES
 
 #define j_rel(x) (pass?_j_rel(x, pc):0xBAD)
 #define OFFSET(i) (pass?(j_rel(codeoffsets[i]-vm->codeLength)):(0xF000000F))
-#define new_offset() (offsidx++)
+//#define new_offset() (offsidx++)
 #define get_offset(i) (codeoffsets[i])
 #define save_offset(i) (codeoffsets[i] = vm->codeLength)
 #define OFF_CODE 0
@@ -616,10 +616,12 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 
 	for (pass = 0; pass < 2; ++pass) {
 
-	int offsidx = 0;
+//	int offsidx = 0;
 
+#ifdef CONST_OPTIMIZE
 	// const optimization
 	unsigned got_const = 0, const_value = 0;
+#endif
 
 	if(pass)
 	{
@@ -656,7 +658,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 	emit(BKPT(0));
 
 	save_offset(OFF_CODE);
-	offsidx = OFF_IMMEDIATES+1;
+//	offsidx = OFF_IMMEDIATES+1;
 
 	code = (unsigned char *) header + header->codeOffset;
 	pc = 0;
@@ -744,9 +746,14 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 				emit_MOVR0i(i_count);
 				emit(STRa(R0, rDATABASE, rPSTACK));      // dataBase[pstack] = r0
 #endif
-				if (got_const) {
+#ifdef CONST_OPTIMIZE
+				if (got_const)
+				{
 					NOTIMPL(op);
-				} else {
+				}
+				else
+#endif
+				{
 					static int bytes_to_skip = -1;
 					static unsigned start_block = -1;
 					MAYBE_EMIT_CONST();
@@ -803,9 +810,14 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 				break;
 
 			case OP_JUMP:
-				if(got_const) {
+#ifdef CONST_OPTIMIZE
+				if (got_const)
+				{
 					NOTIMPL(op);
-				} else {
+				}
+				else
+#endif
+				{
 					emit(LDRTxi(R0, rOPSTACK, 4));  // r0 = *opstack; rOPSTACK -= 4
 					CHECK_JUMP;
 					emit_MOVRxi(R1, (unsigned)vm->instructionPointers);
diff --git a/SP/code/qcommon/vm_armv7l.c b/SP/code/qcommon/vm_armv7l.c
index dd63f5c..8f2bd8c 100644
--- a/SP/code/qcommon/vm_armv7l.c
+++ b/SP/code/qcommon/vm_armv7l.c
@@ -599,11 +599,11 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 	unsigned char *code;
 	int i_count, pc = 0;
 	int pass;
-	int codeoffsets[1024];
+	int codeoffsets[2]; // was 1024 but it's only used for OFF_CODE and OFF_IMMEDIATES
 
 #define j_rel(x) (pass?_j_rel(x, pc):0xBAD)
 #define OFFSET(i) (pass?(j_rel(codeoffsets[i]-vm->codeLength)):(0xF000000F))
-#define new_offset() (offsidx++)
+//#define new_offset() (offsidx++)
 #define get_offset(i) (codeoffsets[i])
 #define save_offset(i) (codeoffsets[i] = vm->codeLength)
 #define OFF_CODE 0
@@ -616,10 +616,12 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 
 	for (pass = 0; pass < 2; ++pass) {
 
-	int offsidx = 0;
+//	int offsidx = 0;
 
+#ifdef CONST_OPTIMIZE
 	// const optimization
 	unsigned got_const = 0, const_value = 0;
+#endif
 
 	if(pass)
 	{
@@ -656,7 +658,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 	emit(BKPT(0));
 
 	save_offset(OFF_CODE);
-	offsidx = OFF_IMMEDIATES+1;
+//	offsidx = OFF_IMMEDIATES+1;
 
 	code = (unsigned char *) header + header->codeOffset;
 	pc = 0;
@@ -744,9 +746,14 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 				emit_MOVR0i(i_count);
 				emit(STRa(R0, rDATABASE, rPSTACK));      // dataBase[pstack] = r0
 #endif
-				if (got_const) {
+#ifdef CONST_OPTIMIZE
+				if (got_const)
+				{
 					NOTIMPL(op);
-				} else {
+				}
+				else
+#endif
+				{
 					static int bytes_to_skip = -1;
 					static unsigned start_block = -1;
 					MAYBE_EMIT_CONST();
@@ -803,9 +810,14 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
 				break;
 
 			case OP_JUMP:
-				if(got_const) {
+#ifdef CONST_OPTIMIZE
+				if (got_const)
+				{
 					NOTIMPL(op);
-				} else {
+				}
+				else
+#endif
+				{
 					emit(LDRTxi(R0, rOPSTACK, 4));  // r0 = *opstack; rOPSTACK -= 4
 					CHECK_JUMP;
 					emit_MOVRxi(R1, (unsigned)vm->instructionPointers);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list