diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-12-06 21:27:01 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-12-06 21:27:01 +0000 |
commit | 69a9720167ffd3c3ea66187f318f2efbe16e82c5 (patch) | |
tree | 93b00dadc4940e81c3e6032ee733ef0eb44650e9 /gcc/objc | |
parent | 85b40c3ac73fb23bc400953a888209743de3c7bf (diff) | |
download | gcc-69a9720167ffd3c3ea66187f318f2efbe16e82c5.zip gcc-69a9720167ffd3c3ea66187f318f2efbe16e82c5.tar.gz gcc-69a9720167ffd3c3ea66187f318f2efbe16e82c5.tar.bz2 |
In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_parser_for_statement): Use c_fully_fold() instead
of c_process_expr_stmt() for the iterating and collection
expressions of an Objective-C fast enumeration loop.
In gcc/objc/:
2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_finish_foreach_loop): Mark the
object_expression as used.
In gcc/testsuite/:
2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/foreach-8.m: New.
From-SVN: r167518
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 99df784..f3001e5 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,5 +1,10 @@ 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> + * objc-act.c (objc_finish_foreach_loop): Mark the + object_expression as used. + +2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com> + * objc-act.c: Include c-family/c-objc.h. * objc-lang.c: Same change. * Make-lang.in (objc/objc-act.o): Depend on diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 49e2442..f530556 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -13290,6 +13290,18 @@ objc_finish_foreach_loop (location_t location, tree object_expression, tree coll /* type object; */ /* Done by c-parser.c. */ + /* Disable warnings that 'object' is unused. For example the code + + for (id object in collection) + i++; + + which can be used to count how many objects there are in the + collection is fine and should generate no warnings even if + 'object' is technically unused. */ + TREE_USED (object_expression) = 1; + if (DECL_P (object_expression)) + DECL_READ_P (object_expression) = 1; + /* id __objc_foreach_collection */ objc_foreach_collection_decl = objc_create_temporary_var (objc_object_type, "__objc_foreach_collection"); |