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]
Other format: [Raw text]

[PATCH]: Add -Wcast-qual to the bootstrap warning flags


This patch eliminates the remaining warnings necessary to allow adding
-Wcast-qual to the bootstrap flags.  Since using "const_" shadow functions
is verboten, some of these can only be fixed using CONST_CAST for now.
Migrating GCC to C++ sources would allow deleting most of these
CONST_CASTs in the future. :-)

(I'm copying the fortran list because there is one gnit fixed there.)

I've seen several -Wcast-qual regressions appear in the last month,
including some new ones in tree-parloops.c and tree-ssa-phiopt.c fixed
below.  So getting this in would be a help keeping the trunk free of these
warnings.

Bootstrapped on sparc-sun-solaris2.10, no regressions.

I also ran this patch through my cross-compile farm building cc1
configured for the following targets:

alpha-dec-osf5.0 arc-unknown-elf arm-unknown-pe avr-unknown-elf
bfin-unknown-elf c4x-unknown-rtems cris-unknown-linux-gnu crx-unknown-elf
fr30-unknown-elf frv-unknown-elf h8300-unknown-rtems hppa1.1-hp-hpux11
i686-pc-linux-gnu ia64-unknown-linux-gnu iq2000-unknown-elf
m32c-unknown-elf m32r-unknown-elf m68hc11-unknown-elf
m68k-unknown-linux-gnu mcore-unknown-elf mips-sgi-irix6.5
mmix-knuth-mmixware mn10300-unknown-elf mt-unknown-elf pdp11-unknown-bsd
powerpc-apple-darwin rs6000-ibm-aix4.3.3.0 s390-unknown-linux-gnu
score-unknown-elf sh-unknown-rtems sparc-sun-solaris2.6 spu-unknown-elf
v850-unknown-elf vax-unknown-ultrix x86_64-unknown-linux-gnu
xstormy16-unknown-elf xtensa-unknown-elf

I found no remaining -Wcast-qual warnings building cc1 to the above
targets.

Okay for mainline?

		Thanks,
		--Kaveh


2007-09-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
	* configure: Regenerate.

gcc:
	* builtins.c (builtin_memcpy_read_str, builtin_memset_gen_str,
	builtin_strncpy_read_str, builtin_memset_read_str,
	builtin_memset_gen_str): Constify.
	(expand_builtin_memcpy, expand_builtin_mempcpy_args,
	expand_builtin_strncpy): Don't cast away const-ness.
	* config/m68k/m68k.c (m68k_handle_option): Avoid -Wcast-qual
	warning.
	* cselib.c (entry_and_rtx_equal_p, rtx_equal_for_cselib_p):
	Constify.
	* cselib.h (rtx_equal_for_cselib_p): Likewise.
	* expr.c (struct store_by_pieces, clear_by_pieces_1,
	can_store_by_pieces, store_by_pieces): Constify.
	(store_expr): Don't cast away const-ness.
	* expr.h (builtin_strncpy_read_str, can_store_by_pieces,
	store_by_pieces): Constify.
	* gengtype.c (read_input_list, adjust_field_type,
	process_gc_options): Avoid -Wcast-qual warning.
	* ggc-common.c (ggc_mark_roots): Likewise.
	* stringpool.c (gt_pch_n_S): Likewise.
	* system.h: Remove #pragma GCC diagnostic warning "-Wcast-qual"
	* tree-parloops.c (name_to_copy_elt_eq, name_to_copy_elt_hash):
	Constify.
	* tree-ssa-phiopt.c (name_to_bb_hash, name_to_bb_eq): Likewise.
	* tree.h (builtin_memset_read_str): Likewise.

gcc/fortran:
	* module.c (mio_expr): Avoid -Wcast-qual warning.

diff -rup orig/egcc-SVN20070919/gcc/builtins.c egcc-SVN20070919/gcc/builtins.c
--- orig/egcc-SVN20070919/gcc/builtins.c	2007-09-17 23:02:35.000000000 -0400
+++ egcc-SVN20070919/gcc/builtins.c	2007-09-20 17:25:54.622179807 -0400
@@ -109,7 +109,7 @@ static rtx expand_builtin_memchr (tree,
 static rtx expand_builtin_memcmp (tree, rtx, enum machine_mode);
 static rtx expand_builtin_strcmp (tree, rtx, enum machine_mode);
 static rtx expand_builtin_strncmp (tree, rtx, enum machine_mode);
-static rtx builtin_memcpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+static rtx builtin_memcpy_read_str (const void *, HOST_WIDE_INT, enum machine_mode);
 static rtx expand_builtin_strcat (tree, tree, rtx, enum machine_mode);
 static rtx expand_builtin_strncat (tree, rtx, enum machine_mode);
 static rtx expand_builtin_strspn (tree, rtx, enum machine_mode);
@@ -126,7 +126,7 @@ static rtx expand_builtin_strcpy (tree,
 static rtx expand_builtin_strcpy_args (tree, tree, tree, rtx, enum machine_mode);
 static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
 static rtx expand_builtin_strncpy (tree, rtx, enum machine_mode);
-static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
+static rtx builtin_memset_gen_str (const void *, HOST_WIDE_INT, enum machine_mode);
 static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
 static rtx expand_builtin_memset_args (tree, tree, tree, rtx, enum machine_mode, tree);
 static rtx expand_builtin_bzero (tree);
@@ -3255,7 +3255,7 @@ expand_builtin_strpbrk (tree exp, rtx ta
    constant.  */

 static rtx
-builtin_memcpy_read_str (void *data, HOST_WIDE_INT offset,
+builtin_memcpy_read_str (const void *data, HOST_WIDE_INT offset,
 			 enum machine_mode mode)
 {
   const char *str = (const char *) data;
@@ -3331,11 +3331,11 @@ expand_builtin_memcpy (tree exp, rtx tar
 	  && GET_CODE (len_rtx) == CONST_INT
 	  && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
 	  && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
-				  (void *) src_str, dest_align, false))
+				  src_str, dest_align, false))
 	{
 	  dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx),
 				      builtin_memcpy_read_str,
-				      (void *) src_str, dest_align, false, 0);
+				      src_str, dest_align, false, 0);
 	  dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
 	  dest_mem = convert_memory_address (ptr_mode, dest_mem);
 	  return dest_mem;
@@ -3444,13 +3444,13 @@ expand_builtin_mempcpy_args (tree dest,
 	  && GET_CODE (len_rtx) == CONST_INT
 	  && (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
 	  && can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
-				  (void *) src_str, dest_align, false))
+				  src_str, dest_align, false))
 	{
 	  dest_mem = get_memory_rtx (dest, len);
 	  set_mem_align (dest_mem, dest_align);
 	  dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx),
 				      builtin_memcpy_read_str,
