* 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
+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
+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
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. */
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
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)
/* 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);
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);
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;
/* 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;
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);
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);
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;
/* 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))
+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
/* 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;
might have allocated something there. */
tree
-cp_expr_size (tree exp)
+cp_expr_size (const_tree exp)
{
tree type = TREE_TYPE (exp);
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 *);
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,
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);
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);
/* 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);
/* 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 *);
/* 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
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
/* 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);
}
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));
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);
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);
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);
}
}
bool
+hook_bool_const_tree_false (const_tree a ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+bool
hook_bool_tree_true (tree a ATTRIBUTE_UNUSED)
{
return true;
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);
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 *);
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);
/* 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
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
/* 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. */
/* 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;
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;
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)
language-specific way. */
int
-lhd_tree_dump_type_quals (tree t)
+lhd_tree_dump_type_quals (const_tree t)
{
return TYPE_QUALS (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)
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);
};
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. */
/* 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
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. */
/* 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 */
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
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
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;
}
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);
/* 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)
/* 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;
{
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;
}
/* 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)
size_t n_slots; /* n_slots = 2^log_slots */
size_t n_elements;
- void **keys;
+ const void **keys;
void **values;
};
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;
}
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);
/* 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;
{
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];
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)
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 */
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);
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;
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;
make_unsigned_type). */
tree
-size_in_bytes (tree type)
+size_in_bytes (const_tree type)
{
tree t;
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;
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);