calls.c (special_function_p, [...]): Constify.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sat, 28 Jul 2007 14:51:40 +0000 (14:51 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sat, 28 Jul 2007 14:51:40 +0000 (14:51 +0000)
* calls.c (special_function_p, setjmp_call_p, alloca_call_p,
flags_from_decl_or_type): Constify.
* gcc.c (do_spec_1): Likewise.
* print-tree.c (dump_addr, print_node_brief): Likewise.
* tree-cfg.c (stmt_starts_bb_p, is_ctrl_stmt, computed_goto_p,
simple_goto_p, tree_can_make_abnormal_goto, stmt_starts_bb_p,
tree_purge_all_dead_eh_edges): Likewise.
* tree-flow.h (is_ctrl_stmt, computed_goto_p, simple_goto_p,
tree_can_make_abnormal_goto, tree_purge_all_dead_eh_edges):
Likewise.
* tree.c (expr_location, expr_has_location, expr_locus,
expr_filename, expr_lineno, get_inner_array_type,
fields_compatible_p): Likewise.
* tree.h (get_inner_array_type, fields_compatible_p,
expr_location, expr_has_location, expr_locus, expr_filename,
expr_lineno, dump_addr, print_node_brief, flags_from_decl_or_type,
setjmp_call_p, alloca_call_p): Likewise.

From-SVN: r127017

gcc/ChangeLog
gcc/calls.c
gcc/gcc.c
gcc/print-tree.c
gcc/tree-cfg.c
gcc/tree-flow.h
gcc/tree.c
gcc/tree.h

index 9c37e2a652f62d11ff072833bb3931ff06d8e22a..13df4ae9ead43582fce1240ec695881b307c24e4 100644 (file)
@@ -1,3 +1,23 @@
+2007-07-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * calls.c (special_function_p, setjmp_call_p, alloca_call_p,
+       flags_from_decl_or_type): Constify.
+       * gcc.c (do_spec_1): Likewise.
+       * print-tree.c (dump_addr, print_node_brief): Likewise.
+       * tree-cfg.c (stmt_starts_bb_p, is_ctrl_stmt, computed_goto_p,
+       simple_goto_p, tree_can_make_abnormal_goto, stmt_starts_bb_p,
+       tree_purge_all_dead_eh_edges): Likewise.
+       * tree-flow.h (is_ctrl_stmt, computed_goto_p, simple_goto_p,
+       tree_can_make_abnormal_goto, tree_purge_all_dead_eh_edges):
+       Likewise. 
+       * tree.c (expr_location, expr_has_location, expr_locus,
+       expr_filename, expr_lineno, get_inner_array_type,
+       fields_compatible_p): Likewise.
+       * tree.h (get_inner_array_type, fields_compatible_p,
+       expr_location, expr_has_location, expr_locus, expr_filename,
+       expr_lineno, dump_addr, print_node_brief, flags_from_decl_or_type,
+       setjmp_call_p, alloca_call_p): Likewise.
+
 2007-07-28  Daniel Berlin  <dberlin@dberlin.org>
 
        * timevar.def: Add TV_CALL_CLOBBER, TV_FLOW_SENSITIVE,
index d54cf7026e04ed38864e7960230f917435a87885..8863faaf09226af8bdbc9b8018398948f0a7bc45 100644 (file)
@@ -143,7 +143,7 @@ static void load_register_parameters (struct arg_data *, int, rtx *, int,
                                      int, int *);
 static rtx emit_library_call_value_1 (int, rtx, rtx, enum libcall_type,
                                      enum machine_mode, int, va_list);
-static int special_function_p (tree, int);
+static int special_function_p (const_tree, int);
 static int check_sibcall_argument_overlap_1 (rtx);
 static int check_sibcall_argument_overlap (rtx, struct arg_data *, int);
 
@@ -469,7 +469,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
    space from the stack such as alloca.  */
 
 static int
-special_function_p (tree fndecl, int flags)
+special_function_p (const_tree fndecl, int flags)
 {
   if (fndecl && DECL_NAME (fndecl)
       && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) <= 17
@@ -543,14 +543,14 @@ special_function_p (tree fndecl, int flags)
 /* Return nonzero when FNDECL represents a call to setjmp.  */
 
 int
-setjmp_call_p (tree fndecl)
+setjmp_call_p (const_tree fndecl)
 {
   return special_function_p (fndecl, 0) & ECF_RETURNS_TWICE;
 }
 
 /* Return true when exp contains alloca call.  */
 bool
-alloca_call_p (tree exp)
+alloca_call_p (const_tree exp)
 {
   if (TREE_CODE (exp) == CALL_EXPR
       && TREE_CODE (CALL_EXPR_FN (exp)) == ADDR_EXPR
@@ -564,10 +564,10 @@ alloca_call_p (tree exp)
 /* Detect flags (function attributes) from the function decl or type node.  */
 
 int
-flags_from_decl_or_type (tree exp)
+flags_from_decl_or_type (const_tree exp)
 {
   int flags = 0;
-  tree type = exp;
+  const_tree type = exp;
 
   if (DECL_P (exp))
     {
index 47d35c66e98eaca9c118285306253dbfedeb846d..db064919d995c8ee85700c52348bf09c2524de11 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4847,12 +4847,14 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
 
                if (save_temps_flag)
                  {
+                   char *tmp;
+                   
                    temp_filename_length = basename_length + suffix_length;
-                   temp_filename = alloca (temp_filename_length + 1);
-                   strncpy ((char *) temp_filename, input_basename, basename_length);
-                   strncpy ((char *) temp_filename + basename_length, suffix,
-                            suffix_length);
-                   *((char *) temp_filename + temp_filename_length) = '\0';
+                   tmp = alloca (temp_filename_length + 1);
+                   strncpy (tmp, input_basename, basename_length);
+                   strncpy (tmp + basename_length, suffix, suffix_length);
+                   tmp[temp_filename_length] = '\0';
+                   temp_filename = tmp;
                    if (strcmp (temp_filename, input_filename) != 0)
                      {
 #ifndef HOST_LACKS_INODE_NUMBERS
index 7cd77019390fd09d71c0546540d20c46e49ee90c..297f62fc599434cf092a28c331a4a6c2d6e901ea 100644 (file)
@@ -58,7 +58,7 @@ debug_tree (tree node)
 
 /* Print PREFIX and ADDR to FILE.  */
 void
-dump_addr (FILE *file, const char *prefix, void *addr)
+dump_addr (FILE *file, const char *prefix, const void *addr)
 {
   if (flag_dump_noaddr || flag_dump_unnumbered)
     fprintf (file, "%s#", prefix);
@@ -69,7 +69,7 @@ dump_addr (FILE *file, const char *prefix, void *addr)
 /* Print a node in brief fashion, with just the code, address and name.  */
 
 void
-print_node_brief (FILE *file, const char *prefix, tree node, int indent)
+print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
 {
   enum tree_code_class class;
 
index 26a5ac9c06f03d40a4835dd4a0e16613b880c500..d0c8fe9b0d2ab517724cf3f2a37ffa83af8dc066 100644 (file)
@@ -96,7 +96,7 @@ static edge tree_try_redirect_by_replacing_jump (edge, basic_block);
 static unsigned int split_critical_edges (void);
 
 /* Various helpers.  */
-static inline bool stmt_starts_bb_p (tree, tree);
+static inline bool stmt_starts_bb_p (const_tree, const_tree);
 static int tree_verify_flow_info (void);
 static void tree_make_forwarder_block (edge);
 static void tree_cfg2vcg (FILE *);
@@ -2421,7 +2421,7 @@ tree_cfg2vcg (FILE *file)
 /* Return true if T represents a stmt that always transfers control.  */
 
 bool
-is_ctrl_stmt (tree t)
+is_ctrl_stmt (const_tree t)
 {
   return (TREE_CODE (t) == COND_EXPR
          || TREE_CODE (t) == SWITCH_EXPR
@@ -2465,7 +2465,7 @@ is_ctrl_altering_stmt (tree t)
 /* Return true if T is a computed goto.  */
 
 bool
-computed_goto_p (tree t)
+computed_goto_p (const_tree t)
 {
   return (TREE_CODE (t) == GOTO_EXPR
          && TREE_CODE (GOTO_DESTINATION (t)) != LABEL_DECL);
@@ -2475,7 +2475,7 @@ computed_goto_p (tree t)
 /* Return true if T is a simple local goto.  */
 
 bool
-simple_goto_p (tree t)
+simple_goto_p (const_tree t)
 {
   return (TREE_CODE (t) == GOTO_EXPR
          && TREE_CODE (GOTO_DESTINATION (t)) == LABEL_DECL);
@@ -2486,7 +2486,7 @@ simple_goto_p (tree t)
    Transfers of control flow associated with EH are excluded.  */
 
 bool
-tree_can_make_abnormal_goto (tree t)
+tree_can_make_abnormal_goto (const_tree t)
 {
   if (computed_goto_p (t))
     return true;
@@ -2507,7 +2507,7 @@ tree_can_make_abnormal_goto (tree t)
    unnecessary basic blocks that only contain a single label.  */
 
 static inline bool
-stmt_starts_bb_p (tree t, tree prev_t)
+stmt_starts_bb_p (const_tree t, const_tree prev_t)
 {
   if (t == NULL_TREE)
     return false;
@@ -6242,7 +6242,7 @@ tree_purge_dead_eh_edges (basic_block bb)
 }
 
 bool
-tree_purge_all_dead_eh_edges (bitmap blocks)
+tree_purge_all_dead_eh_edges (const_bitmap blocks)
 {
   bool changed = false;
   unsigned i;
index e67bd0a50b5f93406d7b6cb389ed25ded5949c59..e3895d19fbf20f6f3c9c2ac93022555434981945 100644 (file)
@@ -722,11 +722,11 @@ extern void free_omp_regions (void);
 
 extern void delete_tree_cfg_annotations (void);
 extern bool stmt_ends_bb_p (tree);
-extern bool is_ctrl_stmt (tree);
+extern bool is_ctrl_stmt (const_tree);
 extern bool is_ctrl_altering_stmt (tree);
-extern bool computed_goto_p (tree);
-extern bool simple_goto_p (tree);
-extern bool tree_can_make_abnormal_goto (tree);
+extern bool computed_goto_p (const_tree);
+extern bool simple_goto_p (const_tree);
+extern bool tree_can_make_abnormal_goto (const_tree);
 extern basic_block single_noncomplex_succ (basic_block bb);
 extern void tree_dump_bb (basic_block, FILE *, int);
 extern void debug_tree_bb (basic_block);
@@ -762,7 +762,7 @@ extern void add_phi_args_after_copy_bb (basic_block);
 extern void add_phi_args_after_copy (basic_block *, unsigned);
 extern bool tree_purge_dead_abnormal_call_edges (basic_block);
 extern bool tree_purge_dead_eh_edges (basic_block);
-extern bool tree_purge_all_dead_eh_edges (bitmap);
+extern bool tree_purge_all_dead_eh_edges (const_bitmap);
 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
                             tree, tree);
index b8bbfc0ca02f748296df9c4dc3d188eb6e02aa6f..cd6bf36dae8577a4987f9115790429d8b37ab40d 100644 (file)
@@ -3429,7 +3429,7 @@ annotate_with_locus (tree node, location_t locus)
    decls and constants can be shared among multiple locations, so
    return nothing.  */
 location_t
-expr_location (tree node)
+expr_location (const_tree node)
 {
 #ifdef USE_MAPPED_LOCATION
   if (GIMPLE_STMT_P (node))
@@ -3457,7 +3457,7 @@ set_expr_location (tree node, location_t locus)
 }
 
 bool
-expr_has_location (tree node)
+expr_has_location (const_tree node)
 {
 #ifdef USE_MAPPED_LOCATION
   return expr_location (node) != UNKNOWN_LOCATION;
@@ -3471,7 +3471,7 @@ source_location *
 #else
 source_locus
 #endif
-expr_locus (tree node)
+expr_locus (const_tree node)
 {
 #ifdef USE_MAPPED_LOCATION
   if (GIMPLE_STMT_P (node))
@@ -3519,7 +3519,7 @@ set_expr_locus (tree node,
 }
 
 const char **
-expr_filename (tree node)
+expr_filename (const_tree node)
 {
 #ifdef USE_MAPPED_LOCATION
   if (GIMPLE_STMT_P (node))
@@ -3533,7 +3533,7 @@ expr_filename (tree node)
 }
 
 int *
-expr_lineno (tree node)
+expr_lineno (const_tree node)
 {
 #ifdef USE_MAPPED_LOCATION
   if (GIMPLE_STMT_P (node))
@@ -5637,7 +5637,7 @@ build_array_type (tree elt_type, tree index_type)
    the innermost dimension of ARRAY.  */
 
 tree
-get_inner_array_type (tree array)
+get_inner_array_type (const_tree array)
 {
   tree type = TREE_TYPE (array);
 
@@ -7803,7 +7803,7 @@ needs_to_live_in_memory (tree t)
    are compatible.  It is assumed that the parent records are compatible.  */
 
 bool
-fields_compatible_p (tree f1, tree f2)
+fields_compatible_p (const_tree f1, const_tree f2)
 {
   if (!operand_equal_p (DECL_FIELD_BIT_OFFSET (f1),
                        DECL_FIELD_BIT_OFFSET (f2), OEP_ONLY_CONST))
index 2060df6be8c350995c4ff034dcd8854a26f74f27..790a115c7b717f525a30b0ad3d6f96ee5cf5f6d6 100644 (file)
@@ -3830,7 +3830,7 @@ extern int tree_int_cst_sign_bit (tree);
 extern bool tree_expr_nonnegative_p (tree);
 extern bool tree_expr_nonnegative_warnv_p (tree, bool *);
 extern bool may_negate_without_overflow_p (tree);
-extern tree get_inner_array_type (tree);
+extern tree get_inner_array_type (const_tree);
 
 /* From expmed.c.  Since rtl.h is included after tree.h, we can't
    put the prototype here.  Rtl.h does declare the prototype if
@@ -4597,19 +4597,19 @@ extern tree build_range_type (tree, tree, tree);
 extern HOST_WIDE_INT int_cst_value (const_tree);
 extern tree build_addr (tree, tree);
 
-extern bool fields_compatible_p (tree, tree);
+extern bool fields_compatible_p (const_tree, const_tree);
 extern tree find_compatible_field (tree, tree);
 
-extern location_t expr_location (tree);
+extern location_t expr_location (const_tree);
 extern void set_expr_location (tree, location_t);
-extern bool expr_has_location (tree);
+extern bool expr_has_location (const_tree);
 extern
 #ifdef USE_MAPPED_LOCATION
 source_location *
 #else
 source_locus
 #endif
-expr_locus (tree);
+expr_locus (const_tree);
 extern void set_expr_locus (tree,
 #ifdef USE_MAPPED_LOCATION
                             source_location *loc
@@ -4617,8 +4617,8 @@ extern void set_expr_locus (tree,
                            source_locus loc
 #endif
                           );
-extern const char **expr_filename (tree);
-extern int *expr_lineno (tree);
+extern const char **expr_filename (const_tree);
+extern int *expr_lineno (const_tree);
 extern tree *tree_block (tree);
 extern tree *generic_tree_operand (tree, int);
 extern tree *generic_tree_type (tree);
@@ -4652,9 +4652,9 @@ extern void print_rtl (FILE *, const_rtx);
 /* In print-tree.c */
 extern void debug_tree (tree);
 #ifdef BUFSIZ
-extern void dump_addr (FILE*, const char *, void *);
+extern void dump_addr (FILE*, const char *, const void *);
 extern void print_node (FILE *, const char *, tree, int);
-extern void print_node_brief (FILE *, const char *, tree, int);
+extern void print_node_brief (FILE *, const char *, const_tree, int);
 extern void indent_to (FILE *, int);
 #endif
 
@@ -4695,11 +4695,11 @@ extern tree build_duplicate_type (tree);
    it does not necessarily fit ECF_CONST).  */
 #define ECF_NOVOPS             1024
 
-extern int flags_from_decl_or_type (tree);
+extern int flags_from_decl_or_type (const_tree);
 extern int call_expr_flags (tree);
 
-extern int setjmp_call_p (tree);
-extern bool alloca_call_p (tree);
+extern int setjmp_call_p (const_tree);
+extern bool alloca_call_p (const_tree);
 extern bool must_pass_in_stack_var_size (enum machine_mode, tree);
 extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, tree);