Remove unused variables

Remove unused local variables and declare them conditionally when they
are used only on some architectures.
This commit is contained in:
Thomas Preud'homme 2011-05-16 14:15:32 +02:00
parent db9d5f0fa4
commit ee06ef9dd3
4 changed files with 14 additions and 8 deletions

View File

@ -991,7 +991,7 @@ ST_FUNC void asm_instr(void)
{ {
CString astr, astr1; CString astr, astr1;
ASMOperand operands[MAX_ASM_OPERANDS]; ASMOperand operands[MAX_ASM_OPERANDS];
int nb_inputs, nb_outputs, nb_operands, i, must_subst, out_reg; int nb_outputs, nb_operands, i, must_subst, out_reg;
uint8_t clobber_regs[NB_ASM_REGS]; uint8_t clobber_regs[NB_ASM_REGS];
next(); next();
@ -1040,7 +1040,6 @@ ST_FUNC void asm_instr(void)
token after the assembler parsing */ token after the assembler parsing */
if (tok != ';') if (tok != ';')
expect("';'"); expect("';'");
nb_inputs = nb_operands - nb_outputs;
/* save all values in the memory */ /* save all values in the memory */
save_regs(0); save_regs(0);

View File

@ -1033,7 +1033,7 @@ static void put_got_entry(TCCState *s1,
/* build GOT and PLT entries */ /* build GOT and PLT entries */
ST_FUNC void build_got_entries(TCCState *s1) ST_FUNC void build_got_entries(TCCState *s1)
{ {
Section *s, *symtab; Section *s;
ElfW_Rel *rel, *rel_end; ElfW_Rel *rel, *rel_end;
ElfW(Sym) *sym; ElfW(Sym) *sym;
int i, type, reloc_type, sym_index; int i, type, reloc_type, sym_index;
@ -1045,7 +1045,6 @@ ST_FUNC void build_got_entries(TCCState *s1)
/* no need to handle got relocations */ /* no need to handle got relocations */
if (s->link != symtab_section) if (s->link != symtab_section)
continue; continue;
symtab = s->link;
rel_end = (ElfW_Rel *)(s->data + s->data_offset); rel_end = (ElfW_Rel *)(s->data + s->data_offset);
for(rel = (ElfW_Rel *)s->data; for(rel = (ElfW_Rel *)s->data;
rel < rel_end; rel < rel_end;
@ -1456,7 +1455,9 @@ static int elf_output_file(TCCState *s1, const char *filename)
ElfW(Sym) *sym; ElfW(Sym) *sym;
int type, file_type; int type, file_type;
unsigned long rel_addr, rel_size; unsigned long rel_addr, rel_size;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
unsigned long bss_addr, bss_size; unsigned long bss_addr, bss_size;
#endif
file_type = s1->output_type; file_type = s1->output_type;
s1->nb_errors = 0; s1->nb_errors = 0;
@ -1788,7 +1789,9 @@ static int elf_output_file(TCCState *s1, const char *filename)
rel_size = 0; rel_size = 0;
rel_addr = 0; rel_addr = 0;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
bss_addr = bss_size = 0; bss_addr = bss_size = 0;
#endif
/* leave one program header for the program interpreter */ /* leave one program header for the program interpreter */
ph = &phdr[0]; ph = &phdr[0];
if (interp) if (interp)

View File

@ -647,7 +647,10 @@ static void gbound(void)
register value (such as structures). */ register value (such as structures). */
ST_FUNC int gv(int rc) ST_FUNC int gv(int rc)
{ {
int r, rc2, bit_pos, bit_size, size, align, i; int r, bit_pos, bit_size, size, align, i;
#ifndef TCC_TARGET_X86_64
int rc2;
#endif
/* NOTE: get_reg can modify vstack[] */ /* NOTE: get_reg can modify vstack[] */
if (vtop->type.t & VT_BITFIELD) { if (vtop->type.t & VT_BITFIELD) {
@ -718,9 +721,11 @@ ST_FUNC int gv(int rc)
#endif #endif
r = vtop->r & VT_VALMASK; r = vtop->r & VT_VALMASK;
#ifndef TCC_TARGET_X86_64
rc2 = RC_INT; rc2 = RC_INT;
if (rc == RC_IRET) if (rc == RC_IRET)
rc2 = RC_LRET; rc2 = RC_LRET;
#endif
/* need to reload if: /* need to reload if:
- constant - constant
- lvalue (need to dereference pointer) - lvalue (need to dereference pointer)

View File

@ -3011,7 +3011,6 @@ ST_FUNC void preprocess_new()
{ {
int i, c; int i, c;
const char *p, *r; const char *p, *r;
TokenSym *ts;
/* init isid table */ /* init isid table */
for(i=CH_EOF;i<256;i++) for(i=CH_EOF;i<256;i++)
@ -3030,7 +3029,7 @@ ST_FUNC void preprocess_new()
if (c == '\0') if (c == '\0')
break; break;
} }
ts = tok_alloc(p, r - p - 1); tok_alloc(p, r - p - 1);
p = r; p = r;
} }
} }