Richi has asked the we break the wide-int patch so that the individual port and 
front end maintainers can review their parts without have to go through the 
entire patch.    This patch covers the Objective-C front end.

Ok?

objc:
        * objc-act.c: Include wide-int.h.
        (objc_decl_method_attributes): Use wide-int interfaces.


diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index d7e8afb..2c152c7 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "tree-iterator.h"
 #include "hash-table.h"
+#include "wide-int.h"
 #include "langhooks-def.h"
 /* Different initialization, code gen and meta data generation for each
    runtime.  */
@@ -4882,14 +4883,10 @@ objc_decl_method_attributes (tree *node, tree 
attributes, int flags)
                     which specifies the index of the format string
                     argument.  Add 2.  */
                  number = TREE_VALUE (second_argument);
-                 if (number
-                     && TREE_CODE (number) == INTEGER_CST
-                     && TREE_INT_CST_HIGH (number) == 0)
-                   {
-                     TREE_VALUE (second_argument)
-                       = build_int_cst (integer_type_node,
-                                        TREE_INT_CST_LOW (number) + 2);
-                   }
+                 if (number && TREE_CODE (number) == INTEGER_CST)
+                   TREE_VALUE (second_argument)
+                     = wide_int_to_tree (TREE_TYPE (number),
+                                         wi::add (number, 2));
 
                  /* This is the third argument, the "first-to-check",
                     which specifies the index of the first argument to
@@ -4897,15 +4894,10 @@ objc_decl_method_attributes (tree *node, tree 
attributes, int flags)
                     in which case we don't need to add 2.  Add 2 if not
                     0.  */
                  number = TREE_VALUE (third_argument);
-                 if (number
-                     && TREE_CODE (number) == INTEGER_CST
-                     && TREE_INT_CST_HIGH (number) == 0
-                     && TREE_INT_CST_LOW (number) != 0)
-                   {
-                     TREE_VALUE (third_argument)
-                       = build_int_cst (integer_type_node,
-                                        TREE_INT_CST_LOW (number) + 2);
-                   }
+                 if (number && TREE_CODE (number) == INTEGER_CST)
+                   TREE_VALUE (third_argument)
+                     = wide_int_to_tree (TREE_TYPE (number),
+                                         wi::add (number, 2));
                }
              filtered_attributes = chainon (filtered_attributes,
                                             new_attribute);
@@ -4937,15 +4929,11 @@ objc_decl_method_attributes (tree *node, tree 
attributes, int flags)
                {
                  /* Get the value of the argument and add 2.  */
                  tree number = TREE_VALUE (argument);
-                 if (number
-                     && TREE_CODE (number) == INTEGER_CST
-                     && TREE_INT_CST_HIGH (number) == 0
-                     && TREE_INT_CST_LOW (number) != 0)
-                   {
-                     TREE_VALUE (argument)
-                       = build_int_cst (integer_type_node,
-                                        TREE_INT_CST_LOW (number) + 2);
-                   }
+                 if (number && TREE_CODE (number) == INTEGER_CST
+                     && !wi::eq_p (number, 0))
+                   TREE_VALUE (argument)
+                     = wide_int_to_tree (TREE_TYPE (number),
+                                         wi::add (number, 2));
                  argument = TREE_CHAIN (argument);
                }
 

Reply via email to