public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH INSTALLED]: const typedefs part 15/N
@ 2007-08-16 14:41 Kaveh R. GHAZI
  0 siblings, 0 replies; only message in thread
From: Kaveh R. GHAZI @ 2007-08-16 14:41 UTC (permalink / raw)
  To: gcc-patches

This patch constifies the pointer_set/pointer_map interfaces, and
several of the langhooks.

Tested on sparc-sun-solaris2.10, including ada.  No regressions.
Installed.

		--Kaveh


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.

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.

diff -rup orig/egcc-SVN20070814/gcc/ada/misc.c egcc-SVN20070814/gcc/ada/misc.c
--- orig/egcc-SVN20070814/gcc/ada/misc.c	2007-08-14 11:33:55.000000000 -0400
+++ egcc-SVN20070814/gcc/ada/misc.c	2007-08-15 22:35:30.429320442 -0400
@@ -103,7 +103,7 @@ static rtx gnat_expand_expr		(tree, rtx,
 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 -rup orig/egcc-SVN20070814/gcc/c-common.c egcc-SVN20070814/gcc/c-common.c
--- orig/egcc-SVN20070814/gcc/c-common.c	2007-08-11 20:02:48.000000000 -0400
+++ egcc-SVN20070814/gcc/c-common.c	2007-08-15 19:54:55.238723235 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/c-common.h egcc-SVN20070814/gcc/c-common.h
--- orig/egcc-SVN20070814/gcc/c-common.h	2007-08-11 20:02:49.000000000 -0400
+++ egcc-SVN20070814/gcc/c-common.h	2007-08-15 19:55:12.050796272 -0400
@@ -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 (tre
 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 -rup orig/egcc-SVN20070814/gcc/c-objc-common.c egcc-SVN20070814/gcc/c-objc-common.c
--- orig/egcc-SVN20070814/gcc/c-objc-common.c	2007-08-02 22:59:15.000000000 -0400
+++ egcc-SVN20070814/gcc/c-objc-common.c	2007-08-16 00:56:46.721233236 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/c-tree.h egcc-SVN20070814/gcc/c-tree.h
--- orig/egcc-SVN20070814/gcc/c-tree.h	2007-07-26 23:03:47.000000000 -0400
+++ egcc-SVN20070814/gcc/c-tree.h	2007-08-16 00:56:43.325299306 -0400
@@ -514,12 +514,12 @@ extern struct c_declspecs *declspecs_add
 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_
 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 -rup orig/egcc-SVN20070814/gcc/c-typeck.c egcc-SVN20070814/gcc/c-typeck.c
--- orig/egcc-SVN20070814/gcc/c-typeck.c	2007-08-14 11:34:22.000000000 -0400
+++ egcc-SVN20070814/gcc/c-typeck.c	2007-08-15 23:20:42.509790427 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/cp/cp-objcp-common.c egcc-SVN20070814/gcc/cp/cp-objcp-common.c
--- orig/egcc-SVN20070814/gcc/cp/cp-objcp-common.c	2007-08-11 20:02:18.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/cp-objcp-common.c	2007-08-16 00:55:10.132021383 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/cp/cp-tree.h egcc-SVN20070814/gcc/cp/cp-tree.h
--- orig/egcc-SVN20070814/gcc/cp/cp-tree.h	2007-08-11 20:02:19.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/cp-tree.h	2007-08-16 00:55:13.042668362 -0400
@@ -4250,8 +4250,8 @@ extern tree create_implicit_typedef		(tr
 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,
 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 -rup orig/egcc-SVN20070814/gcc/cp/decl.c egcc-SVN20070814/gcc/cp/decl.c
--- orig/egcc-SVN20070814/gcc/cp/decl.c	2007-08-14 20:02:05.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/decl.c	2007-08-16 00:28:41.054334798 -0400
@@ -8962,7 +8962,7 @@ require_complete_types_for_parms (tree p
 /* 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 -rup orig/egcc-SVN20070814/gcc/cp/tree.c egcc-SVN20070814/gcc/cp/tree.c
--- orig/egcc-SVN20070814/gcc/cp/tree.c	2007-08-02 10:19:33.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/tree.c	2007-08-16 00:31:37.909396803 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/cp/typeck.c egcc-SVN20070814/gcc/cp/typeck.c
--- orig/egcc-SVN20070814/gcc/cp/typeck.c	2007-08-14 11:32:35.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/typeck.c	2007-08-15 19:55:29.841838411 -0400
@@ -6909,9 +6909,9 @@ comp_ptr_ttypes_const (tree to, tree fro
    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 -rup orig/egcc-SVN20070814/gcc/cp/typeck2.c egcc-SVN20070814/gcc/cp/typeck2.c
--- orig/egcc-SVN20070814/gcc/cp/typeck2.c	2007-08-09 19:21:22.000000000 -0400
+++ egcc-SVN20070814/gcc/cp/typeck2.c	2007-08-15 23:16:57.527602962 -0400
@@ -336,7 +336,7 @@ abstract_virtuals_error (tree decl, tree
    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 val
    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 -rup orig/egcc-SVN20070814/gcc/hooks.c egcc-SVN20070814/gcc/hooks.c
--- orig/egcc-SVN20070814/gcc/hooks.c	2007-07-26 23:03:29.000000000 -0400
+++ egcc-SVN20070814/gcc/hooks.c	2007-08-15 19:42:45.051735602 -0400
@@ -190,6 +190,12 @@ hook_bool_tree_false (tree a ATTRIBUTE_U
 }

 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 -rup orig/egcc-SVN20070814/gcc/hooks.h egcc-SVN20070814/gcc/hooks.h
--- orig/egcc-SVN20070814/gcc/hooks.h	2007-07-26 23:03:29.000000000 -0400
+++ egcc-SVN20070814/gcc/hooks.h	2007-08-15 19:42:24.815940514 -0400
@@ -31,6 +31,7 @@ extern bool hook_bool_mode_false (enum m
 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 -rup orig/egcc-SVN20070814/gcc/langhooks-def.h egcc-SVN20070814/gcc/langhooks-def.h
--- orig/egcc-SVN20070814/gcc/langhooks-def.h	2007-08-11 20:02:49.000000000 -0400
+++ egcc-SVN20070814/gcc/langhooks-def.h	2007-08-16 00:55:48.774750345 -0400
@@ -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 d
 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_

 /* 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_cod
    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 -rup orig/egcc-SVN20070814/gcc/langhooks.c egcc-SVN20070814/gcc/langhooks.c
--- orig/egcc-SVN20070814/gcc/langhooks.c	2007-08-11 20:02:47.000000000 -0400
+++ egcc-SVN20070814/gcc/langhooks.c	2007-08-16 00:55:43.716834610 -0400
@@ -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_UNUS

 /* 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
    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_limit
    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 ATTRIB
    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 -rup orig/egcc-SVN20070814/gcc/langhooks.h egcc-SVN20070814/gcc/langhooks.h
--- orig/egcc-SVN20070814/gcc/langhooks.h	2007-08-11 20:02:47.000000000 -0400
+++ egcc-SVN20070814/gcc/langhooks.h	2007-08-16 00:56:03.710797848 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/pointer-set.c egcc-SVN20070814/gcc/pointer-set.c
--- orig/egcc-SVN20070814/gcc/pointer-set.c	2007-08-14 01:01:46.000000000 -0400
+++ egcc-SVN20070814/gcc/pointer-set.c	2007-08-15 21:20:05.083847198 -0400
@@ -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_

    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
 /* 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_
 /* 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
     {
       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
 /* 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

    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
 /* 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
     {
       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
    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 -rup orig/egcc-SVN20070814/gcc/pointer-set.h egcc-SVN20070814/gcc/pointer-set.h
--- orig/egcc-SVN20070814/gcc/pointer-set.h	2007-08-14 01:01:46.000000000 -0400
+++ egcc-SVN20070814/gcc/pointer-set.h	2007-08-15 21:20:08.591311624 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/predict.c egcc-SVN20070814/gcc/predict.c
--- orig/egcc-SVN20070814/gcc/predict.c	2007-08-14 01:01:47.000000000 -0400
+++ egcc-SVN20070814/gcc/predict.c	2007-08-15 21:12:46.400457230 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/tree-affine.c egcc-SVN20070814/gcc/tree-affine.c
--- orig/egcc-SVN20070814/gcc/tree-affine.c	2007-07-30 12:38:00.000000000 -0400
+++ egcc-SVN20070814/gcc/tree-affine.c	2007-08-15 21:07:58.971320130 -0400
@@ -626,7 +626,7 @@ tree_to_aff_combination_expand (tree exp
    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 -rup orig/egcc-SVN20070814/gcc/tree-cfg.c egcc-SVN20070814/gcc/tree-cfg.c
--- orig/egcc-SVN20070814/gcc/tree-cfg.c	2007-08-14 11:34:24.000000000 -0400
+++ egcc-SVN20070814/gcc/tree-cfg.c	2007-08-15 21:08:58.892860268 -0400
@@ -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 -rup orig/egcc-SVN20070814/gcc/tree.c egcc-SVN20070814/gcc/tree.c
--- orig/egcc-SVN20070814/gcc/tree.c	2007-08-14 11:34:20.000000000 -0400
+++ egcc-SVN20070814/gcc/tree.c	2007-08-15 23:10:58.220557484 -0400
@@ -1801,7 +1801,7 @@ tree_cons_stat (tree purpose, tree value
    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 -rup orig/egcc-SVN20070814/gcc/tree.h egcc-SVN20070814/gcc/tree.h
--- orig/egcc-SVN20070814/gcc/tree.h	2007-08-14 11:34:20.000000000 -0400
+++ egcc-SVN20070814/gcc/tree.h	2007-08-15 23:11:01.125132354 -0400
@@ -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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-16 14:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-16 14:41 [PATCH INSTALLED]: const typedefs part 15/N Kaveh R. GHAZI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).