-				      (void *) src_str, dest_align,
+				      src_str, dest_align,
 				      false, endp);
 	  dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
 	  dest_mem = convert_memory_address (ptr_mode, dest_mem);
@@ -3735,7 +3735,7 @@ expand_builtin_stpcpy (tree exp, rtx tar
    constant.  */

 rtx
-builtin_strncpy_read_str (void *data, HOST_WIDE_INT offset,
+builtin_strncpy_read_str (const void *data, HOST_WIDE_INT offset,
 			  enum machine_mode mode)
 {
   const char *str = (const char *) data;
@@ -3793,13 +3793,13 @@ expand_builtin_strncpy (tree exp, rtx ta
 	  if (!p || dest_align == 0 || !host_integerp (len, 1)
 	      || !can_store_by_pieces (tree_low_cst (len, 1),
 				       builtin_strncpy_read_str,
-				       (void *) p, dest_align, false))
+				       p, dest_align, false))
 	    return NULL_RTX;

 	  dest_mem = get_memory_rtx (dest, len);
 	  store_by_pieces (dest_mem, tree_low_cst (len, 1),
 			   builtin_strncpy_read_str,
-			   (void *) p, dest_align, false, 0);
+			   p, dest_align, false, 0);
 	  dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
 	  dest_mem = convert_memory_address (ptr_mode, dest_mem);
 	  return dest_mem;
@@ -3813,7 +3813,7 @@ expand_builtin_strncpy (tree exp, rtx ta
    constant.  */

 rtx
-builtin_memset_read_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED,
+builtin_memset_read_str (const void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED,
 			 enum machine_mode mode)
 {
   const char *c = (const char *) data;
@@ -3830,22 +3830,23 @@ builtin_memset_read_str (void *data, HOS
    4 bytes wide, return the RTL for 0x01010101*data.  */

 static rtx
-builtin_memset_gen_str (void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED,
+builtin_memset_gen_str (const void *data, HOST_WIDE_INT offset ATTRIBUTE_UNUSED,
 			enum machine_mode mode)
 {
+  rtx x = CONST_CAST_RTX ((const_rtx)data);
   rtx target, coeff;
   size_t size;
   char *p;

   size = GET_MODE_SIZE (mode);
   if (size == 1)
-    return (rtx) data;
+    return x;

   p = alloca (size);
   memset (p, 1, size);
   coeff = c_readstr (p, mode);

-  target = convert_to_mode (mode, (rtx) data, 1);
+  target = convert_to_mode (mode, x, 1);
   target = expand_mult (mode, target, coeff, NULL_RTX, 1);
   return force_reg (mode, target);
 }
diff -rup orig/egcc-SVN20070919/gcc/config/m68k/m68k.c egcc-SVN20070919/gcc/config/m68k/m68k.c
--- orig/egcc-SVN20070919/gcc/config/m68k/m68k.c	2007-09-19 23:02:42.000000000 -0400
+++ egcc-SVN20070919/gcc/config/m68k/m68k.c	2007-09-20 23:10:51.111128161 -0400
@@ -456,7 +456,8 @@ m68k_handle_option (size_t code, const c
 	error ("-mshared-library-id=%s is not between 0 and %d",
 	       arg, MAX_LIBRARY_ID);
       else
-	asprintf ((char **) &m68k_library_id_string, "%d", (value * -4) - 4);
+	asprintf (CONST_CAST(char **, &m68k_library_id_string),
+		  "%d", (value * -4) - 4);
       return true;

     default:
diff -rup orig/egcc-SVN20070919/gcc/configure.ac egcc-SVN20070919/gcc/configure.ac
--- orig/egcc-SVN20070919/gcc/configure.ac	2007-09-14 23:03:21.000000000 -0400
+++ egcc-SVN20070919/gcc/configure.ac	2007-09-20 17:25:54.649925079 -0400
@@ -320,7 +320,7 @@ AC_CHECK_TYPES([__int64], [AC_CHECK_SIZE
 # So, we only use -pedantic if we can disable those warnings.

 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
-			  -Wmissing-prototypes], [loose_warn])
+			  -Wmissing-prototypes -Wcast-qual], [loose_warn])
 ACX_PROG_CC_WARNING_OPTS([-Wc++-compat], [cxx_compat_warn])
 ACX_PROG_CC_WARNING_OPTS([-Wold-style-definition \
                           -Wmissing-format-attribute], [strict_warn])
diff -rup orig/egcc-SVN20070919/gcc/cselib.c egcc-SVN20070919/gcc/cselib.c
--- orig/egcc-SVN20070919/gcc/cselib.c	2007-08-23 12:12:27.000000000 -0400
+++ egcc-SVN20070919/gcc/cselib.c	2007-09-20 17:25:54.652431354 -0400
@@ -234,8 +234,8 @@ entry_and_rtx_equal_p (const void *entry
 {
   struct elt_loc_list *l;
   const cselib_val *const v = (const cselib_val *) entry;
-  rtx x = (rtx) x_arg;
-  enum machine_mode mode = GET_MODE (x);
+  const_rtx x = (const_rtx) x_arg;
+  const enum machine_mode mode = GET_MODE (x);

   gcc_assert (GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_FIXED
 	      && (mode != VOIDmode || GET_CODE (x) != CONST_DOUBLE));
@@ -401,7 +401,7 @@ cselib_reg_set_mode (const_rtx x)
    our gathered information into account.  */

 int
-rtx_equal_for_cselib_p (rtx x, rtx y)
+rtx_equal_for_cselib_p (const_rtx x, const_rtx y)
 {
   enum rtx_code code;
   const char *fmt;
@@ -409,7 +409,7 @@ rtx_equal_for_cselib_p (rtx x, rtx y)

   if (REG_P (x) || MEM_P (x))
     {
-      cselib_val *e = cselib_lookup (x, GET_MODE (x), 0);
+      cselib_val *e = cselib_lookup (CONST_CAST_RTX(x), GET_MODE (x), 0);

       if (e)
 	x = e->val_rtx;
@@ -417,7 +417,7 @@ rtx_equal_for_cselib_p (rtx x, rtx y)

   if (REG_P (y) || MEM_P (y))
     {
-      cselib_val *e = cselib_lookup (y, GET_MODE (y), 0);
+      cselib_val *e = cselib_lookup (CONST_CAST_RTX(y), GET_MODE (y), 0);

       if (e)
 	y = e->val_rtx;
diff -rup orig/egcc-SVN20070919/gcc/cselib.h egcc-SVN20070919/gcc/cselib.h
--- orig/egcc-SVN20070919/gcc/cselib.h	2007-07-30 12:38:02.000000000 -0400
+++ egcc-SVN20070919/gcc/cselib.h	2007-09-20 17:25:54.653233391 -0400
@@ -66,7 +66,7 @@ extern void cselib_clear_table (void);
 extern void cselib_finish (void);
 extern void cselib_process_insn (rtx);
 extern enum machine_mode cselib_reg_set_mode (const_rtx);
-extern int rtx_equal_for_cselib_p (rtx, rtx);
+extern int rtx_equal_for_cselib_p (const_rtx, const_rtx);
 extern int references_value_p (const_rtx, int);
 extern rtx cselib_expand_value_rtx (rtx, bitmap, int);
 extern rtx cselib_subst_to_values (rtx);
diff -rup orig/egcc-SVN20070919/gcc/expr.c egcc-SVN20070919/gcc/expr.c
--- orig/egcc-SVN20070919/gcc/expr.c	2007-09-16 23:02:55.000000000 -0400
+++ egcc-SVN20070919/gcc/expr.c	2007-09-20 17:25:54.664009565 -0400
@@ -115,8 +115,8 @@ struct store_by_pieces
   int explicit_inc_to;
   unsigned HOST_WIDE_INT len;
   HOST_WIDE_INT offset;
-  rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode);
-  void *constfundata;
+  rtx (*constfun) (const void *, HOST_WIDE_INT, enum machine_mode);
+  const void *constfundata;
   int reverse;
 };

@@ -129,7 +129,7 @@ static bool block_move_libcall_safe_for_
 static bool emit_block_move_via_movmem (rtx, rtx, rtx, unsigned, unsigned, HOST_WIDE_INT);
 static tree emit_block_move_libcall_fn (int);
 static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned);
-static rtx clear_by_pieces_1 (void *, HOST_WIDE_INT, enum machine_mode);
+static rtx clear_by_pieces_1 (const void *, HOST_WIDE_INT, enum machine_mode);
 static void clear_by_pieces (rtx, unsigned HOST_WIDE_INT, unsigned int);
 static void store_by_pieces_1 (struct store_by_pieces *, unsigned int);
 static void store_by_pieces_2 (rtx (*) (rtx, ...), enum machine_mode,
@@ -2222,8 +2222,8 @@ use_group_regs (rtx *call_fusage, rtx re

 int
 can_store_by_pieces (unsigned HOST_WIDE_INT len,
-		     rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
-		     void *constfundata, unsigned int align, bool memsetp)
+		     rtx (*constfun) (const void *, HOST_WIDE_INT, enum machine_mode),
+		     const void *constfundata, unsigned int align, bool memsetp)
 {
   unsigned HOST_WIDE_INT l;
   unsigned int max_size;
@@ -2321,8 +2321,8 @@ can_store_by_pieces (unsigned HOST_WIDE_

 rtx
 store_by_pieces (rtx to, unsigned HOST_WIDE_INT len,
-		 rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
-		 void *constfundata, unsigned int align, bool memsetp, int endp)
+		 rtx (*constfun) (const void *, HOST_WIDE_INT, enum machine_mode),
+		 const void *constfundata, unsigned int align, bool memsetp, int endp)
 {
   struct store_by_pieces data;

@@ -2392,7 +2392,7 @@ clear_by_pieces (rtx to, unsigned HOST_W
    Return const0_rtx unconditionally.  */

 static rtx
-clear_by_pieces_1 (void *data ATTRIBUTE_UNUSED,
+clear_by_pieces_1 (const void *data ATTRIBUTE_UNUSED,
 		   HOST_WIDE_INT offset ATTRIBUTE_UNUSED,
 		   enum machine_mode mode ATTRIBUTE_UNUSED)
 {
@@ -4529,7 +4529,7 @@ store_expr (tree exp, rtx target, int ca
 	}
       str_copy_len = MIN (str_copy_len, exp_len);
       if (!can_store_by_pieces (str_copy_len, builtin_strncpy_read_str,
-				(void *) TREE_STRING_POINTER (exp),
+				TREE_STRING_POINTER (exp),
 				MEM_ALIGN (target), false))
 	goto normal_expr;

@@ -4537,7 +4537,7 @@ store_expr (tree exp, rtx target, int ca

       dest_mem = store_by_pieces (dest_mem,
 				  str_copy_len, builtin_strncpy_read_str,
-				  (void *) TREE_STRING_POINTER (exp),
+				  TREE_STRING_POINTER (exp),
 				  MEM_ALIGN (target), false,
 				  exp_len > str_copy_len ? 1 : 0);
       if (exp_len > str_copy_len)
diff -rup orig/egcc-SVN20070919/gcc/expr.h egcc-SVN20070919/gcc/expr.h
--- orig/egcc-SVN20070919/gcc/expr.h	2007-08-27 23:03:15.000000000 -0400
+++ egcc-SVN20070919/gcc/expr.h	2007-09-20 17:25:54.666100781 -0400
@@ -348,7 +348,7 @@ extern void expand_builtin_setjmp_setup
 extern void expand_builtin_setjmp_receiver (rtx);
 extern rtx expand_builtin_saveregs (void);
 extern void expand_builtin_trap (void);
-extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+extern rtx builtin_strncpy_read_str (const void *, HOST_WIDE_INT, enum machine_mode);

 /* Functions from expr.c:  */

@@ -455,9 +455,9 @@ extern int can_move_by_pieces (unsigned
    MEMSETP is true if this is a real memset/bzero, not a copy
    of a const string.  */
 extern int can_store_by_pieces (unsigned HOST_WIDE_INT,
-				rtx (*) (void *, HOST_WIDE_INT,
+				rtx (*) (const void *, HOST_WIDE_INT,
 					 enum machine_mode),
-				void *, unsigned int, bool);
+				const void *, unsigned int, bool);

 /* Generate several move instructions to store LEN bytes generated by
    CONSTFUN to block TO.  (A MEM rtx with BLKmode).  CONSTFUNDATA is a
@@ -466,8 +466,8 @@ extern int can_store_by_pieces (unsigned
    MEMSETP is true if this is a real memset/bzero, not a copy.
    Returns TO + LEN.  */
 extern rtx store_by_pieces (rtx, unsigned HOST_WIDE_INT,
-			    rtx (*) (void *, HOST_WIDE_INT, enum machine_mode),
-			    void *, unsigned int, bool, int);
+			    rtx (*) (const void *, HOST_WIDE_INT, enum machine_mode),
+			    const void *, unsigned int, bool, int);

 /* Emit insns to set X from Y.  */
 extern rtx emit_move_insn (rtx, rtx);
diff -rup orig/egcc-SVN20070919/gcc/fortran/module.c egcc-SVN20070919/gcc/fortran/module.c
--- orig/egcc-SVN20070919/gcc/fortran/module.c	2007-08-26 23:02:43.000000000 -0400
+++ egcc-SVN20070919/gcc/fortran/module.c	2007-09-23 10:28:33.513877809 -0400
@@ -2813,7 +2813,7 @@ mio_expr (gfc_expr **ep)

     case EXPR_SUBSTRING:
       e->value.character.string
-	= (char *) mio_allocated_string (e->value.character.string);
+	= CONST_CAST (char *, mio_allocated_string (e->value.character.string));
       mio_ref_list (&e->ref);
       break;

@@ -2848,7 +2848,7 @@ mio_expr (gfc_expr **ep)
 	case BT_CHARACTER:
 	  mio_integer (&e->value.character.length);
 	  e->value.character.string
-	    = (char *) mio_allocated_string (e->value.character.string);
+	    = CONST_CAST (char *, mio_allocated_string (e->value.character.string));
 	  break;

 	default:
diff -rup orig/egcc-SVN20070919/gcc/gengtype.c egcc-SVN20070919/gcc/gengtype.c
--- orig/egcc-SVN20070919/gcc/gengtype.c	2007-08-06 20:02:28.000000000 -0400
+++ egcc-SVN20070919/gcc/gengtype.c	2007-09-20 17:25:54.669989759 -0400
@@ -433,7 +433,7 @@ read_input_list (const char *listname)
 				     : lang_dir_names[langno - 1]);

 		    bmap |= curlangs;
-		    set_lang_bitmap ((char *)gt_files[i], bmap);
+		    set_lang_bitmap (CONST_CAST (char *, gt_files[i]), bmap);
 		    here = committed;
 		    goto next_line;
 		  }
@@ -1271,9 +1271,9 @@ adjust_field_type (type_p t, options_p o
 	if (params[num] != NULL)
 	  error_at_line (&lexer_line, "duplicate `%s' option", opt->name);
 	if (! ISDIGIT (opt->name[5]))
-	  params[num] = create_pointer ((type_p) opt->info);
+	  params[num] = create_pointer ((type_p)CONST_CAST (char *, opt->info));
 	else
-	  params[num] = (type_p) opt->info;
+	  params[num] = (type_p)CONST_CAST (char *, opt->info);
       }
     else if (strcmp (opt->name, "special") == 0)
       {
@@ -1322,7 +1322,8 @@ process_gc_options (options_p opt, enum
   options_p o;
   for (o = opt; o; o = o->next)
     if (strcmp (o->name, "ptr_alias") == 0 && level == GC_POINTED_TO)
-      set_gc_used_type ((type_p) o->info, GC_POINTED_TO, NULL);
+      set_gc_used_type ((type_p)CONST_CAST (char *, o->info),
+			GC_POINTED_TO, NULL);
     else if (strcmp (o->name, "maybe_undef") == 0)
       *maybe_undef = 1;
     else if (strcmp (o->name, "use_params") == 0)
diff -rup orig/egcc-SVN20070919/gcc/ggc-common.c egcc-SVN20070919/gcc/ggc-common.c
--- orig/egcc-SVN20070919/gcc/ggc-common.c	2007-08-25 11:25:45.000000000 -0400
+++ egcc-SVN20070919/gcc/ggc-common.c	2007-09-20 17:25:54.672241222 -0400
@@ -125,7 +125,8 @@ ggc_mark_roots (void)
       if (*cti->base)
 	{
 	  ggc_set_mark (*cti->base);
-	  htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti);
+	  htab_traverse_noresize (*cti->base, ggc_htab_delete,
+				  CONST_CAST (struct ggc_cache_tab *, cti));
 	  ggc_set_mark ((*cti->base)->entries);
 	}
 }
diff -rup orig/egcc-SVN20070919/gcc/stringpool.c egcc-SVN20070919/gcc/stringpool.c
--- orig/egcc-SVN20070919/gcc/stringpool.c	2007-07-26 23:03:59.000000000 -0400
+++ egcc-SVN20070919/gcc/stringpool.c	2007-09-20 17:25:54.673047819 -0400
@@ -197,8 +197,8 @@ gt_pch_p_S (void *obj ATTRIBUTE_UNUSED,
 void
 gt_pch_n_S (const void *x)
 {
-  gt_pch_note_object ((void *)x, (void *)x, &gt_pch_p_S,
-		      gt_types_enum_last);
+  gt_pch_note_object (CONST_CAST(void *, x), CONST_CAST(void *, x),
+		      &gt_pch_p_S, gt_types_enum_last);
 }

 /* Handle saving and restoring the string pool for PCH.  */
diff -rup orig/egcc-SVN20070919/gcc/system.h egcc-SVN20070919/gcc/system.h
--- orig/egcc-SVN20070919/gcc/system.h	2007-09-03 13:22:09.000000000 -0400
+++ egcc-SVN20070919/gcc/system.h	2007-09-20 17:25:54.674382041 -0400
@@ -793,9 +793,4 @@ extern void fancy_abort (const char *, i
 #define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X))
 #define CONST_CAST_BB(X) CONST_CAST(struct basic_block_def *, (X))

-/* Activate -Wcast-qual as a warning (not an error/-Werror).  */
-#if GCC_VERSION >= 4003
-#pragma GCC diagnostic warning "-Wcast-qual"
-#endif
-
 #endif /* ! GCC_SYSTEM_H */
diff -rup orig/egcc-SVN20070919/gcc/tree-parloops.c egcc-SVN20070919/gcc/tree-parloops.c
--- orig/egcc-SVN20070919/gcc/tree-parloops.c	2007-09-15 23:02:52.000000000 -0400
+++ egcc-SVN20070919/gcc/tree-parloops.c	2007-09-20 17:25:54.676054598 -0400
@@ -80,8 +80,10 @@ struct name_to_copy_elt
 static int
 name_to_copy_elt_eq (const void *aa, const void *bb)
 {
-  struct name_to_copy_elt *a = (struct name_to_copy_elt *) aa;
-  struct name_to_copy_elt *b = (struct name_to_copy_elt *) bb;
+  const struct name_to_copy_elt *const a
+    = (const struct name_to_copy_elt *) aa;
+  const struct name_to_copy_elt *const b
+    = (const struct name_to_copy_elt *) bb;

   return a->version == b->version;
 }
@@ -89,7 +91,8 @@ name_to_copy_elt_eq (const void *aa, con
 static hashval_t
 name_to_copy_elt_hash (const void *aa)
 {
-  struct name_to_copy_elt *a = (struct name_to_copy_elt *) aa;
+  const struct name_to_copy_elt *const a
+    = (const struct name_to_copy_elt *) aa;

   return (hashval_t) a->version;
 }
diff -rup orig/egcc-SVN20070919/gcc/tree-ssa-phiopt.c egcc-SVN20070919/gcc/tree-ssa-phiopt.c
--- orig/egcc-SVN20070919/gcc/tree-ssa-phiopt.c	2007-09-10 23:06:02.000000000 -0400
+++ egcc-SVN20070919/gcc/tree-ssa-phiopt.c	2007-09-20 17:25:54.677829879 -0400
@@ -1101,7 +1101,7 @@ static struct pointer_set_t *nontrap_set
 static hashval_t
 name_to_bb_hash (const void *p)
 {
-  tree n = ((struct name_to_bb *)p)->ssa_name;
+  const_tree const n = ((const struct name_to_bb *)p)->ssa_name;
   return htab_hash_pointer (n);
 }

@@ -1110,8 +1110,8 @@ name_to_bb_hash (const void *p)
 static int
 name_to_bb_eq (const void *p1, const void *p2)
 {
-  tree n1 = ((struct name_to_bb *)p1)->ssa_name;
-  tree n2 = ((struct name_to_bb *)p2)->ssa_name;
+  const_tree const n1 = ((const struct name_to_bb *)p1)->ssa_name;
+  const_tree const n2 = ((const struct name_to_bb *)p2)->ssa_name;

   return n1 == n2;
 }
diff -rup orig/egcc-SVN20070919/gcc/tree.h egcc-SVN20070919/gcc/tree.h
--- orig/egcc-SVN20070919/gcc/tree.h	2007-09-12 23:05:00.000000000 -0400
+++ egcc-SVN20070919/gcc/tree.h	2007-09-20 17:25:54.683922318 -0400
@@ -4847,7 +4847,7 @@ extern tree std_gimplify_va_arg_expr (tr
 extern tree build_va_arg_indirect_ref (tree);
 extern tree build_string_literal (int, const char *);
 extern bool validate_arglist (const_tree, ...);
-extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
+extern rtx builtin_memset_read_str (const void *, HOST_WIDE_INT, enum machine_mode);
 extern int get_pointer_alignment (tree, unsigned int);

 /* In convert.c */


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