Patch checked in for prototypes, etc.

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Wed Oct 6 07:50:00 GMT 1999


I checked in the following patch to add some more prototypes and fix a
few warning nits.

		--Kaveh

Index: ChangeLog
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/ChangeLog,v
retrieving revision 1.4594
diff -u -p -r1.4594 ChangeLog
--- ChangeLog	1999/10/06 03:25:39	1.4594
+++ ChangeLog	1999/10/06 14:44:04
@@ -1,3 +1,34 @@
+Wed Oct  6 10:41:56 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* collect2.c (scan_prog_file, scan_libraries): Prototype function
+	pointers and casts for `int_handler' and `quit_handler'.
+
+	* flow.c (verify_flow_info, split_hard_reg_notes,
+	find_insn_with_note, sets_reg_or_subreg_1, prepend_reg_notes,
+	remove_edge, remove_fake_successors): Add static prototypes.
+	(verify_flow_info): Wrap with macro ENABLE_CHECKING.
+	(mark_set_1): Initialize variable `regno'.
+	(unlink_insn_chain): Likewise for variable `curr'.
+	(remove_fake_edges): Remove unused variables `e', `tmp' and `last'.
+
+	* loop.c (strength_reduce): Initialize variable
+	`unrolled_insn_copies'.
+	(cmp_combine_givs_stats, cmp_recombine_givs_stats): Add static
+	prototypes.  Change these functions to take const PTR parameters
+	to avoid prototype conflict when used as the comparson argument
+	for qsort.
+	(check_dbra_loop): Initialize variable `comparison_val'.
+
+	* reload.c (debug_reload_to_stream, debug_reload): Add prototypes.
+	(get_secondary_mem): Mark parameter `x' with ATTRIBUTE_UNUSED.
+	(find_valid_class): Initialize variable `best_class'.
+	(find_reloads): Call memcpy, not bcopy.
+
+	* reload1.c (gen_mode_int, dump_needs): Add prototypes.
+	(hard_reg_use_compare): Don't needlessly cast away const.
+	(reload_reg_class_lower): Likewise.
+	(choose_reload_regs): Initialize variable `regno'.
+
 Tue Oct  5 16:34:12 1999  Paul Burchard <burchard@pobox.com>
 
 	* ggc-page.c (GGC_ALWAYS_COLLECT): Fix typo when undef'ing.
Index: collect2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/collect2.c,v
retrieving revision 1.80
diff -u -p -r1.80 collect2.c
--- collect2.c	1999/09/25 13:11:16	1.80
+++ collect2.c	1999/10/06 14:44:06
@@ -2094,8 +2094,8 @@ scan_prog_file (prog_name, which_pass)
      const char *prog_name;
      enum pass which_pass;
 {
-  void (*int_handler) ();
-  void (*quit_handler) ();
+  void (*int_handler) PROTO ((int));
+  void (*quit_handler) PROTO ((int));
   char *real_nm_argv[4];
   const char **nm_argv = (const char **) real_nm_argv;
   int pid;
@@ -2162,9 +2162,9 @@ scan_prog_file (prog_name, which_pass)
     }
 
   /* Parent context from here on.  */
-  int_handler  = (void (*) ())signal (SIGINT,  SIG_IGN);
+  int_handler  = (void (*) PROTO ((int))) signal (SIGINT,  SIG_IGN);
 #ifdef SIGQUIT
-  quit_handler = (void (*) ())signal (SIGQUIT, SIG_IGN);
+  quit_handler = (void (*) PROTO ((int))) signal (SIGQUIT, SIG_IGN);
 #endif
 
   if (close (pipe_fd[1]) < 0)
@@ -2539,8 +2539,8 @@ scan_libraries (prog_name)
 {
   static struct head libraries;		/* list of shared libraries found */
   struct id *list;
-  void (*int_handler) ();
-  void (*quit_handler) ();
+  void (*int_handler) PROTO ((int));
+  void (*quit_handler) PROTO ((int));
   char *real_ldd_argv[4];
   const char **ldd_argv = (const char **) real_ldd_argv;
   int pid;
@@ -2604,9 +2604,9 @@ scan_libraries (prog_name)
     }
 
   /* Parent context from here on.  */
-  int_handler  = (void (*) ()) signal (SIGINT,  SIG_IGN);
+  int_handler  = (void (*) PROTO ((int))) signal (SIGINT,  SIG_IGN);
 #ifdef SIGQUIT
-  quit_handler = (void (*) ()) signal (SIGQUIT, SIG_IGN);
+  quit_handler = (void (*) PROTO ((int))) signal (SIGQUIT, SIG_IGN);
 #endif
 
   if (close (pipe_fd[1]) < 0)
Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.164
diff -u -p -r1.164 flow.c
--- flow.c	1999/10/05 19:01:01	1.164
+++ flow.c	1999/10/06 14:44:09
@@ -354,7 +354,15 @@ static int maybe_add_dead_note		PROTO ((
 static int sets_reg_or_subreg		PROTO ((rtx, rtx));
 static void update_n_sets 		PROTO ((rtx, int));
 static void new_insn_dead_notes		PROTO ((rtx, rtx, rtx, rtx, rtx, rtx));
-void verify_flow_info			PROTO ((void));
+#ifdef ENABLE_CHECKING
+static void verify_flow_info		PROTO ((void));
+#endif
+static void split_hard_reg_notes	PROTO ((rtx, rtx, rtx, rtx));
+static rtx find_insn_with_note		PROTO ((rtx, rtx, rtx));
+static void sets_reg_or_subreg_1	PROTO ((rtx, rtx));
+static rtx prepend_reg_notes		PROTO ((rtx, rtx));
+static void remove_edge			PROTO ((edge));
+static void remove_fake_successors	PROTO ((basic_block));
 
 /* Find basic blocks of the current function.
    F is the first insn of the function and NREGS the number of register
@@ -3529,7 +3537,7 @@ mark_set_1 (needed, dead, x, insn, signi
      rtx insn;
      regset significant;
 {
-  register int regno;
+  register int regno = -1;
   register rtx reg = SET_DEST (x);
 
   /* Some targets place small structures in registers for
@@ -5419,7 +5427,7 @@ unlink_insn_chain (start, finish)
      rtx start, finish;
 {
   rtx insert_point = PREV_INSN (start);
-  rtx chain = NULL_RTX, curr;
+  rtx chain = NULL_RTX, curr = NULL_RTX;
 
   /* Unchain the insns one by one.  It would be quicker to delete all
      of these with a single unchaining, rather than one at a time, but
@@ -5625,7 +5633,7 @@ maybe_add_dead_note_use (insn, dest)
 
 /* Find the first insn in the set of insns from FIRST to LAST inclusive
    that contains the note NOTE. */
-rtx
+static rtx
 find_insn_with_note (note, first, last)
      rtx note, first, last;
 {
@@ -6472,7 +6480,8 @@ replace_insns (first, last, first_new, n
    In future it can be extended check a lot of other stuff as well
    (reachability of basic blocks, life information, etc. etc.).  */
 
-void
+#ifdef ENABLE_CHECKING
+static void
 verify_flow_info ()
 {
   const int max_uid = get_max_uid ();
@@ -6675,6 +6684,7 @@ verify_flow_info ()
       x = NEXT_INSN (x);
     }
 }
+#endif
 
 /* Functions to access an edge list with a vector representation.
    Enough data is kept such that given an index number, the 
@@ -6998,12 +7008,10 @@ void
 remove_fake_edges ()
 {
   int x;
-  edge e;
   basic_block bb;
 
   for (x = 0; x < n_basic_blocks; x++)
     {
-      edge tmp, last = NULL;
       bb = BASIC_BLOCK (x);
       remove_fake_successors (bb);
     }
Index: loop.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/loop.c,v
retrieving revision 1.188
diff -u -p -r1.188 loop.c
--- loop.c	1999/09/20 09:59:49	1.188
+++ loop.c	1999/10/06 14:44:19
@@ -3714,7 +3714,7 @@ strength_reduce (scan_start, end, loop_t
   rtx end_insert_before;
   int loop_depth = 0;
   int n_extra_increment;
-  int unrolled_insn_copies;
+  int unrolled_insn_copies = 0;
 
   /* If scan_start points to the loop exit test, we have to be wary of
      subversive use of gotos inside expression statements.  */
@@ -6268,8 +6268,10 @@ general_induction_var (x, src_reg, add_v
 
    *BENEFIT will be incremented by the benefit of any sub-giv encountered.  */
 
-static rtx sge_plus PROTO ((enum machine_mode, rtx, rtx));
-static rtx sge_plus_constant PROTO ((rtx, rtx));
+static rtx sge_plus PARAMS ((enum machine_mode, rtx, rtx));
+static rtx sge_plus_constant PARAMS ((rtx, rtx));
+static int cmp_combine_givs_stats PARAMS ((const PTR, const PTR));
+static int cmp_recombine_givs_stats PARAMS ((const PTR, const PTR));
 
 static rtx
 simplify_giv_expr (x, benefit)
@@ -7015,9 +7017,14 @@ struct combine_givs_stats
 };
 
 static int
-cmp_combine_givs_stats (x, y)
-     struct combine_givs_stats *x, *y;
+cmp_combine_givs_stats (xp, yp)
+     const PTR xp;
+     const PTR yp;
 {
+  const struct combine_givs_stats * const x =
+    (const struct combine_givs_stats *) xp;
+  const struct combine_givs_stats * const y =
+    (const struct combine_givs_stats *) yp;
   int d;
   d = y->total_benefit - x->total_benefit;
   /* Stabilize the sort.  */
@@ -7202,9 +7209,14 @@ struct recombine_givs_stats
    when scanning the array starting at the end, thus the arguments are
    used in reverse.  */
 static int
-cmp_recombine_givs_stats (x, y)
-     struct recombine_givs_stats *x, *y;
+cmp_recombine_givs_stats (xp, yp)
+     const PTR xp;
+     const PTR yp;
 {
+  const struct recombine_givs_stats * const x =
+    (const struct recombine_givs_stats *) xp;
+  const struct recombine_givs_stats * const y =
+    (const struct recombine_givs_stats *) yp;
   int d;
   d = y->start_luid - x->start_luid;
   /* Stabilize the sort.  */
@@ -7994,7 +8006,7 @@ check_dbra_loop (loop_end, insn_count, l
 		  || (GET_CODE (comparison) == LE
 		      && no_use_except_counting)))
 	    {
-	      HOST_WIDE_INT add_val, add_adjust, comparison_val;
+	      HOST_WIDE_INT add_val, add_adjust, comparison_val = 0;
 	      rtx initial_value, comparison_value;
 	      int nonneg = 0;
 	      enum rtx_code cmp_code;
Index: reload.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload.c,v
retrieving revision 1.84
diff -u -p -r1.84 reload.c
--- reload.c	1999/10/01 10:00:26	1.84
+++ reload.c	1999/10/06 14:44:25
@@ -272,6 +272,8 @@ static rtx find_reloads_subreg_address P
 					      int, rtx));
 static int find_inc_amount	PROTO((rtx, rtx));
 static int loc_mentioned_in_p	PROTO((rtx *, rtx));
+extern void debug_reload_to_stream PROTO((FILE *));
+extern void debug_reload PROTO((void));
 
 #ifdef HAVE_SECONDARY_RELOADS
 
@@ -571,7 +573,7 @@ push_secondary_reload (in_p, x, opnum, o
 
 rtx
 get_secondary_mem (x, mode, opnum, type)
-     rtx x;
+     rtx x ATTRIBUTE_UNUSED;
      enum machine_mode mode;
      int opnum;
      enum reload_type type;
@@ -658,7 +660,7 @@ find_valid_class (m1, n)
 {
   int class;
   int regno;
-  enum reg_class best_class;
+  enum reg_class best_class = NO_REGS;
   int best_size = 0;
 
   for (class = 1; class < N_REG_CLASSES; class++)
@@ -2452,10 +2454,9 @@ find_reloads (insn, replace, ind_levels,
   insn_code_number = INSN_CODE (insn);
   this_insn_is_asm = insn_code_number < 0;
 
-  bcopy ((char *) recog_data.operand_mode, (char *) operand_mode,
-	 noperands * sizeof (enum machine_mode));
-  bcopy ((char *) recog_data.constraints, (char *) constraints,
-	 noperands * sizeof (char *));
+  memcpy (operand_mode, recog_data.operand_mode,
+	  noperands * sizeof (enum machine_mode));
+  memcpy (constraints, recog_data.constraints, noperands * sizeof (char *));
 
   commutative = -1;
 
@@ -3433,8 +3434,8 @@ find_reloads (insn, replace, ind_levels,
 	  pref_or_nothing[commutative] = pref_or_nothing[commutative + 1];
 	  pref_or_nothing[commutative + 1] = t;
 
-	  bcopy ((char *) recog_data.constraints, (char *) constraints,
-		 noperands * sizeof (char *));
+	  memcpy (constraints, recog_data.constraints,
+		  noperands * sizeof (char *));
 	  goto try_swapped;
 	}
       else
Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.167
diff -u -p -r1.167 reload1.c
--- reload1.c	1999/10/01 10:00:26	1.167
+++ reload1.c	1999/10/06 14:44:33
@@ -449,6 +449,9 @@ static void move2add_note_store PROTO((r
 #ifdef AUTO_INC_DEC
 static void add_auto_inc_notes PROTO((rtx, rtx));
 #endif
+static rtx gen_mode_int			PROTO((enum machine_mode,
+					       HOST_WIDE_INT));
+extern void dump_needs			PROTO((struct insn_chain *, FILE *));
 
 /* Initialize the reload pass once per compilation.  */
 
@@ -4023,8 +4026,8 @@ hard_reg_use_compare (p1p, p2p)
      const PTR p1p;
      const PTR p2p;
 {
-  struct hard_reg_n_uses *p1 = (struct hard_reg_n_uses *)p1p;
-  struct hard_reg_n_uses *p2 = (struct hard_reg_n_uses *)p2p;
+  const struct hard_reg_n_uses *p1 = (const struct hard_reg_n_uses *)p1p;
+  const struct hard_reg_n_uses *p2 = (const struct hard_reg_n_uses *)p2p;
   int bad1 = TEST_HARD_REG_BIT (bad_spill_regs, p1->regno);
   int bad2 = TEST_HARD_REG_BIT (bad_spill_regs, p2->regno);
   if (bad1 && bad2)
@@ -4519,7 +4522,7 @@ reload_reg_class_lower (r1p, r2p)
      const PTR r1p;
      const PTR r2p;
 {
-  register int r1 = *(short *)r1p, r2 = *(short *)r2p;
+  register int r1 = *(const short *)r1p, r2 = *(const short *)r2p;
   register int t;
 
   /* Consider required reloads before optional ones.  */
@@ -6014,7 +6017,7 @@ choose_reload_regs (chain)
 	      register rtx equiv
 		= find_equiv_reg (search_equiv, insn, rld[r].class,
 				  -1, NULL_PTR, 0, reload_mode[r]);
-	      int regno;
+	      int regno = 0;
 
 	      if (equiv != 0)
 		{


More information about the Gcc-patches mailing list