c-common.c (const_strip_array_types): Delete.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Sat, 1 Sep 2007 17:18:03 +0000 (17:18 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Sat, 1 Sep 2007 17:18:03 +0000 (17:18 +0000)
* c-common.c (const_strip_array_types): Delete.
* c-common.h (const_strip_array_types): Likewise.
* emit-rtl.c (const_next_insn, const_previous_insn,
const_next_nonnote_insn, const_prev_nonnote_insn,
const_next_real_insn, const_prev_real_insn,
const_next_active_insn, const_prev_active_insn, const_next_label,
const_prev_label): Delete.
* gimple-low.c (block_may_fallthru): Use expr_last.
* jump.c (reversed_comparison_code_parts): Use prev_nonnote_insn.
* rtl.h (const_previous_insn, const_next_insn,
const_prev_nonnote_insn, const_next_nonnote_insn,
const_prev_real_insn, const_next_real_insn,
const_prev_active_insn, const_next_active_insn, const_prev_label,
const_next_label): Delete.
* rtlanal.c (keep_with_call_p): Use next_nonnote_insn.
* system.h (CONST_CAST): Update comment.
* tree-cfg.c (tree_can_merge_blocks_p): Use last_stmt.
(const_first_stmt, const_last_stmt): Delete.
(tree_block_ends_with_condjump_p): Use last_stmt.
* tree-flow.h (const_first_stmt, const_last_stmt): Delete.
* tree-iterator.c (const_expr_first, const_expr_last,
const_expr_only): Delete.
* tree.c (const_lookup_attribute): Likewise.
(attribute_list_contained): Use lookup_attribute.
* tree.h (const_lookup_attribute, const_expr_first,
const_expr_last, const_expr_only): Delete.

cp:
* tree.c (pod_type_p, zero_init_p): Use strip_array_types.
* typeck.c (cp_type_quals, cp_type_readonly, cp_has_mutable_p):
Likewise.

From-SVN: r128014

17 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/emit-rtl.c
gcc/gimple-low.c
gcc/jump.c
gcc/rtl.h
gcc/rtlanal.c
gcc/system.h
gcc/tree-cfg.c
gcc/tree-flow.h
gcc/tree-iterator.c
gcc/tree.c
gcc/tree.h

index 9a267bf64bae1b042616e7f98ff2203b1754b28a..4b0271c1c12575e3b8edd5e8326d6b71de0ab1f6 100644 (file)
@@ -1,3 +1,32 @@
+2007-09-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-common.c (const_strip_array_types): Delete.
+       * c-common.h (const_strip_array_types): Likewise.
+       * emit-rtl.c (const_next_insn, const_previous_insn,
+       const_next_nonnote_insn, const_prev_nonnote_insn,
+       const_next_real_insn, const_prev_real_insn,
+       const_next_active_insn, const_prev_active_insn, const_next_label,
+       const_prev_label): Delete.
+       * gimple-low.c (block_may_fallthru): Use expr_last.
+       * jump.c (reversed_comparison_code_parts): Use prev_nonnote_insn.
+       * rtl.h (const_previous_insn, const_next_insn,
+       const_prev_nonnote_insn, const_next_nonnote_insn,
+       const_prev_real_insn, const_next_real_insn,
+       const_prev_active_insn, const_next_active_insn, const_prev_label,
+       const_next_label): Delete.
+       * rtlanal.c (keep_with_call_p): Use next_nonnote_insn.
+       * system.h (CONST_CAST): Update comment.
+       * tree-cfg.c (tree_can_merge_blocks_p): Use last_stmt.
+       (const_first_stmt, const_last_stmt): Delete.
+       (tree_block_ends_with_condjump_p): Use last_stmt.
+       * tree-flow.h (const_first_stmt, const_last_stmt): Delete.
+       * tree-iterator.c (const_expr_first, const_expr_last,
+       const_expr_only): Delete.
+       * tree.c (const_lookup_attribute): Likewise.
+       (attribute_list_contained): Use lookup_attribute.
+       * tree.h (const_lookup_attribute, const_expr_first,
+       const_expr_last, const_expr_only): Delete.
+
 2007-09-01  Richard Guenther  <rguenther@suse.de>
 
        * tree-ssa-alias.c (create_name_tags): Use TYPE_VOLATILE
index 8e4ae22271b9bf4a9e749056d98b66e6915b3c7d..147f5c17763723294bfa39c63a4e630ddee8c850 100644 (file)
@@ -4164,15 +4164,6 @@ 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)
index 5a27eec5e6f91bccb4d6d4c840fffd3c85335e1b..428cb21f5a69daced6a5c8bfcd012a40af7ebffd 100644 (file)
@@ -734,7 +734,6 @@ extern void c_register_builtin_type (tree, const char*);
 extern bool c_promoting_integer_type_p (const_tree);
 extern int self_promoting_args_p (const_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);
