diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-16 14:31:21 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-16 14:31:21 +0000 |
commit | f8fd23c043e25507321039cc26eaa28d6d1f63f1 (patch) | |
tree | 2a4c83e4c3dac3f7576d39fb5f61a4955aed2c98 | |
parent | 45b13dc38650fb0f8deecf944c6837637927102e (diff) | |
download | gcc-f8fd23c043e25507321039cc26eaa28d6d1f63f1.tar.gz |
* c-common.c (const_strip_array_types): New.
* c-common.h (lang_missing_noreturn_ok_p): Delete.
(const_strip_array_types): New.
* c-objc-common.c (c_disregard_inline_limits,
c_warn_unused_global_decl): Constify.
* c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl,
c_vla_type_p, c_incomplete_type_error): Likewise.
* c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise.
* hooks.c (hook_bool_const_tree_false): New.
* hooks.h (hook_bool_const_tree_false): Likewise.
* langhooks-def.h (lhd_warn_unused_global_decl,
lhd_incomplete_type_error, lhd_expr_size,
lhd_tree_inlining_disregard_inline_limits,
lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals,
LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify.
* langhooks.c (lhd_warn_unused_global_decl,
lhd_incomplete_type_error,
lhd_tree_inlining_disregard_inline_limits,
lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals,
lhd_expr_size): Likewise.
* langhooks.h (lang_hooks_for_tree_inlining,
lang_hooks_for_tree_dump, lang_hooks_for_types,
lang_hooks_for_decls, lang_hooks): Likewise.
* pointer-set.c (pointer_set_t, pointer_set_create,
pointer_set_contains, insert_aux, pointer_set_insert,
pointer_set_traverse, pointer_map_t, pointer_map_create,
pointer_map_contains, pointer_map_insert, pointer_map_traverse):
Likewise.
* pointer-set.h (pointer_set_contains, pointer_set_insert,
pointer_set_traverse, pointer_map_contains, pointer_map_insert,
pointer_map_traverse): Likewise.
* predict.c (assert_is_empty): Likewise.
* tree-affine.c (free_name_expansion): Likewise.
* tree-cfg.c (edge_to_cases_cleanup): Likewise.
* tree.c (size_in_bytes, max_int_size_in_bytes): Likewise.
* tree.h (size_in_bytes, max_int_size_in_bytes): Likewise.
ada:
* misc.c (gnat_type_max_size): Constify.
cp:
* cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size):
Constify.
* cp-tree.h (local_variable_p, nonstatic_local_decl_p,
class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals,
cxx_incomplete_type_diagnostic, cxx_incomplete_type_error,
cxx_warn_unused_global_decl, cp_expr_size): Likewise.
* decl.c (local_variable_p, nonstatic_local_decl_p): Likewise.
* tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise.
* typeck.c (cp_type_quals): Likewise.
* typeck2.c (cxx_incomplete_type_diagnostic,
cxx_incomplete_type_error): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127560 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 39 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/ada/misc.c | 4 | ||||
-rw-r--r-- | gcc/c-common.c | 9 | ||||
-rw-r--r-- | gcc/c-common.h | 5 | ||||
-rw-r--r-- | gcc/c-objc-common.c | 4 | ||||
-rw-r--r-- | gcc/c-tree.h | 8 | ||||
-rw-r--r-- | gcc/c-typeck.c | 4 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 18 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 | ||||
-rw-r--r-- | gcc/hooks.c | 6 | ||||
-rw-r--r-- | gcc/hooks.h | 1 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 16 | ||||
-rw-r--r-- | gcc/langhooks.c | 12 | ||||
-rw-r--r-- | gcc/langhooks.h | 16 | ||||
-rw-r--r-- | gcc/pointer-set.c | 34 | ||||
-rw-r--r-- | gcc/pointer-set.h | 15 | ||||
-rw-r--r-- | gcc/predict.c | 2 | ||||
-rw-r--r-- | gcc/tree-affine.c | 2 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 2 | ||||
-rw-r--r-- | gcc/tree.c | 4 | ||||
-rw-r--r-- | gcc/tree.h | 4 |
27 files changed, 157 insertions, 86 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db120c094c4..05c2b2984be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,42 @@ +2007-08-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * c-common.c (const_strip_array_types): New. + * c-common.h (lang_missing_noreturn_ok_p): Delete. + (const_strip_array_types): New. + * c-objc-common.c (c_disregard_inline_limits, + c_warn_unused_global_decl): Constify. + * c-tree.h (c_disregard_inline_limits, c_warn_unused_global_decl, + c_vla_type_p, c_incomplete_type_error): Likewise. + * c-typeck.c (c_incomplete_type_error, c_vla_type_p): Likewise. + * hooks.c (hook_bool_const_tree_false): New. + * hooks.h (hook_bool_const_tree_false): Likewise. + * langhooks-def.h (lhd_warn_unused_global_decl, + lhd_incomplete_type_error, lhd_expr_size, + lhd_tree_inlining_disregard_inline_limits, + lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, + LANG_HOOKS_GENERIC_TYPE_P, LANG_HOOKS_TYPE_MAX_SIZE): Constify. + * langhooks.c (lhd_warn_unused_global_decl, + lhd_incomplete_type_error, + lhd_tree_inlining_disregard_inline_limits, + lhd_tree_inlining_auto_var_in_fn_p, lhd_tree_dump_type_quals, + lhd_expr_size): Likewise. + * langhooks.h (lang_hooks_for_tree_inlining, + lang_hooks_for_tree_dump, lang_hooks_for_types, + lang_hooks_for_decls, lang_hooks): Likewise. + * pointer-set.c (pointer_set_t, pointer_set_create, + pointer_set_contains, insert_aux, pointer_set_insert, + pointer_set_traverse, pointer_map_t, pointer_map_create, + pointer_map_contains, pointer_map_insert, pointer_map_traverse): + Likewise. + * pointer-set.h (pointer_set_contains, pointer_set_insert, + pointer_set_traverse, pointer_map_contains, pointer_map_insert, + pointer_map_traverse): Likewise. + * predict.c (assert_is_empty): Likewise. + * tree-affine.c (free_name_expansion): Likewise. + * tree-cfg.c (edge_to_cases_cleanup): Likewise. + * tree.c (size_in_bytes, max_int_size_in_bytes): Likewise. + * tree.h (size_in_bytes, max_int_size_in_bytes): Likewise. + 2007-08-16 Victor Kaplansky <victork@il.ibm.com> * tree-vectorizer.c (new_loop_vec_info): Initialize new diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 07e95a684c9..c6f038e2fe3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2007-08-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * misc.c (gnat_type_max_size): Constify. + 2007-08-16 Gary Dismukes <dismukes@adacore.com> * cstand.adb (Create_Standard): Create an entity for a zero-sized type diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index a59b1d0efa8..cad474d2b5f 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -103,7 +103,7 @@ static rtx gnat_expand_expr (tree, rtx, enum machine_mode, int, static void gnat_expand_body (tree); static void internal_error_function (const char *, va_list *); static void gnat_adjust_rli (record_layout_info); -static tree gnat_type_max_size (tree); +static tree gnat_type_max_size (const_tree); /* Definitions for our language-specific hooks. */ @@ -767,7 +767,7 @@ gnat_get_alias_set (tree type) as a constant when possible. */ static tree -gnat_type_max_size (tree gnu_type) +gnat_type_max_size (const_tree gnu_type) { /* First see what we can get from TYPE_SIZE_UNIT, which might not be constant even for simple expressions if it has already been diff --git a/gcc/c-common.c b/gcc/c-common.c index f3bfb3d9f3b..d2ff7b88279 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3912,6 +3912,15 @@ strip_array_types (tree type) return type; } +const_tree +const_strip_array_types (const_tree type) +{ + while (TREE_CODE (type) == ARRAY_TYPE) + type = TREE_TYPE (type); + + return type; +} + /* Recursively remove any '*' or '&' operator from TYPE. */ tree strip_pointer_operator (tree t) diff --git a/gcc/c-common.h b/gcc/c-common.h index 8908327698f..7d4761cd2b4 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -297,10 +297,6 @@ struct c_language_function GTY(()) { /* Language-specific hooks. */ -/* Callback that determines if it's ok for a function to have no - noreturn attribute. */ -extern int (*lang_missing_noreturn_ok_p) (tree); - /* If non-NULL, this function is called after a precompile header file is loaded. */ extern void (*lang_post_pch_load) (void); @@ -735,6 +731,7 @@ extern void c_register_builtin_type (tree, const char*); extern bool c_promoting_integer_type_p (tree); extern int self_promoting_args_p (tree); extern tree strip_array_types (tree); +extern const_tree const_strip_array_types (const_tree); extern tree strip_pointer_operator (tree); extern tree strip_pointer_or_array_types (tree); extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT); diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 9999840800a..58c748cde1d 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -55,7 +55,7 @@ c_missing_noreturn_ok_p (tree decl) such functions always being inlined when optimizing. */ int -c_disregard_inline_limits (tree fn) +c_disregard_inline_limits (const_tree fn) { if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL) return 1; @@ -112,7 +112,7 @@ c_cannot_inline_tree_fn (tree *fnp) /* Called from check_global_declarations. */ bool -c_warn_unused_global_decl (tree decl) +c_warn_unused_global_decl (const_tree decl) { if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)) return false; diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 53b980e713a..ee69b0840f4 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -514,12 +514,12 @@ extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree); extern struct c_declspecs *finish_declspecs (struct c_declspecs *); /* in c-objc-common.c */ -extern int c_disregard_inline_limits (tree); +extern int c_disregard_inline_limits (const_tree); extern int c_cannot_inline_tree_fn (tree *); extern bool c_objc_common_init (void); extern bool c_missing_noreturn_ok_p (tree); extern tree c_objc_common_truthvalue_conversion (tree expr); -extern bool c_warn_unused_global_decl (tree); +extern bool c_warn_unused_global_decl (const_tree); extern void c_initialize_diagnostics (diagnostic_context *); extern bool c_vla_unspec_p (tree x, tree fn); @@ -540,9 +540,9 @@ extern struct c_label_context_vm *label_context_stack_vm; extern tree require_complete_type (tree); extern int same_translation_unit_p (tree, tree); extern int comptypes (tree, tree); -extern bool c_vla_type_p (tree); +extern bool c_vla_type_p (const_tree); extern bool c_mark_addressable (tree); -extern void c_incomplete_type_error (tree, tree); +extern void c_incomplete_type_error (const_tree, const_tree); extern tree c_type_promotes_to (tree); extern struct c_expr default_function_array_conversion (struct c_expr); extern tree composite_type (tree, tree); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 9a63f1ec8ca..d793f72ab59 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -161,7 +161,7 @@ require_complete_type (tree value) and TYPE is the type that was invalid. */ void -c_incomplete_type_error (tree value, tree type) +c_incomplete_type_error (const_tree value, const_tree type) { const char *type_code_string; @@ -256,7 +256,7 @@ qualify_type (tree type, tree like) /* Return true iff the given tree T is a variable length array. */ bool -c_vla_type_p (tree t) +c_vla_type_p (const_tree t) { if (TREE_CODE (t) == ARRAY_TYPE && C_TYPE_VARIABLE_SIZE (t)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6e7bd964f11..c2b043f409f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2007-08-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cp-objcp-common.c (cxx_warn_unused_global_decl, cp_expr_size): + Constify. + * cp-tree.h (local_variable_p, nonstatic_local_decl_p, + class_tmpl_impl_spec_p, cp_auto_var_in_fn_p, cp_type_quals, + cxx_incomplete_type_diagnostic, cxx_incomplete_type_error, + cxx_warn_unused_global_decl, cp_expr_size): Likewise. + * decl.c (local_variable_p, nonstatic_local_decl_p): Likewise. + * tree.c (class_tmpl_impl_spec_p, cp_auto_var_in_fn_p): Likewise. + * typeck.c (cp_type_quals): Likewise. + * typeck2.c (cxx_incomplete_type_diagnostic, + cxx_incomplete_type_error): Likewise. + 2007-08-16 Paolo Carlini <pcarlini@suse.de> PR c++/31132 diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index a4c63f1407a..b83ef363b8d 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -53,7 +53,7 @@ cxx_get_alias_set (tree t) /* Called from check_global_declarations. */ bool -cxx_warn_unused_global_decl (tree decl) +cxx_warn_unused_global_decl (const_tree decl) { if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)) return false; @@ -72,7 +72,7 @@ cxx_warn_unused_global_decl (tree decl) might have allocated something there. */ tree -cp_expr_size (tree exp) +cp_expr_size (const_tree exp) { tree type = TREE_TYPE (exp); diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 9a28ac17cd2..a80fbad1062 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4250,8 +4250,8 @@ extern tree create_implicit_typedef (tree, tree); extern tree maybe_push_decl (tree); extern tree force_target_expr (tree, tree); extern tree build_target_expr_with_type (tree, tree); -extern int local_variable_p (tree); -extern int nonstatic_local_decl_p (tree); +extern int local_variable_p (const_tree); +extern int nonstatic_local_decl_p (const_tree); extern tree register_dtor_fn (tree); extern tmpl_spec_kind current_tmpl_spec_kind (int); extern tree cp_fname_init (const char *, tree *); @@ -4681,7 +4681,7 @@ extern tree add_stmt_to_compound (tree, tree); extern tree cxx_maybe_build_cleanup (tree); extern void init_tree (void); extern int pod_type_p (tree); -extern bool class_tmpl_impl_spec_p (tree); +extern bool class_tmpl_impl_spec_p (const_tree); extern int zero_init_p (tree); extern tree canonical_type_variant (tree); extern tree copy_binfo (tree, tree, tree, @@ -4737,7 +4737,7 @@ extern linkage_kind decl_linkage (tree); extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, void*, struct pointer_set_t*); extern int cp_cannot_inline_tree_fn (tree*); -extern int cp_auto_var_in_fn_p (tree,tree); +extern int cp_auto_var_in_fn_p (const_tree, const_tree); extern tree fold_if_not_in_template (tree); extern tree rvalue (tree); extern tree convert_bitfield_to_declared_type (tree); @@ -4791,7 +4791,7 @@ extern int comp_ptr_ttypes (tree, tree); extern bool comp_ptr_ttypes_const (tree, tree); extern int ptr_reasonably_similar (tree, tree); extern tree build_ptrmemfunc (tree, tree, int, bool); -extern int cp_type_quals (tree); +extern int cp_type_quals (const_tree); extern bool cp_type_readonly (tree); extern bool cp_has_mutable_p (tree); extern bool at_least_as_qualified_p (tree, tree); @@ -4819,9 +4819,9 @@ extern int lvalue_p (tree); /* in typeck2.c */ extern void require_complete_eh_spec_types (tree, tree); -extern void cxx_incomplete_type_diagnostic (tree, tree, int); +extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, int); #undef cxx_incomplete_type_error -extern void cxx_incomplete_type_error (tree, tree); +extern void cxx_incomplete_type_error (const_tree, const_tree); #define cxx_incomplete_type_error(V,T) \ (cxx_incomplete_type_diagnostic ((V), (T), 0)) extern tree error_not_base_type (tree, tree); @@ -4859,8 +4859,8 @@ extern bool cp_dump_tree (void *, tree); /* In cp/cp-objcp-common.c. */ extern alias_set_type cxx_get_alias_set (tree); -extern bool cxx_warn_unused_global_decl (tree); -extern tree cp_expr_size (tree); +extern bool cxx_warn_unused_global_decl (const_tree); +extern tree cp_expr_size (const_tree); extern size_t cp_tree_size (enum tree_code); extern bool cp_var_mod_type_p (tree, tree); extern void cxx_initialize_diagnostics (struct diagnostic_context *); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b04fda369ef..6172296d73f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8962,7 +8962,7 @@ require_complete_types_for_parms (tree parms) /* Returns nonzero if T is a local variable. */ int -local_variable_p (tree t) +local_variable_p (const_tree t) { if ((TREE_CODE (t) == VAR_DECL /* A VAR_DECL with a context that is a _TYPE is a static data @@ -8981,7 +8981,7 @@ local_variable_p (tree t) containing them is duplicated.) */ int -nonstatic_local_decl_p (tree t) +nonstatic_local_decl_p (const_tree t) { return ((local_variable_p (t) && !TREE_STATIC (t)) || TREE_CODE (t) == LABEL_DECL diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 081a4544f9d..792f1fd0909 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2077,7 +2077,7 @@ pod_type_p (tree t) /* Nonzero iff type T is a class template implicit specialization. */ bool -class_tmpl_impl_spec_p (tree t) +class_tmpl_impl_spec_p (const_tree t) { return CLASS_TYPE_P (t) && CLASSTYPE_TEMPLATE_INSTANTIATION (t); } @@ -2453,7 +2453,7 @@ cp_cannot_inline_tree_fn (tree* fnp) function FN. */ int -cp_auto_var_in_fn_p (tree var, tree fn) +cp_auto_var_in_fn_p (const_tree var, const_tree fn) { return (DECL_P (var) && DECL_CONTEXT (var) == fn && nonstatic_local_decl_p (var)); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index a79f6e2dd46..b4d70162d9d 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6910,9 +6910,9 @@ comp_ptr_ttypes_const (tree to, tree from) elements for an array type. */ int -cp_type_quals (tree type) +cp_type_quals (const_tree type) { - type = strip_array_types (type); + type = const_strip_array_types (type); if (type == error_mark_node) return TYPE_UNQUALIFIED; return TYPE_QUALS (type); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index f1c3c3258cf..53e22023f27 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -336,7 +336,7 @@ abstract_virtuals_error (tree decl, tree type) pedwarn. */ void -cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) +cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type) { int decl = 0; void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2); @@ -427,7 +427,7 @@ cxx_incomplete_type_diagnostic (tree value, tree type, int diag_type) required by ../tree.c. */ #undef cxx_incomplete_type_error void -cxx_incomplete_type_error (tree value, tree type) +cxx_incomplete_type_error (const_tree value, const_tree type) { cxx_incomplete_type_diagnostic (value, type, 0); } diff --git a/gcc/hooks.c b/gcc/hooks.c index adfa3d4b8f3..c101d3ca81d 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -190,6 +190,12 @@ hook_bool_tree_false (tree a ATTRIBUTE_UNUSED) } bool +hook_bool_const_tree_false (const_tree a ATTRIBUTE_UNUSED) +{ + return false; +} + +bool hook_bool_tree_true (tree a ATTRIBUTE_UNUSED) { return true; diff --git a/gcc/hooks.h b/gcc/hooks.h index 35a62ea9a5c..6000cbb3344 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -31,6 +31,7 @@ extern bool hook_bool_mode_false (enum machine_mode); extern bool hook_bool_mode_rtx_false (enum machine_mode, rtx); extern bool hook_bool_mode_rtx_true (enum machine_mode, rtx); extern bool hook_bool_tree_false (tree); +extern bool hook_bool_const_tree_false (const_tree); extern bool hook_bool_tree_true (tree); extern bool hook_bool_tree_hwi_hwi_tree_false (tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 0866a4c9bda..41bf8e8363d 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -55,13 +55,13 @@ extern int lhd_expand_decl (tree); extern void lhd_print_error_function (struct diagnostic_context *, const char *); extern void lhd_set_decl_assembler_name (tree); -extern bool lhd_warn_unused_global_decl (tree); -extern void lhd_incomplete_type_error (tree, tree); +extern bool lhd_warn_unused_global_decl (const_tree); +extern void lhd_incomplete_type_error (const_tree, const_tree); extern tree lhd_type_promotes_to (tree); extern void lhd_register_builtin_type (tree, const char *); extern bool lhd_decl_ok_for_sibcall (tree); extern const char *lhd_comdat_group (tree); -extern tree lhd_expr_size (tree); +extern tree lhd_expr_size (const_tree); extern size_t lhd_tree_size (enum tree_code); extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT); extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *); @@ -71,8 +71,8 @@ extern tree lhd_builtin_function (tree decl); extern tree lhd_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn, void *, struct pointer_set_t*); extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *); -extern int lhd_tree_inlining_disregard_inline_limits (tree); -extern int lhd_tree_inlining_auto_var_in_fn_p (tree, tree); +extern int lhd_tree_inlining_disregard_inline_limits (const_tree); +extern int lhd_tree_inlining_auto_var_in_fn_p (const_tree, const_tree); extern void lhd_initialize_diagnostics (struct diagnostic_context *); extern tree lhd_callgraph_analyze_expr (tree *, int *, tree); @@ -175,7 +175,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, /* Tree dump hooks. */ extern bool lhd_tree_dump_dump_tree (void *, tree); -extern int lhd_tree_dump_type_quals (tree); +extern int lhd_tree_dump_type_quals (const_tree); extern tree lhd_make_node (enum tree_code); #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree @@ -190,10 +190,10 @@ extern tree lhd_make_node (enum tree_code); so we create a compile-time error instead. */ #define LANG_HOOKS_MAKE_TYPE lhd_make_node #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error -#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_tree_false +#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false #define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type -#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree +#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree #define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \ lhd_omp_firstprivatize_type_sizes #define LANG_HOOKS_HASH_TYPES true diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 1c9a6132c5e..1074615c72f 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -136,7 +136,7 @@ lhd_staticp (tree ARG_UNUSED (exp)) /* Called from check_global_declarations. */ bool -lhd_warn_unused_global_decl (tree decl) +lhd_warn_unused_global_decl (const_tree decl) { /* This is what used to exist in check_global_declarations. Probably not many of these actually apply to non-C languages. */ @@ -209,7 +209,7 @@ lhd_register_builtin_type (tree ARG_UNUSED (type), /* Invalid use of an incomplete type. */ void -lhd_incomplete_type_error (tree ARG_UNUSED (value), tree type) +lhd_incomplete_type_error (const_tree ARG_UNUSED (value), const_tree type) { gcc_assert (TREE_CODE (type) == ERROR_MARK); return; @@ -316,7 +316,7 @@ lhd_tree_inlining_cannot_inline_tree_fn (tree *fnp) if it would exceed inlining limits. */ int -lhd_tree_inlining_disregard_inline_limits (tree fn) +lhd_tree_inlining_disregard_inline_limits (const_tree fn) { if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL) return 1; @@ -328,7 +328,7 @@ lhd_tree_inlining_disregard_inline_limits (tree fn) whether VT is an automatic variable defined in function FT. */ int -lhd_tree_inlining_auto_var_in_fn_p (tree var, tree fn) +lhd_tree_inlining_auto_var_in_fn_p (const_tree var, const_tree fn) { return (DECL_P (var) && DECL_CONTEXT (var) == fn && (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL) @@ -351,7 +351,7 @@ lhd_tree_dump_dump_tree (void *di ATTRIBUTE_UNUSED, tree t ATTRIBUTE_UNUSED) language-specific way. */ int -lhd_tree_dump_type_quals (tree t) +lhd_tree_dump_type_quals (const_tree t) { return TYPE_QUALS (t); } @@ -360,7 +360,7 @@ lhd_tree_dump_type_quals (tree t) in a language-specific way. Returns a tree for the size in bytes. */ tree -lhd_expr_size (tree exp) +lhd_expr_size (const_tree exp) { if (DECL_P (exp) && DECL_SIZE_UNIT (exp) != 0) diff --git a/gcc/langhooks.h b/gcc/langhooks.h index ed036474bda..a62c6156670 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -39,8 +39,8 @@ struct lang_hooks_for_tree_inlining tree (*) (tree *, int *, void *), void *, struct pointer_set_t*); int (*cannot_inline_tree_fn) (tree *); - int (*disregard_inline_limits) (tree); - int (*auto_var_in_fn_p) (tree, tree); + int (*disregard_inline_limits) (const_tree); + int (*auto_var_in_fn_p) (const_tree, const_tree); bool (*var_mod_type_p) (tree, tree); }; @@ -83,7 +83,7 @@ struct lang_hooks_for_tree_dump bool (*dump_tree) (void *, tree); /* Determine type qualifiers in a language-specific way. */ - int (*type_quals) (tree); + int (*type_quals) (const_tree); }; /* Hooks related to types. */ @@ -104,7 +104,7 @@ struct lang_hooks_for_types /* True if the type is an instantiation of a generic type, e.g. C++ template implicit specializations. */ - bool (*generic_p) (tree); + bool (*generic_p) (const_tree); /* Given a type, apply default promotions to unnamed function arguments and return the new type. Return the same type if no @@ -125,11 +125,11 @@ struct lang_hooks_for_types invalid use of an incomplete type. VALUE is the expression that was used (or 0 if that isn't known) and TYPE is the type that was invalid. */ - void (*incomplete_type_error) (tree value, tree type); + void (*incomplete_type_error) (const_tree value, const_tree type); /* Called from assign_temp to return the maximum size, if there is one, for a type. */ - tree (*max_size) (tree); + tree (*max_size) (const_tree); /* Register language specific type size variables as potentially OpenMP firstprivate variables. */ @@ -165,7 +165,7 @@ struct lang_hooks_for_decls /* Returns true when we should warn for an unused global DECL. We will already have checked that it has static binding. */ - bool (*warn_unused_global) (tree); + bool (*warn_unused_global) (const_tree); /* Obtain a list of globals and do final output on them at end of compilation */ @@ -373,7 +373,7 @@ struct lang_hooks expression in a language-dependent way. Returns a tree for the size in bytes. A frontend can call lhd_expr_size to get the default semantics in cases that it doesn't want to handle specially. */ - tree (*expr_size) (tree); + tree (*expr_size) (const_tree); /* Convert a character from the host's to the target's character set. The character should be in what C calls the "basic source diff --git a/gcc/pointer-set.c b/gcc/pointer-set.c index 1c733a7cadb..b57c404f6a1 100644 --- a/gcc/pointer-set.c +++ b/gcc/pointer-set.c @@ -34,7 +34,7 @@ struct pointer_set_t size_t n_slots; /* n_slots = 2^log_slots */ size_t n_elements; - void **slots; + const void **slots; }; /* Use the multiplicative method, as described in Knuth 6.4, to obtain @@ -77,7 +77,7 @@ pointer_set_create (void) result->log_slots = 8; result->n_slots = (size_t) 1 << result->log_slots; - result->slots = XCNEWVEC (void *, result->n_slots); + result->slots = XCNEWVEC (const void *, result->n_slots); return result; } @@ -93,7 +93,7 @@ pointer_set_destroy (struct pointer_set_t *pset) Collisions are resolved by linear probing. */ int -pointer_set_contains (struct pointer_set_t *pset, const void *p) +pointer_set_contains (const struct pointer_set_t *pset, const void *p) { size_t n = hash1 (p, pset->n_slots, pset->log_slots); @@ -115,7 +115,7 @@ pointer_set_contains (struct pointer_set_t *pset, const void *p) /* Subroutine of pointer_set_insert. Return the insertion slot for P into an empty element of SLOTS, an array of length N_SLOTS. */ static inline size_t -insert_aux (void *p, void **slots, size_t n_slots, size_t log_slots) +insert_aux (const void *p, const void **slots, size_t n_slots, size_t log_slots) { size_t n = hash1 (p, n_slots, log_slots); while (true) @@ -134,7 +134,7 @@ insert_aux (void *p, void **slots, size_t n_slots, size_t log_slots) /* Inserts P into PSET if it wasn't already there. Returns nonzero if it was already there. P must be nonnull. */ int -pointer_set_insert (struct pointer_set_t *pset, void *p) +pointer_set_insert (struct pointer_set_t *pset, const void *p) { size_t n; @@ -144,12 +144,12 @@ pointer_set_insert (struct pointer_set_t *pset, void *p) { size_t new_log_slots = pset->log_slots + 1; size_t new_n_slots = pset->n_slots * 2; - void **new_slots = XCNEWVEC (void *, new_n_slots); + const void **new_slots = XCNEWVEC (const void *, new_n_slots); size_t i; for (i = 0; i < pset->n_slots; ++i) { - void *value = pset->slots[i]; + const void *value = pset->slots[i]; n = insert_aux (value, new_slots, new_n_slots, new_log_slots); new_slots[n] = value; } @@ -172,8 +172,8 @@ pointer_set_insert (struct pointer_set_t *pset, void *p) /* Pass each pointer in PSET to the function in FN, together with the fixed parameter DATA. If FN returns false, the iteration stops. */ -void pointer_set_traverse (struct pointer_set_t *pset, - bool (*fn) (void *, void *), void *data) +void pointer_set_traverse (const struct pointer_set_t *pset, + bool (*fn) (const void *, void *), void *data) { size_t i; for (i = 0; i < pset->n_slots; ++i) @@ -194,7 +194,7 @@ struct pointer_map_t size_t n_slots; /* n_slots = 2^log_slots */ size_t n_elements; - void **keys; + const void **keys; void **values; }; @@ -208,7 +208,7 @@ pointer_map_create (void) result->log_slots = 8; result->n_slots = (size_t) 1 << result->log_slots; - result->keys = XCNEWVEC (void *, result->n_slots); + result->keys = XCNEWVEC (const void *, result->n_slots); result->values = XCNEWVEC (void *, result->n_slots); return result; } @@ -226,7 +226,7 @@ void pointer_map_destroy (struct pointer_map_t *pmap) Collisions are resolved by linear probing. */ void ** -pointer_map_contains (struct pointer_map_t *pmap, const void *p) +pointer_map_contains (const struct pointer_map_t *pmap, const void *p) { size_t n = hash1 (p, pmap->n_slots, pmap->log_slots); @@ -248,7 +248,7 @@ pointer_map_contains (struct pointer_map_t *pmap, const void *p) /* Inserts P into PMAP if it wasn't already there. Returns a pointer to the value. P must be nonnull. */ void ** -pointer_map_insert (struct pointer_map_t *pmap, void *p) +pointer_map_insert (struct pointer_map_t *pmap, const void *p) { size_t n; @@ -258,14 +258,14 @@ pointer_map_insert (struct pointer_map_t *pmap, void *p) { size_t new_log_slots = pmap->log_slots + 1; size_t new_n_slots = pmap->n_slots * 2; - void **new_keys = XCNEWVEC (void *, new_n_slots); + const void **new_keys = XCNEWVEC (const void *, new_n_slots); void **new_values = XCNEWVEC (void *, new_n_slots); size_t i; for (i = 0; i < pmap->n_slots; ++i) if (pmap->keys[i]) { - void *key = pmap->keys[i]; + const void *key = pmap->keys[i]; n = insert_aux (key, new_keys, new_n_slots, new_log_slots); new_keys[n] = key; new_values[n] = pmap->values[i]; @@ -293,8 +293,8 @@ pointer_map_insert (struct pointer_map_t *pmap, void *p) to the value and the fixed parameter DATA. If FN returns false, the iteration stops. */ -void pointer_map_traverse (struct pointer_map_t *pmap, - bool (*fn) (void *, void **, void *), void *data) +void pointer_map_traverse (const struct pointer_map_t *pmap, + bool (*fn) (const void *, void **, void *), void *data) { size_t i; for (i = 0; i < pmap->n_slots; ++i) diff --git a/gcc/pointer-set.h b/gcc/pointer-set.h index 9c09cb05770..f6b085c032b 100644 --- a/gcc/pointer-set.h +++ b/gcc/pointer-set.h @@ -24,18 +24,19 @@ struct pointer_set_t; struct pointer_set_t *pointer_set_create (void); void pointer_set_destroy (struct pointer_set_t *pset); -int pointer_set_contains (struct pointer_set_t *pset, const void *p); -int pointer_set_insert (struct pointer_set_t *pset, void *p); -void pointer_set_traverse (struct pointer_set_t *, bool (*) (void *, void *), +int pointer_set_contains (const struct pointer_set_t *pset, const void *p); +int pointer_set_insert (struct pointer_set_t *pset, const void *p); +void pointer_set_traverse (const struct pointer_set_t *, + bool (*) (const void *, void *), void *); struct pointer_map_t; struct pointer_map_t *pointer_map_create (void); void pointer_map_destroy (struct pointer_map_t *pmap); -void **pointer_map_contains (struct pointer_map_t *pmap, const void *p); -void **pointer_map_insert (struct pointer_map_t *pmap, void *p); -void pointer_map_traverse (struct pointer_map_t *, - bool (*) (void *, void **, void *), void *); +void **pointer_map_contains (const struct pointer_map_t *pmap, const void *p); +void **pointer_map_insert (struct pointer_map_t *pmap, const void *p); +void pointer_map_traverse (const struct pointer_map_t *, + bool (*) (const void *, void **, void *), void *); #endif /* POINTER_SET_H */ diff --git a/gcc/predict.c b/gcc/predict.c index 87baaf4cd55..dbdfce4efdd 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1337,7 +1337,7 @@ call_expr:; empty. */ static bool -assert_is_empty (void *key ATTRIBUTE_UNUSED, void **value, +assert_is_empty (const void *key ATTRIBUTE_UNUSED, void **value, void *data ATTRIBUTE_UNUSED) { gcc_assert (!*value); diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index 75281884f7f..0f19587ef59 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -626,7 +626,7 @@ tree_to_aff_combination_expand (tree expr, tree type, aff_tree *comb, pointer_map_traverse. */ static bool -free_name_expansion (void *key ATTRIBUTE_UNUSED, void **value, +free_name_expansion (const void *key ATTRIBUTE_UNUSED, void **value, void *data ATTRIBUTE_UNUSED) { struct name_expansion *exp = *value; diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 8cf3112a5a5..e9be4d40440 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -645,7 +645,7 @@ make_cond_expr_edges (basic_block bb) element. */ static bool -edge_to_cases_cleanup (void *key ATTRIBUTE_UNUSED, void **value, +edge_to_cases_cleanup (const void *key ATTRIBUTE_UNUSED, void **value, void *data ATTRIBUTE_UNUSED) { tree t, next; diff --git a/gcc/tree.c b/gcc/tree.c index 8e8fe211234..92d2ba8769b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1801,7 +1801,7 @@ tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL) make_unsigned_type). */ tree -size_in_bytes (tree type) +size_in_bytes (const_tree type) { tree t; @@ -1847,7 +1847,7 @@ int_size_in_bytes (const_tree type) or return -1 if the size can vary or is larger than an integer. */ HOST_WIDE_INT -max_int_size_in_bytes (tree type) +max_int_size_in_bytes (const_tree type) { HOST_WIDE_INT size = -1; tree size_tree; diff --git a/gcc/tree.h b/gcc/tree.h index fc0ca50bc86..b5ff51f6071 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4302,9 +4302,9 @@ extern tree expr_last (tree); extern const_tree const_expr_last (const_tree); extern tree expr_only (tree); extern const_tree const_expr_only (const_tree); -extern tree size_in_bytes (tree); +extern tree size_in_bytes (const_tree); extern HOST_WIDE_INT int_size_in_bytes (const_tree); -extern HOST_WIDE_INT max_int_size_in_bytes (tree); +extern HOST_WIDE_INT max_int_size_in_bytes (const_tree); extern tree bit_position (const_tree); extern HOST_WIDE_INT int_bit_position (const_tree); extern tree byte_position (const_tree); |