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]

Patch installed for warning nits


I installed the following obvious warning fixes.  Bootstrapped/tested
on solaris2.7.

2000-11-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtins.c (c_getstr): Constify variable.
	* gmon-sol2.c (_mcleanup): Comment out #endif labels.
	* conflict.c (const_conflict_graph_arc): New typedef.
	(arc_hash, arc_eq): Avoid needlessly casting away const-ness.
	* cppmacro.c (builtin_macro): Likewise.
	* dwarf2out.c (output_comp_unit): Constify variable.
	* fix-header.c (v_fatal): Add ATTRIBUTE_PRINTF.
	* protoize.c (IS_SAME_PATH_CHAR): Use TOUPPER, not toupper.
	* ssa.c (ssa_rename_from_hash_function): Avoid needlessly casting
	away const-ness.
	* tradcpp.c (rescan, do_line, macroexpand, macarg): Use
	ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint. 
	* varasm.c (const_str_htab_hash, const_str_htab_eq,
	compare_constant_1, record_constant_1): Constify.
	
diff -rup orig/egcs-CVS20001118/gcc/builtins.c egcs-CVS20001118/gcc/builtins.c
--- orig/egcs-CVS20001118/gcc/builtins.c	Fri Nov 17 22:52:56 2000
+++ egcs-CVS20001118/gcc/builtins.c	Sat Nov 18 20:00:43 2000
@@ -278,7 +278,7 @@ c_getstr (src)
 {
   tree offset_node;
   int offset, max;
-  char *ptr;
+  const char *ptr;
 
   src = string_constant (src, &offset_node);
   if (src == 0)
@@ -301,7 +301,7 @@ c_getstr (src)
 	return 0;
     }
 
-  return (const char *) ptr + offset;
+  return ptr + offset;
 }
 
 /* Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT
diff -rup orig/egcs-CVS20001118/gcc/config/sparc/gmon-sol2.c egcs-CVS20001118/gcc/config/sparc/gmon-sol2.c
--- orig/egcs-CVS20001118/gcc/config/sparc/gmon-sol2.c	Mon Mar  6 13:00:49 2000
+++ egcs-CVS20001118/gcc/config/sparc/gmon-sol2.c	Sat Nov 18 20:06:10 2000
@@ -208,7 +208,7 @@ _mcleanup()
     }
 #   ifdef DEBUG
 	fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
-#   endif DEBUG
+#   endif /* DEBUG */
     write( fd , sbuf , ssiz );
     endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
     for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
@@ -221,7 +221,7 @@ _mcleanup()
 		fprintf( stderr ,
 			"[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
 			frompc , tos[toindex].selfpc , tos[toindex].count );
-#	    endif DEBUG
+#	    endif /* DEBUG */
 	    rawarc.raw_frompc = (unsigned long) frompc;
 	    rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
 	    rawarc.raw_count = tos[toindex].count;
diff -rup orig/egcs-CVS20001118/gcc/conflict.c egcs-CVS20001118/gcc/conflict.c
--- orig/egcs-CVS20001118/gcc/conflict.c	Thu Jun 15 10:33:37 2000
+++ egcs-CVS20001118/gcc/conflict.c	Sat Nov 18 20:30:19 2000
@@ -85,6 +85,7 @@ struct conflict_graph_arc_def
 };
 
 typedef struct conflict_graph_arc_def *conflict_graph_arc;
+typedef const struct conflict_graph_arc_def *const_conflict_graph_arc;
 
 
 /* A conflict graph.  */
@@ -127,7 +128,7 @@ static unsigned
 arc_hash (arcp)
      const void *arcp;
 {
-  conflict_graph_arc arc = (conflict_graph_arc) arcp;
+  const_conflict_graph_arc arc = (const_conflict_graph_arc) arcp;
 
   return CONFLICT_HASH_FN (arc->smaller, arc->larger);
 }
@@ -140,8 +141,8 @@ arc_eq (arcp1, arcp2)
      const void *arcp1;
      const void *arcp2;
 {
-  conflict_graph_arc arc1 = (conflict_graph_arc) arcp1;
-  conflict_graph_arc arc2 = (conflict_graph_arc) arcp2;
+  const_conflict_graph_arc arc1 = (const_conflict_graph_arc) arcp1;
+  const_conflict_graph_arc arc2 = (const_conflict_graph_arc) arcp2;
 
   return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger;
 }
