]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Warning fixes:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sun, 19 Nov 2000 13:15:51 +0000 (13:15 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sun, 19 Nov 2000 13:15:51 +0000 (13:15 +0000)
* 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.

From-SVN: r37565

gcc/ChangeLog
gcc/builtins.c
gcc/config/sparc/gmon-sol2.c
gcc/conflict.c
gcc/cppmacro.c
gcc/dwarf2out.c
gcc/fix-header.c
gcc/protoize.c
gcc/ssa.c
gcc/tradcpp.c
gcc/varasm.c

index 1e26641cb4352041f90e7f9dff2a0af0a707c997..7788cd03504cdd5e9c40495ef6a5d21402d32270 100644 (file)
@@ -1,3 +1,20 @@
+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.
+
 2000-11-18  Richard Henderson  <rth@redhat.com>
 
        * c-decl.c (grokdeclarator): Special case the creation of an
index ec12cae98ce2667d3d98bbf1ade1b3124ea13550..221cba6f34b0c16161ae9978da5b3550e32cd29c 100644 (file)
@@ -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
index 1e5f0da94672371170a9ecd45591e12de3b94372..6d6696644d9108d90357d1eb0f4340533c5e52e0 100644 (file)
@@ -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;
index d467ba1b87ae2a486a323a773bc42407a266b555..c233d234bb8df57a4bb57af1726e058828071833 100644 (file)
@@ -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;
 }
index fcaa7c6df6a3055e5888bbf4f9d0ccbb6e5175f7..978f4cbd804aa96a82aac395f35db1806a06da72 100644 (file)
@@ -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;
        
index dba0147989411b4897dd8e4af6182ed0555c2860..6ddd9824d16f5243b3b6726b781ddf7348589a8c 100644 (file)
@@ -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);
index 3741a1383335d0eace72cfa9c7f91c889b89c79a..be377de6b7acdaacbdf7d360aa51984a8dce80fa 100644 (file)
@@ -77,7 +77,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #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;
index 580fa146305508882c9939b9bcefe91a7bd94068..6816952ef09ed30835a66a1be644806252238a3b 100644 (file)
@@ -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
index 3dabc626a14007d5329dd41b1bea5984e0acf8e3..d57720e032f9f76a47d09591045457d1b3ad3f0b 100644 (file)
--- a/gcc/ssa.c
+++ b/gcc/ssa.c
@@ -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.  */
index 3e4955fb40108838a28fde9a78f6a32896a35e57..1117748fb1abff2b7f2262b05ffb5eeadbcec264 100644 (file)
@@ -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;
index 8faedda980f303d7652277767d2819911fad009d..170cf09ab1ccd9b979f5271d275152f4bd702bda 100644 (file)
@@ -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));