diff mbox

wide-int, objc

Message ID 72395AA1-BD40-411C-9F1A-AD21AAD07A6F@comcast.net
State New
Headers show

Commit Message

Mike Stump Nov. 23, 2013, 7:22 p.m. UTC
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.

Comments

Mike Stump Nov. 23, 2013, 7:39 p.m. UTC | #1
On Nov 23, 2013, at 11:22 AM, Mike Stump <mikestump@comcast.net> wrote:
> 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?

Ok.
diff mbox

Patch

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);
 		}