History

Remove unused variables

Remove unused local variables and declare them conditionally when they are used only on some architectures.

Thomas Preud'homme committed 15 years ago

Commit ee06ef91 parent db9d5f04 files · +14 −8Browse files

Unified · Split

4 files
  1. tccasm.c +1 −2
  2. tccelf.c +6 −3
  3. tccgen.c +6 −1
  4. tccpp.c +1 −2
tccasm.c+1−2
@@ -991,7 +991,7 @@ ST_FUNC void asm_instr(void) · 990 unmodified lines
991991 {
992992 CString astr, astr1;
993993 ASMOperand operands[MAX_ASM_OPERANDS];
994− int nb_inputs, nb_outputs, nb_operands, i, must_subst, out_reg;
994+ int nb_outputs, nb_operands, i, must_subst, out_reg;
995995 uint8_t clobber_regs[NB_ASM_REGS];
996996
997997 next();
@@ -1040,7 +1040,6 @@ ST_FUNC void asm_instr(void) · 42 unmodified lines
10401040 token after the assembler parsing */
10411041 if (tok != ';')
10421042 expect("';'");
1043− nb_inputs = nb_operands - nb_outputs;
10441043
10451044 /* save all values in the memory */
10461045 save_regs(0);
tccelf.c+6−3
@@ -1033,7 +1033,7 @@ static void put_got_entry(TCCState *s1, · 1032 unmodified lines
10331033 /* build GOT and PLT entries */
10341034 ST_FUNC void build_got_entries(TCCState *s1)
10351035 {
1036− Section *s, *symtab;
1036+ Section *s;
10371037 ElfW_Rel *rel, *rel_end;
10381038 ElfW(Sym) *sym;
10391039 int i, type, reloc_type, sym_index;
@@ -1045,7 +1045,6 @@ ST_FUNC void build_got_entries(TCCState *s1) · 5 unmodified lines
10451045 /* no need to handle got relocations */
10461046 if (s->link != symtab_section)
10471047 continue;
1048− symtab = s->link;
10491048 rel_end = (ElfW_Rel *)(s->data + s->data_offset);
10501049 for(rel = (ElfW_Rel *)s->data;
10511050 rel < rel_end;
@@ -1456,7 +1455,9 @@ static int elf_output_file(TCCState *s1, const char *filename) · 404 unmodified lines
14561455 ElfW(Sym) *sym;
14571456 int type, file_type;
14581457 unsigned long rel_addr, rel_size;
1458+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
14591459 unsigned long bss_addr, bss_size;
1460+#endif
14601461
14611462 file_type = s1->output_type;
14621463 s1->nb_errors = 0;
@@ -1788,7 +1789,9 @@ static int elf_output_file(TCCState *s1, const char *filename) · 325 unmodified lines
17881789 rel_size = 0;
17891790 rel_addr = 0;
17901791
1791− bss_addr = bss_size = 0;
1792+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
1793+ bss_addr = bss_size = 0;
1794+#endif
17921795 /* leave one program header for the program interpreter */
17931796 ph = &phdr[0];
17941797 if (interp)
tccgen.c+6−1
@@ -647,7 +647,10 @@ static void gbound(void) · 646 unmodified lines
647647 register value (such as structures). */
648648 ST_FUNC int gv(int rc)
649649 {
650− int r, rc2, bit_pos, bit_size, size, align, i;
650+ int r, bit_pos, bit_size, size, align, i;
651+#ifndef TCC_TARGET_X86_64
652+ int rc2;
653+#endif
651654
652655 /* NOTE: get_reg can modify vstack[] */
653656 if (vtop->type.t & VT_BITFIELD) {
@@ -718,9 +721,11 @@ ST_FUNC int gv(int rc) · 64 unmodified lines
718721 #endif
719722
720723 r = vtop->r & VT_VALMASK;
724+#ifndef TCC_TARGET_X86_64
721725 rc2 = RC_INT;
722726 if (rc == RC_IRET)
723727 rc2 = RC_LRET;
728+#endif
724729 /* need to reload if:
725730 - constant
726731 - lvalue (need to dereference pointer)
tccpp.c+1−2
@@ -3011,7 +3011,6 @@ ST_FUNC void preprocess_new() · 3010 unmodified lines
30113011 {
30123012 int i, c;
30133013 const char *p, *r;
3014− TokenSym *ts;
30153014
30163015 /* init isid table */
30173016 for(i=CH_EOF;i<256;i++)
@@ -3030,7 +3029,7 @@ ST_FUNC void preprocess_new() · 12 unmodified lines
30303029 if (c == '\0')
30313030 break;
30323031 }
3033− ts = tok_alloc(p, r - p - 1);
3032+ tok_alloc(p, r - p - 1);
30343033 p = r;
30353034 }
30363035 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t