OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [foreach-8.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2
/* { dg-options "-Wall" } */
3
/* { dg-do compile } */
4
 
5
/* Test that fast enumeration loops where the iterating variable is declared
6
   but not used do not generate warnings.  */
7
 
8
/*
9
struct __objcFastEnumerationState
10
{
11
  unsigned long state;
12
  id            *itemsPtr;
13
  unsigned long *mutationsPtr;
14
  unsigned long extra[5];
15
};
16
*/
17
@interface Object
18
{
19
  Class isa;
20
}
21
- (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
22
                                     objects:(id *)stackbuf
23
                                       count:(unsigned int)len;
24
- (id) enumerator;
25
- (Class) classEnumerator;
26
@end
27
 
28
unsigned int count_objects_in_collection (id collection)
29
{
30
  unsigned int count = 0;
31
 
32
  /* The following line should generate no warnings even with
33
     -Wall.  */
34
  for (id object in collection)
35
    count++;
36
 
37
  return count;
38
}
39
 
40
unsigned int count_objects_in_collection_2 (id collection)
41
{
42
  unsigned int count = 0;
43
  id object;
44
 
45
  /* The following line should generate no warnings even with
46
     -Wall.  */
47
  for (object in collection)
48
    count++;
49
 
50
  return count;
51
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.