This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A patch for warnings in config/mips/mips.*


	This patch kills a few warnings stemming from the mips.* files.
Okay to install?

		--Kaveh



Mon Mar  1 12:12:04 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* mips.c (abort_with_insn): Make function static, add a prototype,
	constify 2nd parameter and mark with ATTRIBUTE_NORETURN.
	(current_function_file, mips_cpu_string, mips_isa_string,
	mips_abi_string, mips_no_mips16_string, mips_entry_string,
	mips_move_1word, mips_move_2words, output_block_move, load_store,
	override_options, make_temp_file, mips16_fp_args): Qualify a char*
	with the `const' keyword.

	* mips.h (current_function_file, mips_cpu_string, mips_isa_string,
	mips_abi_string, mips_entry_string, mips_no_mips16_string,
	mips_move_1word, mips_move_2words, output_block_move): Likewise.
	(abort_with_insn): Remove extern prototype.

	* mips.md: Qualify a char* with the `const' keyword.
	Remove many unused variables named `label'.


diff -rup orig/egcs-CVS19990228/gcc/config/mips/mips.c egcs-CVS19990228/gcc/config/mips/mips.c
--- orig/egcs-CVS19990228/gcc/config/mips/mips.c	Tue Feb 23 12:21:15 1999
+++ egcs-CVS19990228/gcc/config/mips/mips.c	Mon Mar  1 11:29:05 1999
@@ -106,6 +106,8 @@ static rtx add_constant				PROTO ((struc
 static void dump_constants			PROTO ((struct constant *,
 							rtx));
 static rtx mips_find_symbol			PROTO ((rtx));
+static void abort_with_insn			PROTO ((rtx, const char *))
+  ATTRIBUTE_NORETURN;
 
 
 /* Global variables for machine-dependent things.  */
@@ -148,7 +150,7 @@ struct extern_list
 } *extern_head = 0;
 
 /* Name of the file containing the current function.  */
-char *current_function_file = "";
+const char *current_function_file = "";
 
 /* Warning given that Mips ECOFF can't support changing files
    within a function.  */
@@ -206,9 +208,9 @@ int mips_abi;
 #endif
 
 /* Strings to hold which cpu and instruction set architecture to use.  */
-char *mips_cpu_string;		/* for -mcpu=<xxx> */
-char *mips_isa_string;		/* for -mips{1,2,3,4} */
-char *mips_abi_string;		/* for -mabi={32,n32,64,eabi} */
+const char *mips_cpu_string;	/* for -mcpu=<xxx> */
+const char *mips_isa_string;	/* for -mips{1,2,3,4} */
+const char *mips_abi_string;	/* for -mabi={32,n32,64,eabi} */
 
 /* Whether we are generating mips16 code.  This is a synonym for
    TARGET_MIPS16, and exists for use as an attribute.  */
@@ -217,7 +219,7 @@ int mips16;
 /* This variable is set by -mno-mips16.  We only care whether
    -mno-mips16 appears or not, and using a string in this fashion is
    just a way to avoid using up another bit in target_flags.  */
-char *mips_no_mips16_string;
+const char *mips_no_mips16_string;
 
 /* Whether we are generating mips16 hard float code.  In mips16 mode
    we always set TARGET_SOFT_FLOAT; this variable is nonzero if
@@ -228,7 +230,7 @@ int mips16_hard_float;
 /* This variable is set by -mentry.  We only care whether -mentry
    appears or not, and using a string in this fashion is just a way to
    avoid using up another bit in target_flags.  */
-char *mips_entry_string;
+const char *mips_entry_string;
 
 /* Whether we should entry and exit pseudo-ops in mips16 mode.  */
 int mips_entry;
@@ -1649,13 +1651,13 @@ embedded_pic_offset (x)
 
 /* Return the appropriate instructions to move one operand to another.  */
 
-char *
+const char *
 mips_move_1word (operands, insn, unsignedp)
      rtx operands[];
      rtx insn;
      int unsignedp;
 {
-  char *ret = 0;
+  const char *ret = 0;
   rtx op0 = operands[0];
   rtx op1 = operands[1];
   enum rtx_code code0 = GET_CODE (op0);
@@ -2043,12 +2045,12 @@ mips_move_1word (operands, insn, unsigne
 
 /* Return the appropriate instructions to move 2 words */
 
-char *
+const char *
 mips_move_2words (operands, insn)
      rtx operands[];
      rtx insn;
 {
-  char *ret = 0;
+  const char *ret = 0;
   rtx op0 = operands[0];
   rtx op1 = operands[1];
   enum rtx_code code0 = GET_CODE (operands[0]);
@@ -3224,7 +3226,7 @@ expand_block_move (operands)
 	BLOCK_MOVE_NOT_LAST	Do all but the last store.
 	BLOCK_MOVE_LAST		Do just the last store. */
 
-char *
+const char *
 output_block_move (insn, operands, num_regs, move_type)
      rtx insn;
      rtx operands[];
@@ -3244,11 +3246,11 @@ output_block_move (insn, operands, num_r
   rtx xoperands[10];
 
   struct {
-    char *load;			/* load insn without nop */
-    char *load_nop;		/* load insn with trailing nop */
-    char *store;		/* store insn */
-    char *final;		/* if last_store used: NULL or swr */
-    char *last_store;		/* last store instruction */
+    const char *load;		/* load insn without nop */
+    const char *load_nop;	/* load insn with trailing nop */
+    const char *store;		/* store insn */
+    const char *final;		/* if last_store used: NULL or swr */
+    const char *last_store;	/* last store instruction */
     int offset;			/* current offset */
     enum machine_mode mode;	/* mode to use on (MEM) */
   } load_store[4];
@@ -3982,10 +3984,10 @@ function_arg_partial_nregs (cum, mode, t
 
 /* Abort after printing out a specific insn.  */
 
-void
+static void
 abort_with_insn (insn, reason)
      rtx insn;
-     char *reason;
+     const char *reason;
 {
   error (reason);
   debug_rtx (insn);
@@ -4172,7 +4174,7 @@ override_options ()
 
   else
     {
-      char *p = mips_cpu_string;
+      const char *p = mips_cpu_string;
       int seen_v = 0;
 
       /* We need to cope with the various "vr" prefixes for the NEC 4300
@@ -5076,7 +5078,7 @@ static FILE *
 make_temp_file ()
 {
   FILE *stream;
-  char *base = getenv ("TMPDIR");
+  const char *base = getenv ("TMPDIR");
   int len;
 
   if (base == 0)
@@ -7469,7 +7471,7 @@ mips16_fp_args (file, fp_code, from_fp_p
      int fp_code;
      int from_fp_p;
 {
-  char *s;
+  const char *s;
   int gparg, fparg;
   unsigned int f;
 
diff -rup orig/egcs-CVS19990228/gcc/config/mips/mips.h egcs-CVS19990228/gcc/config/mips/mips.h
--- orig/egcs-CVS19990228/gcc/config/mips/mips.h	Wed Feb  3 08:04:20 1999
+++ egcs-CVS19990228/gcc/config/mips/mips.h	Mon Mar  1 11:29:13 1999
@@ -116,7 +116,7 @@ enum block_move_type {
 
 extern char mips_reg_names[][8];	/* register names (a0 vs. $4). */
 extern char mips_print_operand_punct[];	/* print_operand punctuation chars */
-extern char *current_function_file;	/* filename current function is in */
+extern const char *current_function_file; /* filename current function is in */
 extern int num_source_filenames;	/* current .file # */
 extern int inside_function;		/* != 0 if inside of a function */
 extern int ignore_line_number;		/* != 0 if we are to ignore next .loc */
@@ -141,11 +141,11 @@ extern int mips_isa;			/* architectural 
 extern int mips16;			/* whether generating mips16 code */
 extern int mips16_hard_float;		/* mips16 without -msoft-float */
 extern int mips_entry;			/* generate entry/exit for mips16 */
-extern char *mips_cpu_string;		/* for -mcpu=<xxx> */
-extern char *mips_isa_string;		/* for -mips{1,2,3,4} */
-extern char *mips_abi_string;		/* for -mabi={32,n32,64} */
-extern char *mips_entry_string;		/* for -mentry */
-extern char *mips_no_mips16_string;	/* for -mno-mips16 */
+extern const char *mips_cpu_string;	/* for -mcpu=<xxx> */
+extern const char *mips_isa_string;	/* for -mips{1,2,3,4} */
+extern const char *mips_abi_string;	/* for -mabi={32,n32,64} */
+extern const char *mips_entry_string;	/* for -mentry */
+extern const char *mips_no_mips16_string;/* for -mno-mips16 */
 extern int mips_split_addresses;	/* perform high/lo_sum support */
 extern int dslots_load_total;		/* total # load related delay slots */
 extern int dslots_load_filled;		/* # filled load delay slots */
@@ -178,7 +178,6 @@ extern struct rtx_def *mips16_gp_pseudo_
 
 #endif
 
-extern void		abort_with_insn ();
 extern int		arith32_operand ();
 extern int		arith_operand ();
 extern int		cmp_op ();
@@ -212,14 +211,14 @@ extern void		mips_expand_epilogue ();
 extern void		mips_expand_prologue ();
 extern int		mips_check_split ();
 extern char	       *mips_fill_delay_slot ();
-extern char	       *mips_move_1word ();
-extern char	       *mips_move_2words ();
+extern const char       *mips_move_1word ();
+extern const char       *mips_move_2words ();
 extern void		mips_output_double ();
 extern int		mips_output_external ();
 extern void		mips_output_float ();
 extern void		mips_output_filename ();
 extern void		mips_output_lineno ();
-extern char	       *output_block_move ();
+extern const char       *output_block_move ();
 extern void		override_options ();
 extern int		pc_or_label_operand ();
 extern void		print_operand_address ();
diff -rup orig/egcs-CVS19990228/gcc/config/mips/mips.md egcs-CVS19990228/gcc/config/mips/mips.md
--- orig/egcs-CVS19990228/gcc/config/mips/mips.md	Thu Feb  4 02:51:51 1999
+++ egcs-CVS19990228/gcc/config/mips/mips.md	Mon Mar  1 11:50:36 1999
@@ -1735,7 +1735,7 @@
    && !TARGET_MIPS16"
   "*
 {
-  static char *const madd[] = { \"madd\\t%1,%2\",    \"madd\\t%0,%1,%2\" };
+  static const char *const madd[] = { \"madd\\t%1,%2\", \"madd\\t%0,%1,%2\" };
   if (which_alternative == 2)
     return \"#\";
   return madd[which_alternative];
@@ -2241,8 +2241,6 @@
   "optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_divmodsi4_internal (operands[0], operands[1], operands[2],
 	     operands[3]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
@@ -2291,8 +2289,6 @@
   "TARGET_64BIT && optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_divmoddi4_internal (operands[0], operands[1], operands[2],
              operands[3]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
@@ -2341,8 +2337,6 @@
   "optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_udivmodsi4_internal (operands[0], operands[1], operands[2],
                                       operands[3]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
@@ -2382,8 +2376,6 @@
   "TARGET_64BIT && optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_udivmoddi4_internal (operands[0], operands[1], operands[2],
                                       operands[3]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
@@ -2510,8 +2502,6 @@
   "!optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_divsi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2553,8 +2543,6 @@
   "TARGET_64BIT && !optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_divdi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2596,8 +2584,6 @@
   "!optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_modsi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2639,8 +2625,6 @@
   "TARGET_64BIT && !optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_moddi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2682,8 +2666,6 @@
   "!optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_udivsi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2716,8 +2698,6 @@
   "TARGET_64BIT && !optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_udivdi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2750,8 +2730,6 @@
   "!optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_umodsi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -2784,8 +2762,6 @@
   "TARGET_64BIT && !optimize"
   "
 {
-  rtx label;
-
   emit_insn (gen_umoddi3_internal (operands[0], operands[1], operands[2]));
   if (!TARGET_NO_CHECK_ZERO_DIV)
     {
@@ -4662,7 +4638,7 @@ move\\t%0,%z4\\n\\
   rtx offset = const0_rtx;
   rtx addr = XEXP (operands[1], 0);
   rtx mem_addr = eliminate_constant_term (addr, &offset);
-  char *ret;
+  const char *ret;
 
   if (TARGET_STATS)
     mips_count_memory_refs (operands[1], 2);
@@ -4721,7 +4697,7 @@ move\\t%0,%z4\\n\\
   rtx offset = const0_rtx;
   rtx addr = XEXP (operands[1], 0);
   rtx mem_addr = eliminate_constant_term (addr, &offset);
-  char *ret;
+  const char *ret;
 
   if (TARGET_STATS)
     mips_count_memory_refs (operands[1], 2);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]