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

Subversion Repositories openrisc

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Test basic Objective-C foreach syntax.  This tests warnings and errors.  */
2
/* { dg-do compile } */
3
 
4
#import "../objc-obj-c++-shared/TestsuiteObject.h"
5
#import <objc/objc.h>
6
#undef  nil
7
#define nil ((id)0)
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 TestsuiteObject (NSFastEnumeration)
18
- (unsigned long)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state
19
                                     objects:(id *)stackbuf
20
                                       count:(unsigned int)len;
21
- (id) enumerator;
22
@end
23
 
24
void function (void)
25
{
26
  return;
27
}
28
 
29
id object_function (void)
30
{
31
  return nil;
32
}
33
 
34
int main (void)
35
{
36
  id array = nil;
37
  id object = nil;
38
 
39
  for (typedef int my_typedef in array) /* { dg-error "declaration of non-variable" } */
40
    ;                                   /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 39 } */
41
 
42
  for (function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
43
    ;                      /* { dg-error "iterating variable in fast enumeration is not an object" "" { target *-*-* } 42 } */
44
 
45
  for (object_function () in nil) /* { dg-error "invalid iterating variable in fast enumeration" } */
46
    ;
47
 
48
  for ([object enumerator] in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
49
    ;
50
 
51
  for (object = nil in array) /* { dg-error "invalid iterating variable in fast enumeration" } */
52
    ;
53
 
54
  for (id key, value in array) /* { dg-error "multiple iterating variables in fast enumeration" } */
55
    ;
56
 
57
  return 0;
58
}
59
 

powered by: WebSVN 2.1.0

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