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 warning patch for config/sparc/*


	This patch fixes warnings arising from files in config/sparc/*.
Okay to install?

		--Kaveh



Tue Mar  2 11:00:19 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* gmon-sol2.c: Include config.h and system.h.  Don't redundantly
	include system header files.
	(sccsid): Mark with ATTRIBUTE_UNUSED.
	(moncontrol, monstartup, _mcleanup, internal_mcount): Prototype.
	(_mcleanup): Add the `const' keyword to a char*.
	(internal_mcount): Explicitly define the return type of `etext'.
	Cast `etext' to char* when calling `monstartup'.

	* sparc.c (frame_base_name, save_regs, restore_regs,
	build_big_number, sparc_cmodel_string, sparc_align_loops_string,
	sparc_align_jumps_string, sparc_align_funcs_string, code_model,
	cpu_default, cpu_table, output_function_prologue,
	output_function_epilogue, output_return,
	sparc_flat_output_function_prologue, ultra_code_names,
	sparc_flat_output_function_epilogue): Constify a char*.
	(hypersparc_adjust_cost): Add a default case in a switch.

	* sparc.h (sparc_cmodel_string, OVERRIDE_OPTIONS,
	sparc_cpu_select, sparc_align_loops_string,
	sparc_align_jumps_string, sparc_align_funcs_string,
	output_return): Constify a char*.

	* sparc.md (movdi): Cast a value to HOST_WIDE_INT when comparing
	against one.  Hide the declaration for variable `chain'.
	
	
diff -rup orig/egcs-CVS19990228/gcc/config/sparc/gmon-sol2.c egcs-CVS19990228/gcc/config/sparc/gmon-sol2.c
--- orig/egcs-CVS19990228/gcc/config/sparc/gmon-sol2.c	Wed Dec 16 16:13:07 1998
+++ egcs-CVS19990228/gcc/config/sparc/gmon-sol2.c	Mon Mar  1 16:35:52 1999
@@ -35,17 +35,13 @@
  * for Cygnus Support, July 1992.
  */
 
+#include "config.h"
+#include "system.h"
+
 #ifndef lint
-static char sccsid[] = "@(#)gmon.c	5.3 (Berkeley) 5/22/91";
+static char sccsid[] ATTRIBUTE_UNUSED = "@(#)gmon.c	5.3 (Berkeley) 5/22/91";
 #endif /* not lint */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <unistd.h>
-#include <fcntl.h>
-
 #if 0
 #include "sparc/gmon.h"
 #else
@@ -96,7 +92,9 @@ static int	s_scale;
 
 #define	MSG "No space for profiling buffer(s)\n"
 
-static void moncontrol();
+static void moncontrol	PROTO ((int));
+extern void monstartup	PROTO ((char *, char *));
+extern void _mcleanup	PROTO ((void));
 
 void monstartup(lowpc, highpc)
     char	*lowpc;
@@ -185,7 +183,7 @@ _mcleanup()
     int			toindex;
     struct rawarc	rawarc;
     char		*profdir;
-    char		*proffile;
+    const char		*proffile;
     char		*progname;
     char		 buf[PATH_MAX];
     extern char	       **___Argv;
@@ -275,6 +273,8 @@ _mcleanup()
  * -- [eichin:19920702.1107EST]
  */
 
+static void internal_mcount PROTO((char *, unsigned short *)) ATTRIBUTE_UNUSED;
+
 /* i7 == last ret, -> frompcindex */
 /* o7 == current ret, -> selfpc */
 /* Solaris 2 libraries use _mcount.  */