diff -rup orig/egcs-CVS20001118/gcc/cppmacro.c egcs-CVS20001118/gcc/cppmacro.c
--- orig/egcs-CVS20001118/gcc/cppmacro.c	Thu Nov 16 08:21:15 2000
+++ egcs-CVS20001118/gcc/cppmacro.c	Sat Nov 18 20:17:59 2000
@@ -170,7 +170,7 @@ builtin_macro (pfile, token)
 	    file = ip->nominal_fname;
 	  }
 	make_string_token (pfile->string_pool, token,
-			   (U_CHAR *) file, strlen (file));
+			   (const U_CHAR *) file, strlen (file));
       }
       break;
 	
diff -rup orig/egcs-CVS20001118/gcc/dwarf2out.c egcs-CVS20001118/gcc/dwarf2out.c
--- orig/egcs-CVS20001118/gcc/dwarf2out.c	Fri Nov 17 22:53:12 2000
+++ egcs-CVS20001118/gcc/dwarf2out.c	Sat Nov 18 20:24:35 2000
@@ -6110,7 +6110,7 @@ static void
 output_comp_unit (die)
      dw_die_ref die;
 {
-  char *secname;
+  const char *secname;
 
   if (die->die_child == 0)
     return;
@@ -6126,12 +6126,13 @@ output_comp_unit (die)
 
   if (die->die_symbol)
     {
-      secname = (char *) alloca (strlen (die->die_symbol) + 24);
-      sprintf (secname, ".gnu.linkonce.wi.%s", die->die_symbol);
+      char *tmp = (char *) alloca (strlen (die->die_symbol) + 24);
+      sprintf (tmp, ".gnu.linkonce.wi.%s", die->die_symbol);
+      secname = tmp;
       die->die_symbol = NULL;
     }
   else
-    secname = (char *) DEBUG_INFO_SECTION;
+    secname = (const char *) DEBUG_INFO_SECTION;
 
   /* Output debugging information.  */
   fputc ('\n', asm_out_file);
diff -rup orig/egcs-CVS20001118/gcc/fix-header.c egcs-CVS20001118/gcc/fix-header.c
--- orig/egcs-CVS20001118/gcc/fix-header.c	Mon Oct 30 10:57:04 2000
+++ egcs-CVS20001118/gcc/fix-header.c	Sat Nov 18 20:15:20 2000
@@ -77,7 +77,7 @@ Foundation, 59 Temple Place - Suite 330,
 #include "scan.h"
 #include "cpplib.h"
 
-static void v_fatal PARAMS ((const char *, va_list)) ATTRIBUTE_NORETURN;
+static void v_fatal PARAMS ((const char *, va_list)) ATTRIBUTE_PRINTF (1,0) ATTRIBUTE_NORETURN;
 static void fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 
 sstring buf;
diff -rup orig/egcs-CVS20001118/gcc/protoize.c egcs-CVS20001118/gcc/protoize.c
--- orig/egcs-CVS20001118/gcc/protoize.c	Tue Aug 22 14:28:33 2000
+++ egcs-CVS20001118/gcc/protoize.c	Sat Nov 18 20:36:49 2000
@@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Macro to see if the path elements match.  */
 #ifdef HAVE_DOS_BASED_FILE_SYSTEM
-#define IS_SAME_PATH_CHAR(a,b) (toupper (a) == toupper (b))
+#define IS_SAME_PATH_CHAR(a,b) (TOUPPER (a) == TOUPPER (b))
 #else
 #define IS_SAME_PATH_CHAR(a,b) ((a) == (b))
 #endif
diff -rup orig/egcs-CVS20001118/gcc/ssa.c egcs-CVS20001118/gcc/ssa.c
--- orig/egcs-CVS20001118/gcc/ssa.c	Tue Nov 14 10:27:17 2000
+++ egcs-CVS20001118/gcc/ssa.c	Sat Nov 18 20:27:44 2000
@@ -384,7 +384,7 @@ static hashval_t
 ssa_rename_from_hash_function (srfp)
      const void *srfp;
 {
-  return ((ssa_rename_from_pair *) srfp)->reg;
+  return ((const ssa_rename_from_pair *) srfp)->reg;
 }
 
 /* Test whether two hash table entries SRFP1 and SRFP2 are equal.  */
diff -rup orig/egcs-CVS20001118/gcc/tradcpp.c egcs-CVS20001118/gcc/tradcpp.c
--- orig/egcs-CVS20001118/gcc/tradcpp.c	Sat Nov 18 19:27:41 2000
+++ egcs-CVS20001118/gcc/tradcpp.c	Sat Nov 18 20:37:42 2000
@@ -1359,7 +1359,7 @@ do { ip = &instack[indepth];		\
 	    ibp += 2;
 	  }
 	  c = *ibp++;
-	  if (!isalnum (c) && c != '.' && c != '_') {
+	  if (!ISALNUM (c) && c != '.' && c != '_') {
 	    --ibp;
 	    break;
 	  }
@@ -2888,7 +2888,7 @@ do_line (buf, limit, op, keyword)
   bp = tem.buf;
   SKIP_WHITE_SPACE (bp);
 
-  if (!isdigit (*bp)) {
+  if (!ISDIGIT (*bp)) {
     error ("invalid format #line command");
     return;
   }
@@ -2899,7 +2899,7 @@ do_line (buf, limit, op, keyword)
   new_lineno = atoi ((const char *)bp) - 1;
 
   /* skip over the line number.  */
-  while (isdigit (*bp))
+  while (ISDIGIT (*bp))
     bp++;
 
 #if 0 /* #line 10"foo.c" is supposed to be allowed.  */
@@ -3726,7 +3726,7 @@ macroexpand (hp, op)
 	    /* Escape these chars */
 	    if (c == '\"' || (in_string && c == '\\'))
 	      xbuf[totlen++] = '\\';
-	    if (isprint (c))
+	    if (ISPRINT (c))
 	      xbuf[totlen++] = c;
 	    else {
 	      sprintf ((char *) &xbuf[totlen], "\\%03o", (unsigned int) c);
@@ -3928,7 +3928,7 @@ macarg (argptr)
 	 in case we need to keep it all.  */
       if (c == '\"' || c == '\\') /* escape these chars */
 	totlen++;
-      else if (!isprint (c))
+      else if (!ISPRINT (c))
 	totlen += 3;
     }
     argptr->stringified_length = totlen;
diff -rup orig/egcs-CVS20001118/gcc/varasm.c egcs-CVS20001118/gcc/varasm.c
--- orig/egcs-CVS20001118/gcc/varasm.c	Fri Nov 17 22:53:25 2000
+++ egcs-CVS20001118/gcc/varasm.c	Sat Nov 18 20:22:23 2000
@@ -2402,7 +2402,7 @@ static hashval_t
 const_str_htab_hash (x)
      const void *x;
 {
-  return STRHASH (((struct deferred_string *) x)->label);
+  return STRHASH (((const struct deferred_string *) x)->label);
 }
 
 /* Returns non-zero if the value represented by X (which is really a
@@ -2414,7 +2414,7 @@ const_str_htab_eq (x, y)
      const void *x;
      const void *y;
 {
-  return (((struct deferred_string *) x)->label == (char *) y);
+  return (((const struct deferred_string *) x)->label == (const char *) y);
 }
 
 /* Delete the hash table entry dfsp.  */
@@ -2607,7 +2607,7 @@ compare_constant_1 (exp, p)
       if ((enum machine_mode) *p++ != TYPE_MODE (TREE_TYPE (exp)))
 	return 0;
 
-      strp = (unsigned char *)TREE_STRING_POINTER (exp);
+      strp = (const unsigned char *)TREE_STRING_POINTER (exp);
       len = TREE_STRING_LENGTH (exp);
       if (memcmp ((char *) &TREE_STRING_LENGTH (exp), p,
 		sizeof TREE_STRING_LENGTH (exp)))
@@ -2750,8 +2750,8 @@ compare_constant_1 (exp, p)
 	    return 0;
 
 	/* Compare symbol name.  */
-	strp = (unsigned char *) XSTR (value.base, 0);
-	len = strlen ((char *) strp) + 1;
+	strp = (const unsigned char *) XSTR (value.base, 0);
+	len = strlen ((const char *) strp) + 1;
       }
       break;
 
@@ -2816,7 +2816,7 @@ static void
 record_constant_1 (exp)
      tree exp;
 {
-  register unsigned char *strp;
+  register const unsigned char *strp;
   register int len;
   register enum tree_code code = TREE_CODE (exp);
 
@@ -2841,7 +2841,7 @@ record_constant_1 (exp)
 	return;
 
       obstack_1grow (&permanent_obstack, TYPE_MODE (TREE_TYPE (exp)));
-      strp = (unsigned char *) TREE_STRING_POINTER (exp);
+      strp = (const unsigned char *) TREE_STRING_POINTER (exp);
       len = TREE_STRING_LENGTH (exp);
       obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp),
 		    sizeof TREE_STRING_LENGTH (exp));

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