index 558aa067a432a5ef7694c0c475550a8814c8b530..7b1b70fa5e992d827c324f4419f83f548f8303c7 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * tree.c (pod_type_p, zero_init_p): Use strip_array_types.
+       * typeck.c (cp_type_quals, cp_type_readonly, cp_has_mutable_p):
+       Likewise.
+
 2007-08-31 Douglas Gregor <doug.gregor@gmail.com>
 
        PR c++/32597
index 4ee3f886d25230235042b9b468561657048b86ea..3424f7a2bd2f04274f6d2567174f432d181d116f 100644 (file)
@@ -2052,7 +2052,9 @@ is_dummy_object (const_tree ob)
 int
 pod_type_p (const_tree t)
 {
-  t = const_strip_array_types (t);
+  /* This CONST_CAST is okay because strip_array_types returns it's
+     argument unmodified and we assign it to a const_tree.  */
+  t = strip_array_types ((tree)CONST_CAST(t));
 
   if (t == error_mark_node)
     return 1;
@@ -2089,7 +2091,9 @@ class_tmpl_impl_spec_p (const_tree t)
 int
 zero_init_p (const_tree t)
 {
-  t = const_strip_array_types (t);
+  /* This CONST_CAST is okay because strip_array_types returns it's
+     argument unmodified and we assign it to a const_tree.  */
+  t = strip_array_types ((tree)CONST_CAST(t));
 
   if (t == error_mark_node)
     return 1;
index 87044be6b04b0411e04d918f1acead1d5ebdecda..b57fbe5455fb39ea3154e43486b0deaa952fdc94 100644 (file)
@@ -6943,7 +6943,9 @@ comp_ptr_ttypes_const (tree to, tree from)
 int
 cp_type_quals (const_tree type)
 {
-  type = const_strip_array_types (type);
+  /* This CONST_CAST is okay because strip_array_types returns it's
+     argument unmodified and we assign it to a const_tree.  */
+  type = strip_array_types ((tree)CONST_CAST(type));
   if (type == error_mark_node)
     return TYPE_UNQUALIFIED;
   return TYPE_QUALS (type);
@@ -6955,7 +6957,9 @@ cp_type_quals (const_tree type)
 bool
 cp_type_readonly (const_tree type)
 {
-  type = const_strip_array_types (type);
+  /* This CONST_CAST is okay because strip_array_types returns it's
+     argument unmodified and we assign it to a const_tree.  */
+  type = strip_array_types ((tree)CONST_CAST(type));
   return TYPE_READONLY (type);
 }
 
@@ -6964,7 +6968,9 @@ cp_type_readonly (const_tree type)
 bool
 cp_has_mutable_p (const_tree type)
 {
-  type = const_strip_array_types (type);
+  /* This CONST_CAST is okay because strip_array_types returns it's
+     argument unmodified and we assign it to a const_tree.  */
+  type = strip_array_types ((tree)CONST_CAST(type));
 
   return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
 }
index 6a4604d40e946ba55dc3b6dd2e1661cd10a9497d..cf6b2f3ccd7be8576f1029c101842ee9a1aa49c3 100644 (file)
@@ -2865,169 +2865,103 @@ get_max_uid (void)
 /* Return the next insn.  If it is a SEQUENCE, return the first insn
    of the sequence.  */
 
-#define NEXT_INSN_BODY do { \
-  if (insn) \
-    { \
-      insn = NEXT_INSN (insn); \
-      if (insn && NONJUMP_INSN_P (insn) \
-         && GET_CODE (PATTERN (insn)) == SEQUENCE) \
-       insn = XVECEXP (PATTERN (insn), 0, 0); \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 next_insn (rtx insn)
 {
-  NEXT_INSN_BODY;
-}
+  if (insn)
+    {
+      insn = NEXT_INSN (insn);
+      if (insn && NONJUMP_INSN_P (insn)
+         && GET_CODE (PATTERN (insn)) == SEQUENCE)
+       insn = XVECEXP (PATTERN (insn), 0, 0);
+    }
 
-const_rtx
-const_next_insn (const_rtx insn)
-{
-  NEXT_INSN_BODY;
+  return insn;
 }
 
-#undef NEXT_INSN_BODY
-
 /* Return the previous insn.  If it is a SEQUENCE, return the last insn
    of the sequence.  */
 
-#define PREVIOUS_INSN_BODY do { \
-  if (insn) \
-    { \
-      insn = PREV_INSN (insn); \
-      if (insn && NONJUMP_INSN_P (insn) \
-         && GET_CODE (PATTERN (insn)) == SEQUENCE) \
-       insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 previous_insn (rtx insn)
 {
-  PREVIOUS_INSN_BODY;
-}
+  if (insn)
+    {
+      insn = PREV_INSN (insn);
+      if (insn && NONJUMP_INSN_P (insn)
+         && GET_CODE (PATTERN (insn)) == SEQUENCE)
+       insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
+    }
 
-const_rtx
-const_previous_insn (const_rtx insn)
-{
-  PREVIOUS_INSN_BODY;
+  return insn;
 }
 
-#undef PREVIOUS_INSN_BODY
-
 /* Return the next insn after INSN that is not a NOTE.  This routine does not
    look inside SEQUENCEs.  */
 
-#define NEXT_NONNOTE_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = NEXT_INSN (insn); \
-      if (insn == 0 || !NOTE_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 next_nonnote_insn (rtx insn)
 {
-  NEXT_NONNOTE_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = NEXT_INSN (insn);
+      if (insn == 0 || !NOTE_P (insn))
+       break;
+    }
 
-const_rtx
-const_next_nonnote_insn (const_rtx insn)
-{
-  NEXT_NONNOTE_INSN_BODY;
+  return insn;
 }
 
-#undef NEXT_NONNOTE_INSN_BODY
-
 /* Return the previous insn before INSN that is not a NOTE.  This routine does
    not look inside SEQUENCEs.  */
 
-#define PREV_NONNOTE_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = PREV_INSN (insn); \
-      if (insn == 0 || !NOTE_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 prev_nonnote_insn (rtx insn)
 {
-  PREV_NONNOTE_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = PREV_INSN (insn);
+      if (insn == 0 || !NOTE_P (insn))
+       break;
+    }
 
-const_rtx
-const_prev_nonnote_insn (const_rtx insn)
-{
-  PREV_NONNOTE_INSN_BODY;
+  return insn;
 }
 
-#undef PREV_NONNOTE_INSN_BODY
-
 /* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */
 
-#define NEXT_REAL_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = NEXT_INSN (insn); \
-      if (insn == 0 || INSN_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 next_real_insn (rtx insn)
 {
-  NEXT_REAL_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = NEXT_INSN (insn);
+      if (insn == 0 || INSN_P (insn))
+       break;
+    }
 
-const_rtx
-const_next_real_insn (const_rtx insn)
-{
-  NEXT_REAL_INSN_BODY;
+  return insn;
 }
 
-#undef NEXT_REAL_INSN_BODY
-
 /* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */
 
-#define PREV_REAL_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = PREV_INSN (insn); \
-      if (insn == 0 || INSN_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 prev_real_insn (rtx insn)
 {
-  PREV_REAL_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = PREV_INSN (insn);
+      if (insn == 0 || INSN_P (insn))
+       break;
+    }
 
-const_rtx
-const_prev_real_insn (const_rtx insn)
-{
-  PREV_REAL_INSN_BODY;
+  return insn;
 }
 
-#undef PREV_REAL_INSN_BODY
-
 /* Return the last CALL_INSN in the current list, or 0 if there is none.
    This routine does not look inside SEQUENCEs.  */
 
@@ -3058,110 +2992,66 @@ active_insn_p (const_rtx insn)
                      && GET_CODE (PATTERN (insn)) != CLOBBER))));
 }
 
-#define NEXT_ACTIVE_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = NEXT_INSN (insn); \
-      if (insn == 0 || active_insn_p (insn)) \
-       break; \
-    } \
-  return insn;\
-} while (0)
-
 rtx
 next_active_insn (rtx insn)
 {
-  NEXT_ACTIVE_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = NEXT_INSN (insn);
+      if (insn == 0 || active_insn_p (insn))
+       break;
+    }
 
-const_rtx
-const_next_active_insn (const_rtx insn)
-{
-  NEXT_ACTIVE_INSN_BODY;
+  return insn;
 }
 
-#undef NEXT_ACTIVE_INSN_BODY
-
 /* Find the last insn before INSN that really does something.  This routine
    does not look inside SEQUENCEs.  Until reload has completed, this is the
    same as prev_real_insn.  */
 
-#define PREV_ACTIVE_INSN_BODY do { \
-  while (insn) \
-    { \
-      insn = PREV_INSN (insn);\
-      if (insn == 0 || active_insn_p (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 prev_active_insn (rtx insn)
 {
-  PREV_ACTIVE_INSN_BODY;
-}
+  while (insn)
+    {
+      insn = PREV_INSN (insn);
+      if (insn == 0 || active_insn_p (insn))
+       break;
+    }
 
-const_rtx
-const_prev_active_insn (const_rtx insn)
-{
-  PREV_ACTIVE_INSN_BODY;
+  return insn;
 }
 
-#undef PREV_ACTIVE_INSN_BODY
-
 /* Return the next CODE_LABEL after the insn INSN, or 0 if there is none.  */
 
-#define NEXT_LABEL_BODY do { \
-  while (insn) \
-    { \
-      insn = NEXT_INSN (insn); \
-      if (insn == 0 || LABEL_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 next_label (rtx insn)
 {
-  NEXT_LABEL_BODY;
-}
+  while (insn)
+    {
+      insn = NEXT_INSN (insn);
+      if (insn == 0 || LABEL_P (insn))
+       break;
+    }
 
-const_rtx
-const_next_label (const_rtx insn)
-{
-  NEXT_LABEL_BODY;
+  return insn;
 }
 
-#undef NEXT_LABEL_BODY
-
 /* Return the last CODE_LABEL before the insn INSN, or 0 if there is none.  */
 
-#define PREV_LABEL_BODY do { \
-  while (insn) \
-    { \
-      insn = PREV_INSN (insn); \
-      if (insn == 0 || LABEL_P (insn)) \
-       break; \
-    } \
-  return insn; \
-} while (0)
-
 rtx
 prev_label (rtx insn)
 {
-  PREV_LABEL_BODY;
-}
+  while (insn)
+    {
+      insn = PREV_INSN (insn);
+      if (insn == 0 || LABEL_P (insn))
+       break;
+    }
 
-const_rtx
-const_prev_label (const_rtx insn)
-{
-  PREV_LABEL_BODY;
+  return insn;
 }
 
-#undef PREV_LABEL_BODY
-
 /* Return the last label to mark the same position as LABEL.  Return null
    if LABEL itself is null.  */
 
index ba539ac7e5025c29787bfad90cf1ff2897d91661..74f9ffb9f72c93224f8acc79385506e461fe1266 100644 (file)
@@ -396,7 +396,9 @@ try_catch_may_fallthru (const_tree stmt)
 bool
 block_may_fallthru (const_tree block)
 {
-  const_tree stmt = const_expr_last (block);
+  /* This CONST_CAST is okay because expr_last returns it's argument
+     unmodified and we assign it to a const_tree.  */
+  const_tree stmt = expr_last ((tree)CONST_CAST(block));
 
   switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
     {
index 959b79af54b5866a7a313b3e46beaec9052245d5..7a040d11aa563def7f4304df4898699b0e9d62da 100644 (file)
@@ -299,9 +299,12 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
       if (! insn)
        return UNKNOWN;
 
-      for (prev = const_prev_nonnote_insn (insn);
+      /* These CONST_CAST's are okay because prev_nonnote_insn just
+        returns it's argument and we assign it to a const_rtx
+        variable.  */
+      for (prev = prev_nonnote_insn ((rtx)(CONST_CAST(insn)));
           prev != 0 && !LABEL_P (prev);
-          prev = const_prev_nonnote_insn (prev))
+          prev = prev_nonnote_insn ((rtx)(CONST_CAST(prev))))
        {
          const_rtx set = set_of (arg0, prev);
          if (set && GET_CODE (set) == SET
index 5484df11a3c2877c7bd6a4f4ab43aad6bc482e56..0a114c3dbbdca9ce9300b1c6ae7b8b3426f5265a 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1593,26 +1593,16 @@ extern rtx make_jump_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx last_call_insn (void);
 extern rtx previous_insn (rtx);
-extern const_rtx const_previous_insn (const_rtx);
 extern rtx next_insn (rtx);
-extern const_rtx const_next_insn (const_rtx);
 extern rtx prev_nonnote_insn (rtx);
-extern const_rtx const_prev_nonnote_insn (const_rtx);
 extern rtx next_nonnote_insn (rtx);
-extern const_rtx const_next_nonnote_insn (const_rtx);
 extern rtx prev_real_insn (rtx);
-extern const_rtx const_prev_real_insn (const_rtx);
 extern rtx next_real_insn (rtx);
-extern const_rtx const_next_real_insn (const_rtx);
 extern rtx prev_active_insn (rtx);
-extern const_rtx const_prev_active_insn (const_rtx);
 extern rtx next_active_insn (rtx);
-extern const_rtx const_next_active_insn (const_rtx);
 extern int active_insn_p (const_rtx);
 extern rtx prev_label (rtx);
-extern const_rtx const_prev_label (const_rtx);
 extern rtx next_label (rtx);
-extern const_rtx const_next_label (const_rtx);
 extern rtx skip_consecutive_labels (rtx);
 extern rtx next_cc0_user (rtx);
 extern rtx prev_cc0_setter (rtx);
index 4a4a62904b547ccc429adcb21c941822d3f018dc..1d90a1207fba3bb3e0581b27fe029d334b033e76 100644 (file)
@@ -3392,7 +3392,10 @@ keep_with_call_p (const_rtx insn)
         if we can break or not.  */
       if (SET_DEST (set) == stack_pointer_rtx)
        {
-         const_rtx i2 = const_next_nonnote_insn (insn);
+         /* This CONST_CAST is okay because next_nonnote_insn just
+            returns it's argument and we assign it to a const_rtx
+            variable.  */
+         const_rtx i2 = next_nonnote_insn ((rtx)CONST_CAST(insn));
          if (i2 && keep_with_call_p (i2))
            return true;
        }
index 0225d8b8302d4d37abf5bad43f7c9bca2fefe903..84ddf4953abdd18edb79ef7cbeeee40b390eaa67 100644 (file)
@@ -772,8 +772,15 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
    the C standard definitions or prototypes force you to.  E.g. if you
    need to free a const object, or if you pass a const string to
    execv, et al.  Another valid use would be in an allocation function
-   that creates const objects that need to be initialized.  Most other
-   cases should be viewed with extreme caution.  */
+   that creates const objects that need to be initialized.  In some
+   cases we have non-const functions that return the argument
+   (e.g. next_nonnote_insn).  Rather than create const shadow
+   functions, we can cast away const-ness in calling these interfaces
+   if we're careful to verify that the called function does indeed not
+   modify its argument and the return value is only used in a const
+   context.  (This can be somewhat dangerous as these assumptions can
+   change after the fact).  Beyond these uses, most other cases of
+   using this macro should be viewed with extreme caution.  */
 
 #if defined(__GNUC__) && GCC_VERSION != 4000
 /* GCC 4.0.x has a bug where it may ICE on this expression.  */
index e70b440dfc2e85c6c9855ab62d6da418a513aa37..947b8deaa5ffaf5fe114111ae53912e872d7b869 100644 (file)
@@ -1158,7 +1158,9 @@ tree_can_merge_blocks_p (const_basic_block a, const_basic_block b)
 
   /* If A ends by a statement causing exceptions or something similar, we
      cannot merge the blocks.  */
-  stmt = const_last_stmt (a);
+  /* This CONST_CAST is okay because last_stmt doesn't modify its
+     argument and the return value is assign to a const_tree.  */
+  stmt = last_stmt ((basic_block)CONST_CAST(a));
   if (stmt && stmt_ends_bb_p (stmt))
     return false;
 
@@ -2592,13 +2594,6 @@ first_stmt (basic_block bb)
   return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
 }
 
-const_tree
-const_first_stmt (const_basic_block bb)
-{
-  const_block_stmt_iterator i = cbsi_start (bb);
-  return !cbsi_end_p (i) ? cbsi_stmt (i) : NULL_TREE;
-}
-
 /* Return the last statement in basic block BB.  */
 
 tree
@@ -2608,13 +2603,6 @@ last_stmt (basic_block bb)
   return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
 }
 
-const_tree
-const_last_stmt (const_basic_block bb)
-{
-  const_block_stmt_iterator b = cbsi_last (bb);
-  return !cbsi_end_p (b) ? cbsi_stmt (b) : NULL_TREE;
-}
-
 /* Return the last statement of an otherwise empty block.  Return NULL
    if the block is totally empty, or if it contains more than one
    statement.  */
@@ -5932,7 +5920,9 @@ tree_block_ends_with_call_p (const_basic_block bb)
 static bool
 tree_block_ends_with_condjump_p (const_basic_block bb)
 {
-  const_tree stmt = const_last_stmt (bb);
+  /* This CONST_CAST is okay because last_stmt doesn't modify its
+     argument and the return value is not modified.  */
+  const_tree stmt = last_stmt ((basic_block)CONST_CAST(bb));
   return (stmt && TREE_CODE (stmt) == COND_EXPR);
 }
 
index 044a520b7105b1333ec7ed2efaad164489b75d18..e2eb882231744709899cbf008465764d14acc0b2 100644 (file)
@@ -740,9 +740,7 @@ extern void print_loop_ir (FILE *);
 extern void cleanup_dead_labels (void);
 extern void group_case_labels (void);
 extern tree first_stmt (basic_block);
-extern const_tree const_first_stmt (const_basic_block);
 extern tree last_stmt (basic_block);
-extern const_tree const_last_stmt (const_basic_block);
 extern tree last_and_only_stmt (basic_block);
 extern edge find_taken_edge (basic_block, tree);
 extern basic_block label_to_block_fn (struct function *, tree);
index 1e7a682d3915a2f37244d763b47989ffa6e678fe..a49744cf6c0108a288a4416561c78d441c898eb6 100644 (file)
@@ -299,29 +299,22 @@ tsi_split_statement_list_before (tree_stmt_iterator *i)
 /* Return the first expression in a sequence of COMPOUND_EXPRs,
    or in a STATEMENT_LIST.  */
 
-#define EXPR_FIRST_BODY do { \
-  if (expr == NULL_TREE) \
-    return expr; \
-  if (TREE_CODE (expr) == STATEMENT_LIST) \
-    { \
-      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr); \
-      return n ? n->stmt : NULL_TREE; \
-    } \
-  while (TREE_CODE (expr) == COMPOUND_EXPR) \
-    expr = TREE_OPERAND (expr, 0); \
-  return expr; \
-} while (0)
-
 tree
 expr_first (tree expr)
 {
-  EXPR_FIRST_BODY;
-}
+  if (expr == NULL_TREE)
+    return expr;
 
-const_tree
-const_expr_first (const_tree expr)
-{
-  EXPR_FIRST_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
+      return n ? n->stmt : NULL_TREE;
+    }
+
+  while (TREE_CODE (expr) == COMPOUND_EXPR)
+    expr = TREE_OPERAND (expr, 0);
+
+  return expr;
 }
 
 /* Return the last expression in a sequence of COMPOUND_EXPRs,
@@ -343,45 +336,44 @@ const_expr_first (const_tree expr)
 tree
 expr_last (tree expr)
 {
-  EXPR_LAST_BODY;
-}
+  if (expr == NULL_TREE)
+    return expr;
 
-const_tree
-const_expr_last (const_tree expr)
-{
-  EXPR_LAST_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
+      return n ? n->stmt : NULL_TREE;
+    }
+
+  while (TREE_CODE (expr) == COMPOUND_EXPR)
+    expr = TREE_OPERAND (expr, 1);
+
+  return expr;
 }
 
 /* If EXPR is a single statement return it.  If EXPR is a
    STATEMENT_LIST containing exactly one statement S, return S.
    Otherwise, return NULL.  */
 
-#define EXPR_ONLY_BODY do { \
-  if (expr == NULL_TREE) \
-    return NULL_TREE; \
-  if (TREE_CODE (expr) == STATEMENT_LIST) \
-    { \
-      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
-      if (n && STATEMENT_LIST_HEAD (expr) == n) \
-       return n->stmt; \
-      else \
-       return NULL_TREE; \
-    } \
-  if (TREE_CODE (expr) == COMPOUND_EXPR) \
-    return NULL_TREE; \
-  return expr; \
-} while (0)
-
 tree 
 expr_only (tree expr)
 {
-  EXPR_ONLY_BODY;
-}
+  if (expr == NULL_TREE)
+    return NULL_TREE;
 
-const_tree 
-const_expr_only (const_tree expr)
-{
-  EXPR_ONLY_BODY;
+  if (TREE_CODE (expr) == STATEMENT_LIST)
+    {
+      struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
+      if (n && STATEMENT_LIST_HEAD (expr) == n)
+       return n->stmt;
+      else
+       return NULL_TREE;
+    }
+
+  if (TREE_CODE (expr) == COMPOUND_EXPR)
+    return NULL_TREE;
+
+  return expr;
 }
 
 #include "gt-tree-iterator.h"
index c9587aafb26c77471d76fbf26885c68c05c71537..d04c1f0222b9b785a439b85b4adc3ac07680c155 100644 (file)
@@ -3809,28 +3809,19 @@ is_attribute_p (const char *attr, const_tree ident)
    returns the first occurrence; the TREE_CHAIN of the return value should
    be passed back in if further occurrences are wanted.  */
 
-#define LOOKUP_ATTRIBUTE_BODY(TYPE) do { \
-  TYPE l; \
-  size_t attr_len = strlen (attr_name); \
-  for (l = list; l; l = TREE_CHAIN (l)) \
-    { \
-      gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); \
-      if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l))) \
-       return l; \
-    } \
-  return NULL_TREE; \
-} while (0)
-
 tree
 lookup_attribute (const char *attr_name, tree list)
 {
-  LOOKUP_ATTRIBUTE_BODY(tree);
-}
+  tree l;
+  size_t attr_len = strlen (attr_name);
 