@@ -297,9 +297,9 @@ static void internal_mcount(selfpc, from
 	 */
 
 	if(!already_setup) {
-          extern etext();
+          extern int etext();
 	  already_setup = 1;
-	  monstartup(0, etext);
+	  monstartup(0, (char *)etext);
 #ifdef USE_ONEXIT
 	  on_exit(_mcleanup, 0);
 #else
diff -rup orig/egcs-CVS19990228/gcc/config/sparc/sparc.c egcs-CVS19990228/gcc/config/sparc/sparc.c
--- orig/egcs-CVS19990228/gcc/config/sparc/sparc.c	Fri Jan 15 18:45:30 1999
+++ egcs-CVS19990228/gcc/config/sparc/sparc.c	Mon Mar  1 16:01:20 1999
@@ -98,15 +98,15 @@ char leaf_reg_remap[] =
    this is "%sp+something".  We record "something" separately as it may be
    too big for reg+constant addressing.  */
 
-static char *frame_base_name;
+static const char *frame_base_name;
 static int frame_base_offset;
 
 static rtx pic_setup_code	PROTO((void));
 static void sparc_init_modes	PROTO((void));
-static int save_regs		PROTO((FILE *, int, int, char *,
+static int save_regs		PROTO((FILE *, int, int, const char *,
 				       int, int, int));
-static int restore_regs		PROTO((FILE *, int, int, char *, int, int));
-static void build_big_number	PROTO((FILE *, int, char *));
+static int restore_regs		PROTO((FILE *, int, int, const char *, int, int));
+static void build_big_number	PROTO((FILE *, int, const char *));
 static int function_arg_slotno	PROTO((const CUMULATIVE_ARGS *,
 				       enum machine_mode, tree, int, int,
 				       int *, int *));
@@ -127,14 +127,14 @@ extern char *dwarf2out_cfi_label ();
 /* Option handling.  */
 
 /* Code model option as passed by user.  */
-char *sparc_cmodel_string;
+const char *sparc_cmodel_string;
 /* Parsed value.  */
 enum cmodel sparc_cmodel;
 
 /* Record alignment options as passed by user.  */
-char *sparc_align_loops_string;
-char *sparc_align_jumps_string;
-char *sparc_align_funcs_string;
+const char *sparc_align_loops_string;
+const char *sparc_align_jumps_string;
+const char *sparc_align_funcs_string;
 
 /* Parsed values, as a power of two.  */
 int sparc_align_loops;
@@ -160,7 +160,7 @@ void
 sparc_override_options ()
 {
   static struct code_model {
-    char *name;
+    const char *name;
     int value;
   } cmodels[] = {
     { "32", CM_32 },
@@ -174,7 +174,7 @@ sparc_override_options ()
   /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=.  */
   static struct cpu_default {
     int cpu;
-    char *name;
+    const char *name;
   } cpu_default[] = {
     /* There must be one entry here for each TARGET_CPU value.  */
     { TARGET_CPU_sparc, "cypress" },
@@ -191,7 +191,7 @@ sparc_override_options ()
   struct cpu_default *def;
   /* Table of values for -m{cpu,tune}=.  */
   static struct cpu_table {
-    char *name;
+    const char *name;
     enum processor_type processor;
     int disable;
     int enable;
@@ -2886,7 +2886,7 @@ static int
 save_regs (file, low, high, base, offset, n_regs, real_offset)
      FILE *file;
      int low, high;
-     char *base;
+     const char *base;
      int offset;
      int n_regs;
      int real_offset;
@@ -2959,7 +2959,7 @@ static int
 restore_regs (file, low, high, base, offset, n_regs)
      FILE *file;
      int low, high;
-     char *base;
+     const char *base;
      int offset;
      int n_regs;
 {
@@ -3074,7 +3074,7 @@ static void
 build_big_number (file, num, reg)
      FILE *file;
      int num;
-     char *reg;
+     const char *reg;
 {
   if (num >= 0 || ! TARGET_ARCH64)
     {
@@ -3206,7 +3206,7 @@ output_function_prologue (file, size, le
   if (num_gfregs)
     {
       int offset, real_offset, n_regs;
-      char *base;
+      const char *base;
 
       real_offset = -apparent_fsize;
       offset = -apparent_fsize + frame_base_offset;
@@ -3257,7 +3257,7 @@ output_function_epilogue (file, size, le
      int size ATTRIBUTE_UNUSED;
      int leaf_function;
 {
-  char *ret;
+  const char *ret;
 
   if (leaf_label)
     {
@@ -3287,7 +3287,7 @@ output_function_epilogue (file, size, le
   if (num_gfregs)
     {
       int offset, n_regs;
-      char *base;
+      const char *base;
 
       offset = -apparent_fsize + frame_base_offset;
       if (offset < -4096 || offset + num_gfregs * 4 > 4096 - 8 /*double*/)
@@ -4675,7 +4675,7 @@ epilogue_renumber (where)
 
 /* Output assembler code to return from a function.  */
 
-char *
+const char *
 output_return (operands)
      rtx *operands;
 {
@@ -5876,7 +5876,7 @@ sparc_flat_output_function_prologue (fil
     {
       unsigned int reg_offset = current_frame_info.reg_offset;
       char *fp_str = reg_names[FRAME_POINTER_REGNUM];
-      char *t1_str = "%g1";
+      const char *t1_str = "%g1";
 
       /* Things get a little tricky if local variables take up more than ~4096
 	 bytes and outgoing arguments take up more than ~4096 bytes.  When that
@@ -6055,7 +6055,7 @@ sparc_flat_output_function_epilogue (fil
       unsigned int size1;
       char *sp_str = reg_names[STACK_POINTER_REGNUM];
       char *fp_str = reg_names[FRAME_POINTER_REGNUM];
-      char *t1_str = "%g1";
+      const char *t1_str = "%g1";
 
       /* In the reload sequence, we don't need to fill the load delay
 	 slots for most of the loads, also see if we can fill the final
@@ -6331,6 +6331,8 @@ hypersparc_adjust_cost (insn, link, dep_
 	  if (dep_type == TYPE_FPCMP)
 	    return cost - 1;
 	  break;
+	default:
+	  break;
 	}
 	break;
 
@@ -6540,7 +6542,7 @@ enum ultra_code { NONE=0, /* no insn at 
 		  SINGLE, /* single issue instructions			*/
 		  NUM_ULTRA_CODES };
 
-static char *ultra_code_names[NUM_ULTRA_CODES] = {
+static const char *ultra_code_names[NUM_ULTRA_CODES] = {
   "NONE", "IEU0", "IEU1", "IEUN", "LSU", "CTI",
   "FPM", "FPA", "SINGLE" };
 
diff -rup orig/egcs-CVS19990228/gcc/config/sparc/sparc.h egcs-CVS19990228/gcc/config/sparc/sparc.h
--- orig/egcs-CVS19990228/gcc/config/sparc/sparc.h	Wed Feb 24 22:10:58 1999
+++ egcs-CVS19990228/gcc/config/sparc/sparc.h	Mon Mar  1 16:01:30 1999
@@ -87,7 +87,7 @@ enum cmodel {
 };
 
 /* Value of -mcmodel specified by user.  */
-extern char *sparc_cmodel_string;
+extern const char *sparc_cmodel_string;
 /* One of CM_FOO.  */
 extern enum cmodel sparc_cmodel;
 
@@ -389,7 +389,7 @@ void sparc_override_options ();
       {									\
 	if (flag_pic)							\
 	  {								\
-	    char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";	\
+	    const char *pic_string = (flag_pic == 1) ? "-fpic" : "-fPIC";\
 	    warning ("%s and profiling conflict: disabling %s",		\
 		     pic_string, pic_string);				\
 	    flag_pic = 0;						\
@@ -675,8 +675,8 @@ extern enum processor_type sparc_cpu;
 /* sparc_select[0] is reserved for the default cpu.  */
 struct sparc_cpu_select
 {
-  char *string;
-  char *name;
+  const char *string;
+  const char *name;
   int set_tune_p;
   int set_arch_p;
 };
@@ -684,9 +684,9 @@ struct sparc_cpu_select
 extern struct sparc_cpu_select sparc_select[];
 
 /* Variables to record values the user passes.  */
-extern char *sparc_align_loops_string;
-extern char *sparc_align_jumps_string;
-extern char *sparc_align_funcs_string;
+extern const char *sparc_align_loops_string;
+extern const char *sparc_align_jumps_string;
+extern const char *sparc_align_funcs_string;
 /* Parsed values as a power of two.  */
 extern int sparc_align_loops;
 extern int sparc_align_jumps;
@@ -3400,7 +3400,7 @@ extern int sparc_splitdi_legitimate ();
 extern int sparc_absnegfloat_split_legitimate ();
 
 extern char *output_cbranch ();
-extern char *output_return ();
+extern const char *output_return ();
 extern char *output_v9branch ();
 
 extern void emit_v9_brxx_insn ();
diff -rup orig/egcs-CVS19990228/gcc/config/sparc/sparc.md egcs-CVS19990228/gcc/config/sparc/sparc.md
--- orig/egcs-CVS19990228/gcc/config/sparc/sparc.md	Sun Feb 28 19:40:50 1999
+++ egcs-CVS19990228/gcc/config/sparc/sparc.md	Mon Mar  1 15:44:02 1999
@@ -2288,7 +2288,7 @@
 #if HOST_BITS_PER_WIDE_INT != 64
       && ((CONST_DOUBLE_HIGH (operands[1]) == 0
 	   && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) == 0)
-	  || (CONST_DOUBLE_HIGH (operands[1]) == 0xffffffff
+	  || (CONST_DOUBLE_HIGH (operands[1]) == (HOST_WIDE_INT) 0xffffffff
 	      && (CONST_DOUBLE_LOW (operands[1]) & 0x80000000) != 0))
 #endif
       )
@@ -7704,7 +7704,9 @@
   ""
   "
 {
+#if 0
   rtx chain = operands[0];
+#endif
   rtx fp = operands[1];
   rtx stack = operands[2];
   rtx lab = operands[3];


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