OSDN Git Service

* cselib.c (entry_and_rtx_equal_p): Constify.
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jul 2007 19:19:42 +0000 (19:19 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jul 2007 19:19:42 +0000 (19:19 +0000)
* gengtype.c (output_mangled_typename, write_types, write_local):
Likewise.
* gengtype.h (const_type_p): New.
* see.c (eq_descriptor_extension, hash_descriptor_extension):
Constify.
* tlink.c (scan_linker_output): De-constify.
* tree-ssa-loop-im.c (memref_eq): Constify.
* tree-ssa-structalias.c (const_shared_bitmap_info_t): New.
(shared_bitmap_hash, shared_bitmap_eq): Constify.

cp:
* parser.c (cp_parser_string_literal, cp_parser_sizeof_operand):
Constify.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126926 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cselib.c
gcc/gengtype.c
gcc/gengtype.h
gcc/see.c
gcc/tlink.c
gcc/tree-ssa-loop-im.c
gcc/tree-ssa-structalias.c

index 6b01c6a..c1e42ef 100644 (file)
@@ -1,5 +1,18 @@
 2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
+       * cselib.c (entry_and_rtx_equal_p): Constify.
+       * gengtype.c (output_mangled_typename, write_types, write_local):
+       Likewise.
+       * gengtype.h (const_type_p): New.
+       * see.c (eq_descriptor_extension, hash_descriptor_extension):
+       Constify.
+       * tlink.c (scan_linker_output): De-constify.
+       * tree-ssa-loop-im.c (memref_eq): Constify.
+       * tree-ssa-structalias.c (const_shared_bitmap_info_t): New.
+       (shared_bitmap_hash, shared_bitmap_eq): Constify.
+
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
        * c-common.c (fname_as_string, c_type_hash): Constify.
        * c-typeck.c (free_all_tagged_tu_seen_up_to): Likewise.
        * cgraph.c (edge_hash, edge_eq): Likewise.
index cc423ed..7b1dc92 100644 (file)
@@ -1,5 +1,10 @@
 2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
+       * parser.c (cp_parser_string_literal, cp_parser_sizeof_operand):
+       Constify.
+
+2007-07-25  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
        * decl.c (typename_hash, typename_compare): Constify.
        * mangle.c (hash_type, compare_type): Likewise.
        * pt.c (eq_local_specializations, hash_local_specialization):
index 458d300..b8d2b15 100644 (file)
@@ -2896,7 +2896,7 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
        {
          cp_lexer_consume_token (parser->lexer);
          count++;
-         str.text = (unsigned char *)TREE_STRING_POINTER (tok->u.value);
+         str.text = (const unsigned char *)TREE_STRING_POINTER (tok->u.value);
          str.len = TREE_STRING_LENGTH (tok->u.value);
          if (tok->type == CPP_WSTRING)
            wide = true;
@@ -17111,6 +17111,7 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
   static const char *format;
   tree expr = NULL_TREE;
   const char *saved_message;
+  char *tmp;
   bool saved_integral_constant_expression_p;
   bool saved_non_integral_constant_expression_p;
   bool pack_expansion_p = false;
@@ -17123,12 +17124,11 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
      old message.  */
   saved_message = parser->type_definition_forbidden_message;
   /* And create the new one.  */
-  parser->type_definition_forbidden_message
-    = XNEWVEC (const char, strlen (format)
+  parser->type_definition_forbidden_message = tmp
+    = XNEWVEC (char, strlen (format)
               + strlen (IDENTIFIER_POINTER (ridpointers[keyword]))
               + 1 /* `\0' */);
-  sprintf ((char *) parser->type_definition_forbidden_message,
-          format, IDENTIFIER_POINTER (ridpointers[keyword]));
+  sprintf (tmp, format, IDENTIFIER_POINTER (ridpointers[keyword]));
 
   /* The restrictions on constant-expressions do not apply inside
      sizeof expressions.  */
@@ -17204,7 +17204,7 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
   --skip_evaluation;
 
   /* Free the message we created.  */
-  free ((char *) parser->type_definition_forbidden_message);
+  free (tmp);
   /* And restore the old one.  */
   parser->type_definition_forbidden_message = saved_message;
   parser->integral_constant_expression_p
index 3528efb..54af8e1 100644 (file)
@@ -234,7 +234,7 @@ static int
 entry_and_rtx_equal_p (const void *entry, const void *x_arg)
 {
   struct elt_loc_list *l;
-  const cselib_val *v = (const cselib_val *) entry;
+  const cselib_val *const v = (const cselib_val *) entry;
   rtx x = (rtx) x_arg;
   enum machine_mode mode = GET_MODE (x);
 
index d9d942f..f1cc05b 100644 (file)
@@ -1751,7 +1751,7 @@ struct write_types_data
 
 static void output_escaped_param (struct walk_type_data *d,
                                  const char *, const char *);
-static void output_mangled_typename (outf_p, type_p);
+static void output_mangled_typename (outf_p, const_type_p);
 static void walk_type (type_p t, struct walk_type_data *d);
 static void write_func_for_structure
      (type_p orig_s, type_p s, type_p * param,
@@ -1804,7 +1804,7 @@ struct walk_type_data
 /* Print a mangled name representing T to OF.  */
 
 static void
-output_mangled_typename (outf_p of, type_p t)
+output_mangled_typename (outf_p of, const_type_p t)
 {
   if (t == NULL)
     oprintf (of, "Z");
@@ -2580,7 +2580,7 @@ write_types (type_p structures, type_p param_structs,
        for (opt = s->u.s.opt; opt; opt = opt->next)
          if (strcmp (opt->name, "ptr_alias") == 0)
            {
-             type_p t = (type_p) opt->info;
+             const_type_p const t = (const_type_p) opt->info;
              if (t->kind == TYPE_STRUCT
                  || t->kind == TYPE_UNION
                  || t->kind == TYPE_LANG_STRUCT)
@@ -2759,7 +2759,7 @@ write_local (type_p structures, type_p param_structs)
        for (opt = s->u.s.opt; opt; opt = opt->next)
          if (strcmp (opt->name, "ptr_alias") == 0)
            {
-             type_p t = (type_p) opt->info;
+             const_type_p const t = (const_type_p) opt->info;
              if (t->kind == TYPE_STRUCT
                  || t->kind == TYPE_UNION
                  || t->kind == TYPE_LANG_STRUCT)
index a23e277..5fffb7e 100644 (file)
@@ -31,6 +31,7 @@ struct fileloc {
 /* Data types handed around within, but opaque to, the lexer and parser.  */
 typedef struct pair *pair_p;
 typedef struct type *type_p;
+typedef const struct type *const_type_p;
 typedef struct options *options_p;
 
 /* Variables used to communicate between the lexer and the parser.  */
index cba0721..c58e8dd 100644 (file)
--- a/gcc/see.c
+++ b/gcc/see.c
@@ -933,12 +933,12 @@ hash_del_properties (void *p)
 static int
 eq_descriptor_extension (const void *p1, const void *p2)
 {
-  const rtx insn = (rtx) p1;
-  const rtx element = (rtx) p2;
+  const_rtx const insn = (const_rtx) p1;
+  const_rtx const element = (const_rtx) p2;
   rtx set1 = single_set (insn);
   rtx dest_reg1;
   rtx set2 = NULL;
-  rtx dest_reg2 = NULL;
+  const_rtx dest_reg2 = NULL;
 
   gcc_assert (set1 && element && (REG_P (element) || INSN_P (element)));
 
@@ -962,7 +962,7 @@ eq_descriptor_extension (const void *p1, const void *p2)
 static hashval_t
 hash_descriptor_extension (const void *p)
 {
-  const rtx r = (rtx) p;
+  const_rtx const r = (const_rtx) p;
   rtx set, lhs;
 
   if (r && REG_P (r))
index 7907f41..b6a8a18 100644 (file)
@@ -658,7 +658,7 @@ scan_linker_output (const char *fname)
       if (! sym && ! end)
        /* Try a mangled name in quotes.  */
        {
-         const char *oldq = q + 1;
+         char *oldq = q + 1;
          demangled *dem = 0;
          q = 0;
 
index 0813474..76619dd 100644 (file)
@@ -1294,7 +1294,7 @@ memref_hash (const void *obj)
 static int
 memref_eq (const void *obj1, const void *obj2)
 {
-  const struct mem_ref *mem1 = (const struct mem_ref *) obj1;
+  const struct mem_ref *const mem1 = (const struct mem_ref *) obj1;
 
   return operand_equal_p (mem1->mem, (tree) obj2, 0);
 }
index ddd7de3..efd39f0 100644 (file)
@@ -4266,6 +4266,7 @@ typedef struct shared_bitmap_info
   bitmap pt_vars;
   hashval_t hashcode;
 } *shared_bitmap_info_t;
+typedef const struct shared_bitmap_info *const_shared_bitmap_info_t;
 
 static htab_t shared_bitmap_table;
 
@@ -4274,7 +4275,7 @@ static htab_t shared_bitmap_table;
 static hashval_t
 shared_bitmap_hash (const void *p)
 {
-  const shared_bitmap_info_t bi = (shared_bitmap_info_t) p;
+  const_shared_bitmap_info_t const bi = (const_shared_bitmap_info_t) p;
   return bi->hashcode;
 }
 
@@ -4283,8 +4284,8 @@ shared_bitmap_hash (const void *p)
 static int
 shared_bitmap_eq (const void *p1, const void *p2)
 {
-  const shared_bitmap_info_t sbi1 = (shared_bitmap_info_t) p1;
-  const shared_bitmap_info_t sbi2 = (shared_bitmap_info_t) p2;
+  const_shared_bitmap_info_t const sbi1 = (const_shared_bitmap_info_t) p1;
+  const_shared_bitmap_info_t const sbi2 = (const_shared_bitmap_info_t) p2;
   return bitmap_equal_p (sbi1->pt_vars, sbi2->pt_vars);
 }