diff mbox

[ObjC] In fast enumeration, notice that we've used a collection.

Message ID 9C5DB7ED-EFF2-4CC3-B908-EF123E2E9C50@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Jan. 8, 2011, 3:55 p.m. UTC
Hi,
Currently,

  for (obj in collection)
     ....

will give "unused" errors for  "collection".

the attached patch marks them...
... it is sufficient to add -Wall to foreach-1.m to test this, rather  
than create a new test-case.
(but can create one if you'd prefer)

OK for trunk?
Iain

    /*  __objc_foreach_enum_state.state = 0; */
    t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref  
(objc_foreach_enum_state_decl,

Comments

Mike Stump Jan. 8, 2011, 6:47 p.m. UTC | #1
On Jan 8, 2011, at 7:55 AM, IainS <developer@sandoe-acoustics.co.uk> wrote:q
> the attached patch marks them...

> OK for trunk?

Ok.
diff mbox

Patch

Index: gcc/objc/objc-act.c
===================================================================
--- gcc/objc/objc-act.c	(revision 168596)
+++ gcc/objc/objc-act.c	(working copy)
@@ -13635,6 +13635,8 @@  objc_finish_foreach_loop (location_t location,  
tre
    t = build2 (MODIFY_EXPR, void_type_node,  
objc_foreach_collection_decl, collection_expression);
    SET_EXPR_LOCATION (t, location);
    append_to_statement_list (t, &BIND_EXPR_BODY (bind));
+  /* We have used 'collection_expression'.  */
+  mark_exp_read (collection_expression);