summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 19:19:42 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 19:19:42 +0000
commitdea3189b45f05f83dc99494d66b5a4311c811ce6 (patch)
tree25657045a0e1f680a00555098079cb87bb9d1384 /gcc
parentaae87fc346d89bc5cf107a45dd5bade361b16533 (diff)
downloadgcc-dea3189b45f05f83dc99494d66b5a4311c811ce6.tar.gz
* 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. 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c12
-rw-r--r--gcc/cselib.c2
-rw-r--r--gcc/gengtype.c8
-rw-r--r--gcc/gengtype.h1
-rw-r--r--gcc/see.c8
-rw-r--r--gcc/tlink.c2
-rw-r--r--gcc/tree-ssa-loop-im.c2
-rw-r--r--gcc/tree-ssa-structalias.c7
10 files changed, 40 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6b01c6a3f17..c1e42ef48dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cc423ede4ed..7b1dc9244d3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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):
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 458d300c331..b8d2b15a083 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 3528efb7e0e..54af8e1bfa8 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -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);
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index d9d942f70a3..f1cc05b95fd 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -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)
diff --git a/gcc/gengtype.h b/gcc/gengtype.h
index a23e2778e93..5fffb7ef2c9 100644
--- a/gcc/gengtype.h
+++ b/gcc/gengtype.h
@@ -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. */
diff --git a/gcc/see.c b/gcc/see.c
index cba0721659d..c58e8dd62e8 100644
--- 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))
diff --git a/gcc/tlink.c b/gcc/tlink.c
index 7907f419488..b6a8a18b532 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -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;
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 0813474b989..76619dd2c5e 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -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);
}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index ddd7de3eb6c..efd39f0b06a 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -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);
}