Remove unused local variables and declare them conditionally when they are used only on some architectures.
Unified · Split
| @@ -991,7 +991,7 @@ ST_FUNC void asm_instr(void) · 990 unmodified lines | ||
| 991 | 991 | { |
| 992 | 992 | CString astr, astr1; |
| 993 | 993 | 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; | |
| 995 | 995 | uint8_t clobber_regs[NB_ASM_REGS]; |
| 996 | 996 | |
| 997 | 997 | next(); |
| @@ -1040,7 +1040,6 @@ ST_FUNC void asm_instr(void) · 42 unmodified lines | ||
| 1040 | 1040 | token after the assembler parsing */ |
| 1041 | 1041 | if (tok != ';') |
| 1042 | 1042 | expect("';'"); |
| 1043 | − nb_inputs = nb_operands - nb_outputs; | |
| 1044 | 1043 | |
| 1045 | 1044 | /* save all values in the memory */ |
| 1046 | 1045 | save_regs(0); |
| @@ -1033,7 +1033,7 @@ static void put_got_entry(TCCState *s1, · 1032 unmodified lines | ||
| 1033 | 1033 | /* build GOT and PLT entries */ |
| 1034 | 1034 | ST_FUNC void build_got_entries(TCCState *s1) |
| 1035 | 1035 | { |
| 1036 | − Section *s, *symtab; | |
| 1036 | + Section *s; | |
| 1037 | 1037 | ElfW_Rel *rel, *rel_end; |
| 1038 | 1038 | ElfW(Sym) *sym; |
| 1039 | 1039 | int i, type, reloc_type, sym_index; |
| @@ -1045,7 +1045,6 @@ ST_FUNC void build_got_entries(TCCState *s1) · 5 unmodified lines | ||
| 1045 | 1045 | /* no need to handle got relocations */ |
| 1046 | 1046 | if (s->link != symtab_section) |
| 1047 | 1047 | continue; |
| 1048 | − symtab = s->link; | |
| 1049 | 1048 | rel_end = (ElfW_Rel *)(s->data + s->data_offset); |
| 1050 | 1049 | for(rel = (ElfW_Rel *)s->data; |
| 1051 | 1050 | rel < rel_end; |
| @@ -1456,7 +1455,9 @@ static int elf_output_file(TCCState *s1, const char *filename) · 404 unmodified lines | ||
| 1456 | 1455 | ElfW(Sym) *sym; |
| 1457 | 1456 | int type, file_type; |
| 1458 | 1457 | unsigned long rel_addr, rel_size; |
| 1458 | +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | |
| 1459 | 1459 | unsigned long bss_addr, bss_size; |
| 1460 | +#endif | |
| 1460 | 1461 | |
| 1461 | 1462 | file_type = s1->output_type; |
| 1462 | 1463 | s1->nb_errors = 0; |
| @@ -1788,7 +1789,9 @@ static int elf_output_file(TCCState *s1, const char *filename) · 325 unmodified lines | ||
| 1788 | 1789 | rel_size = 0; |
| 1789 | 1790 | rel_addr = 0; |
| 1790 | 1791 | |
| 1791 | − bss_addr = bss_size = 0; | |
| 1792 | +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | |
| 1793 | + bss_addr = bss_size = 0; | |
| 1794 | +#endif | |
| 1792 | 1795 | /* leave one program header for the program interpreter */ |
| 1793 | 1796 | ph = &phdr[0]; |
| 1794 | 1797 | if (interp) |
| @@ -647,7 +647,10 @@ static void gbound(void) · 646 unmodified lines | ||
| 647 | 647 | register value (such as structures). */ |
| 648 | 648 | ST_FUNC int gv(int rc) |
| 649 | 649 | { |
| 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 | |
| 651 | 654 | |
| 652 | 655 | /* NOTE: get_reg can modify vstack[] */ |
| 653 | 656 | if (vtop->type.t & VT_BITFIELD) { |
| @@ -718,9 +721,11 @@ ST_FUNC int gv(int rc) · 64 unmodified lines | ||
| 718 | 721 | #endif |
| 719 | 722 | |
| 720 | 723 | r = vtop->r & VT_VALMASK; |
| 724 | +#ifndef TCC_TARGET_X86_64 | |
| 721 | 725 | rc2 = RC_INT; |
| 722 | 726 | if (rc == RC_IRET) |
| 723 | 727 | rc2 = RC_LRET; |
| 728 | +#endif | |
| 724 | 729 | /* need to reload if: |
| 725 | 730 | - constant |
| 726 | 731 | - lvalue (need to dereference pointer) |
| @@ -3011,7 +3011,6 @@ ST_FUNC void preprocess_new() · 3010 unmodified lines | ||
| 3011 | 3011 | { |
| 3012 | 3012 | int i, c; |
| 3013 | 3013 | const char *p, *r; |
| 3014 | − TokenSym *ts; | |
| 3015 | 3014 | |
| 3016 | 3015 | /* init isid table */ |
| 3017 | 3016 | for(i=CH_EOF;i<256;i++) |
| @@ -3030,7 +3029,7 @@ ST_FUNC void preprocess_new() · 12 unmodified lines | ||
| 3030 | 3029 | if (c == '\0') |
| 3031 | 3030 | break; |
| 3032 | 3031 | } |
| 3033 | − ts = tok_alloc(p, r - p - 1); | |
| 3032 | + tok_alloc(p, r - p - 1); | |
| 3034 | 3033 | p = r; |
| 3035 | 3034 | } |
| 3036 | 3035 | } |