URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [foreach-8.m] - Rev 754
Go to most recent revision | Compare with Previous | Blame | View Log
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */ /* { dg-options "-Wall" } */ /* { dg-do compile } */ /* Test that fast enumeration loops where the iterating variable is declared but not used do not generate warnings. */ /* struct __objcFastEnumerationState { unsigned long state; id *itemsPtr; unsigned long *mutationsPtr; unsigned long extra[5]; }; */ @interface Object { Class isa; } - (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects:(id *)stackbuf count:(unsigned int)len; - (id) enumerator; - (Class) classEnumerator; @end unsigned int count_objects_in_collection (id collection) { unsigned int count = 0; /* The following line should generate no warnings even with -Wall. */ for (id object in collection) count++; return count; } unsigned int count_objects_in_collection_2 (id collection) { unsigned int count = 0; id object; /* The following line should generate no warnings even with -Wall. */ for (object in collection) count++; return count; }
Go to most recent revision | Compare with Previous | Blame | View Log