Fix for objc/45925

Submitted by Nicola Pero on Oct. 7, 2010, 10 a.m.

Details

Message ID 1286445648.219627643@192.168.2.230
State New
Headers show

Commit Message

Nicola Pero Oct. 7, 2010, 10 a.m.
Ok, here's the revised patch

Ok to apply ?

Thanks

Comments

Mike Stump Oct. 7, 2010, 2:57 p.m.
On Oct 7, 2010, at 3:00 AM, "Nicola Pero" <nicola.pero@meta-innovation.com> wrote:
> Ok, here's the revised patch
> 
> Ok to apply ?

Ok.
>

Patch hide | download patch | download mbox

Index: doc/objc.texi
===================================================================
--- doc/objc.texi       (revision 165067)
+++ doc/objc.texi       (working copy)
@@ -955,3 +955,8 @@  object is added or removed).  Or, if you are conte
 mutation checks, it could point to the number of objects in your
 collection or some other value that can be checked to perform an
 approximate check that the collection has not been mutated.
+
+Finally, note how we declared the @code{len} argument and the return
+value to be of type @code{unsigned long}.  They could also be declared
+to be of type @code{unsigned int} and everything would still work.
+
Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c     (revision 165067)
+++ objc/objc-act.c     (working copy)
@@ -10325,7 +10325,8 @@  objc_finish_foreach_loop (location_t location, tre
                                    (NULL_TREE, build_int_cst (NULL_TREE, 16), NULL_TREE))));
   }
 #endif
-  t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl, t);
+  t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl,
+             convert (long_unsigned_type_node, t));
   SET_EXPR_LOCATION (t, location);
   append_to_statement_list (t, &BIND_EXPR_BODY (bind));
 
@@ -10498,7 +10499,8 @@  objc_finish_foreach_loop (location_t location, tre
                                    (NULL_TREE, build_int_cst (NULL_TREE, 16), NULL_TREE))));
   }
 #endif
-  t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl, t);
+  t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl, 
+             convert (long_unsigned_type_node, t));
   SET_EXPR_LOCATION (t, location);
   append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
 
Index: objc/ChangeLog
===================================================================
--- objc/ChangeLog      (revision 165067)
+++ objc/ChangeLog      (working copy)
@@ -1,3 +1,9 @@ 
+2010-10-07  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR objc/45925
+       * objc-act.c (objc_finish_foreach_loop): Convert return value of
+       countByEnumeratingWithState:objects:count: to long unsigned int.
+
 2010-10-06  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * README: Obsolete file removed.
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 165067)
+++ ChangeLog   (working copy)
@@ -1,3 +1,9 @@ 
+2010-10-07  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * doc/objc.texi (Fast enumeration protocol): Mention that
+       'unsigned int' can also be used instead of 'unsigned long' in
+       countByEnumeratingWithState:objects:count:.
+
 2010-10-06  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * config/spu/spu-c.c (spu_resolve_overloaded_builtin): Don't use