-const_tree
-const_lookup_attribute (const char *attr_name, const_tree list)
-{
-  LOOKUP_ATTRIBUTE_BODY(const_tree);
+  for (l = list; l; l = TREE_CHAIN (l))
+    {
+      gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE);
+      if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l)))
+       return l;
+    }
+  return NULL_TREE;
 }
 
 /* Remove any instances of attribute ATTR_NAME in LIST and return the
@@ -4800,10 +4791,14 @@ attribute_list_contained (const_tree l1, const_tree l2)
   for (; t2 != 0; t2 = TREE_CHAIN (t2))
     {
       const_tree attr;
-      for (attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
+      /* This CONST_CAST is okay because lookup_attribute does not
+        modify its argument and the return value is assigned to a
+        const_tree.  */
+      for (attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
+                                   (tree)CONST_CAST(l1));
           attr != NULL_TREE;
-          attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
-                                         TREE_CHAIN (attr)))
+          attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
+                                   TREE_CHAIN (attr)))
        {
          if (TREE_VALUE (t2) != NULL
              && TREE_CODE (TREE_VALUE (t2)) == TREE_LIST
index 4985fa903d635536e86f276fdf37f0981e618627..23916cfebb87aa2efcc4c31dd6b3d29aaa697750 100644 (file)
@@ -4156,7 +4156,6 @@ extern int is_attribute_p (const char *, const_tree);
    of the attribute or NULL_TREE if not found.  */
 
 extern tree lookup_attribute (const char *, tree);
-extern const_tree const_lookup_attribute (const char *, const_tree);
 
 /* Remove any instances of attribute ATTR_NAME in LIST and return the
    modified list.  */
@@ -4303,11 +4302,8 @@ extern tree non_lvalue (tree);
 extern tree convert (tree, tree);
 extern unsigned int expr_align (const_tree);
 extern tree expr_first (tree);
-extern const_tree const_expr_first (const_tree);
 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 (const_tree);
 extern HOST_WIDE_INT int_size_in_bytes (const_tree);
 extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);