rusty@GARNET.BERKELEY.EDU (12/08/89)
Here are patches for fixing unused variables and functions. I did this last night when I woke up and couldn't get back to sleep; I just compiled gcc on a sparcstation with gcc -Wunused and then eyeballed the warnings and fixed the code as necessary. This is simple (although tedious) enough that it seems to me that this ought to be done before each release of gcc. diff -r -c gcc-1.36-old/c-parse.y gcc-1.36/c-parse.y *** gcc-1.36-old/c-parse.y Tue Sep 19 22:11:01 1989 --- gcc-1.36/c-parse.y Thu Dec 7 04:21:03 1989 *************** *** 1782,1788 **** --- 1782,1790 ---- && getc (finput) == 't' && ((c = getc (finput)) == ' ' || c == '\t')) { + #ifdef ASM_OUTPUT_IDENT extern FILE *asm_out_file; + #endif if (pedantic) error ("ANSI C does not allow #ident"); diff -r -c gcc-1.36-old/c-typeck.c gcc-1.36/c-typeck.c *** gcc-1.36-old/c-typeck.c Thu Aug 24 14:44:57 1989 --- gcc-1.36/c-typeck.c Thu Dec 7 04:22:04 1989 *************** *** 1697,1703 **** register tree op0, op1; { tree dt0 = datatype (op0); - enum tree_code resultcode; register tree result, folded; tree restype = type_for_size (POINTER_SIZE, 0); --- 1697,1702 ---- diff -r -c gcc-1.36-old/cexp.y gcc-1.36/cexp.y *** gcc-1.36-old/cexp.y Wed Sep 20 21:37:42 1989 --- gcc-1.36/cexp.y Thu Dec 7 05:04:02 1989 *************** *** 498,504 **** case 'x': { register int i = 0; - register int count = 0; for (;;) { c = *(*string_ptr)++; --- 498,503 ---- Common subdirectories: gcc-1.36-old/config and gcc-1.36/config Only in gcc-1.36: errs diff -r -c gcc-1.36-old/expmed.c gcc-1.36/expmed.c *** gcc-1.36-old/expmed.c Tue Sep 12 12:46:21 1989 --- gcc-1.36/expmed.c Thu Dec 7 04:39:08 1989 *************** *** 79,85 **** --- 79,87 ---- register int offset = bitnum / unit; register int bitpos = bitnum % unit; register rtx op0 = str_rtx; + #ifdef HAVE_insv rtx value1; + #endif while (GET_CODE (op0) == SUBREG) { *************** *** 573,579 **** --- 575,583 ---- register int bitpos = bitnum % unit; register rtx op0 = str_rtx; rtx spec_target = target; + #ifdef HAVE_extv rtx bitsize_rtx, bitpos_rtx; + #endif rtx spec_target_subreg = 0; if (tmode == VOIDmode) diff -r -c gcc-1.36-old/expr.c gcc-1.36/expr.c *** gcc-1.36-old/expr.c Sun Sep 17 22:52:16 1989 --- gcc-1.36/expr.c Thu Dec 7 04:25:51 1989 *************** *** 1127,1132 **** --- 1127,1133 ---- return memory_address (QImode, temp); } + #ifdef PUSH_ROUNDING static rtx gen_push_operand () { *************** *** 1139,1144 **** --- 1140,1146 ---- Pmode, stack_pointer_rtx); } + #endif /* Generate code to push X onto the stack, assuming it has mode MODE. MODE is redundant except when X is a CONST_INT (since they don't *************** *** 1420,1426 **** if (i >= not_stack + offset) { rtx wd; - rtx addr; /* Get the next word of the value in WD. */ if (GET_CODE (x) == MEM) { --- 1422,1427 ---- diff -r -c gcc-1.36-old/final.c gcc-1.36/final.c *** gcc-1.36-old/final.c Tue Aug 22 20:16:56 1989 --- gcc-1.36/final.c Thu Dec 7 04:54:06 1989 *************** *** 398,405 **** --- 398,409 ---- int align = min (BIGGEST_ALIGNMENT, BITS_PER_WORD); extern int current_function_returns_struct; extern int current_function_needs_context; + #ifdef STRUCT_VALUE_INCOMING_REGNUM int sval = current_function_returns_struct; + #endif + #ifdef STATIC_CHAIN_INCOMING_REGNUM int cxt = current_function_needs_context; + #endif data_section (); ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT)); *************** *** 845,852 **** } } } - - reinsert_compare: /* Following a conditional branch, we have a new basic block. */ if (GET_CODE (insn) == JUMP_INSN && GET_CODE (body) == SET --- 849,854 ---- diff -r -c gcc-1.36-old/flow.c gcc-1.36/flow.c *** gcc-1.36-old/flow.c Sun Jul 30 16:39:37 1989 --- gcc-1.36/flow.c Thu Dec 7 04:50:18 1989 *************** *** 259,266 **** --- 259,268 ---- static void mark_used_regs (); static int insn_dead_p (); static int libcall_dead_p (); + #ifdef AUTO_INC_DEC static int try_pre_increment (); static int try_pre_increment_1 (); + #endif static rtx find_use_as_address (); void dump_flow_info (); diff -r -c gcc-1.36-old/gcc.c gcc-1.36/gcc.c *** gcc-1.36-old/gcc.c Sun Sep 17 13:51:58 1989 --- gcc-1.36/gcc.c Thu Dec 7 04:19:37 1989 *************** *** 751,757 **** int execute () { ! int i, j; int n_commands; /* # of command. */ char *string; struct command --- 751,757 ---- int execute () { ! int i; int n_commands; /* # of command. */ char *string; struct command diff -r -c gcc-1.36-old/genrecog.c gcc-1.36/genrecog.c *** gcc-1.36-old/genrecog.c Thu Sep 7 20:18:33 1989 --- gcc-1.36/genrecog.c Thu Dec 7 04:57:15 1989 *************** *** 461,467 **** --- 461,469 ---- put this after the last thing that tests the same place for the same mode. */ + #if 0 int operand = 0 != add->tests; + #endif for (p = old; p; p = p->next) { diff -r -c gcc-1.36-old/integrate.c gcc-1.36/integrate.c *** gcc-1.36-old/integrate.c Sat Sep 9 01:00:18 1989 --- gcc-1.36/integrate.c Thu Dec 7 04:44:41 1989 *************** *** 71,80 **** --- 71,82 ---- given a fresh stack-slot. */ static rtx *parm_map; + #if 0 /* ?? Should this be done here?? It is not right now. Keep track of whether a given pseudo-register is the sum of the frame pointer and a const_int (or zero). */ static char *fp_addr_p; + #endif /* For the local variables of the procdure being integrated that live on the frame, FRAME_POINTER_DELTA says how much to change their diff -r -c gcc-1.36-old/loop.c gcc-1.36/loop.c *** gcc-1.36-old/loop.c Sat Sep 9 21:48:44 1989 --- gcc-1.36/loop.c Thu Dec 7 04:49:03 1989 *************** *** 202,208 **** --- 202,210 ---- static void count_loop_regs_set (); static void note_addr_stored (); static int loop_reg_used_before_p (); + #if 0 static void constant_high_bytes (); + #endif static void scan_loop (); static rtx replace_regs (); static void replace_call_address (); *************** *** 535,541 **** { register struct movable *m; register int regno = REGNO (SET_DEST (PATTERN (p))); - int count; m = (struct movable *) alloca (sizeof (struct movable)); m->next = 0; m->insn = p; --- 537,542 ---- *************** *** 600,606 **** if (n_times_set[regno] == 2) { register struct movable *m; - int count; m = (struct movable *) alloca (sizeof (struct movable)); m->next = 0; m->insn = p; --- 601,606 ---- *************** *** 714,720 **** abort (); else { ! rtx i1, temp; /* If first insn of gnulib call sequence, skip to end. */ /* Do this at start of loop, since INSN is guaranteed to --- 714,720 ---- abort (); else { ! rtx temp; /* If first insn of gnulib call sequence, skip to end. */ /* Do this at start of loop, since INSN is guaranteed to diff -r -c gcc-1.36-old/optabs.c gcc-1.36/optabs.c *** gcc-1.36-old/optabs.c Tue Sep 5 13:22:31 1989 --- gcc-1.36/optabs.c Thu Dec 7 04:41:44 1989 *************** *** 219,226 **** --- 219,228 ---- && (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN)) { rtx insn_before, insn_first, insn_last; + #ifndef NO_FUNCTION_CSE rtx funexp = gen_rtx (SYMBOL_REF, Pmode, binoptab->handlers[(int) mode].lib_call); + #endif /* Pass the address through a pseudoreg, if desired, before the "beginning" of the library call. *************** *** 569,576 **** --- 571,580 ---- else if (unoptab->handlers[(int) mode].lib_call) { rtx insn_before, insn_last; + #ifndef NO_FUNCTION_CSE rtx funexp = gen_rtx (SYMBOL_REF, Pmode, unoptab->handlers[(int) mode].lib_call); + #endif /* Pass the address through a pseudoreg, if desired, before the "beginning" of the library call (for deletion). */ diff -r -c gcc-1.36-old/recog.c gcc-1.36/recog.c *** gcc-1.36-old/recog.c Sat Aug 5 21:12:48 1989 --- gcc-1.36/recog.c Thu Dec 7 04:56:03 1989 *************** *** 402,408 **** enum machine_mode mode; { rtx inner; - int mode_altering_drug = 0; if (! reload_completed) /* Note that no SUBREG is a memory operand before end of reload pass, --- 402,407 ---- *************** *** 490,496 **** /* 0 outputs, but some clobbers: body is [(asm_operands ...) (clobber (reg ...))...]. */ int i; - int n_sets; /* Make sure all the other parallel things really are clobbers. */ for (i = XVECLEN (body, 0) - 1; i > 0; i--) --- 489,494 ---- diff -r -c gcc-1.36-old/stmt.c gcc-1.36/stmt.c *** gcc-1.36-old/stmt.c Wed Sep 20 21:29:53 1989 --- gcc-1.36/stmt.c Thu Dec 7 04:32:55 1989 *************** *** 341,347 **** --- 341,349 ---- static void fixup_cleanups (); static void expand_null_return_1 (); static int tail_recursion_args (); + #if 0 static void fixup_stack_slots (); + #endif static rtx fixup_stack_1 (); static rtx fixup_memory_subreg (); static rtx walk_fixup_memory_subreg (); *************** *** 3007,3014 **** emit_jump_if_reachable (label) rtx label; { - rtx last_insn; - if (GET_CODE (get_last_insn ()) != BARRIER) emit_jump (label); } --- 3009,3014 ---- *************** *** 4730,4745 **** int line; { register int i; - rtx decl; extern rtx sequence_stack; #if 0 /* I think unused parms are legitimate enough. */ /* Warn about unused parms. */ if (warn_unused) ! for (decl = DECL_ARGUMENTS (current_function_decl); ! decl; decl = TREE_CHAIN (decl)) ! if (! TREE_USED (decl) && TREE_CODE (decl) == VAR_DECL) ! warning_with_decl (decl, "unused parameter `%s'"); #endif /* End any sequences that failed to be closed due to syntax errors. */ --- 4730,4747 ---- int line; { register int i; extern rtx sequence_stack; #if 0 /* I think unused parms are legitimate enough. */ /* Warn about unused parms. */ if (warn_unused) ! { ! rtx decl; ! for (decl = DECL_ARGUMENTS (current_function_decl); ! decl; decl = TREE_CHAIN (decl)) ! if (! TREE_USED (decl) && TREE_CODE (decl) == VAR_DECL) ! warning_with_decl (decl, "unused parameter `%s'"); ! } #endif /* End any sequences that failed to be closed due to syntax errors. */ diff -r -c gcc-1.36-old/toplev.c gcc-1.36/toplev.c *** gcc-1.36-old/toplev.c Thu Sep 7 20:21:14 1989 --- gcc-1.36/toplev.c Thu Dec 7 04:23:02 1989 *************** *** 625,631 **** int v; /* @@also used as pointer */ int v2; /* @@also used as pointer */ { - rtx temp; char *filename; int line; rtx body = PATTERN (insn); --- 625,630 ---- diff -r -c gcc-1.36-old/varasm.c gcc-1.36/varasm.c *** gcc-1.36-old/varasm.c Thu Sep 21 20:34:15 1989 --- gcc-1.36/varasm.c Thu Dec 7 04:43:01 1989 *************** *** 351,357 **** int size; { register int i; - int excess = 0; int pos = 0; int maximum = 2000; --- 351,356 ---- Common subdirectories: gcc-1.36-old/config/SCCS and gcc-1.36/config/SCCS diff -r -c gcc-1.36-old/config/out-sparc.c gcc-1.36/config/out-sparc.c *** gcc-1.36-old/config/out-sparc.c Wed Sep 6 00:54:34 1989 --- gcc-1.36/config/out-sparc.c Thu Dec 7 05:01:15 1989 *************** *** 223,230 **** rtx op; rtx after; { - extern char call_used_regs[]; - /* Just experimenting. */ if (GET_CODE (op) == CC0) return 1; --- 223,228 ---- *************** *** 1214,1220 **** rtx xoperands[10]; rtx zoperands[10]; static int movstrsi_label = 0; ! int i, j; rtx temp1 = operands[4]; rtx alignrtx = operands[3]; int align = INTVAL (alignrtx); --- 1212,1218 ---- rtx xoperands[10]; rtx zoperands[10]; static int movstrsi_label = 0; ! int i; rtx temp1 = operands[4]; rtx alignrtx = operands[3]; int align = INTVAL (alignrtx); *************** *** 1337,1343 **** int shifts[BITS_PER_WORD]; /* Table of shifts */ unsigned int p, log; /* A power of two, and its log */ int d1, d2; /* Differences of c and p */ - int first = 1; /* True if dst has unknown data in it */ int i; CC_STATUS_INIT; --- 1335,1340 ---- *************** *** 1769,1775 **** { char *template; extern rtx recog_operand[]; - extern char call_used_regs[]; extern char *insn_template[]; extern int insn_n_operands[]; extern char *(*insn_outfun[])(); --- 1766,1771 ---- *************** *** 1834,1842 **** { extern rtx alter_subreg (); extern int insn_n_operands[]; - extern rtx recog_operand[]; rtx xoperands[MAX_RECOG_OPERANDS]; ! int insn_code_number, i, nbytes; rtx nhead; /* Micro-hack: run peephole on head if it looks like a good idea. --- 1830,1837 ---- { extern rtx alter_subreg (); extern int insn_n_operands[]; rtx xoperands[MAX_RECOG_OPERANDS]; ! int insn_code_number, nbytes; rtx nhead; /* Micro-hack: run peephole on head if it looks like a good idea.