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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [proto-hier-1.m] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for handling of protocol hierarchies.  */
2
/* Author: Ziemowit Laski <zlaski@apple.com>.  */
3
/* { dg-do compile } */
4
 
5
/* One-line substitute for objc/objc.h */
6
typedef struct objc_object { struct objc_class *class_pointer; } *id;
7
 
8
@protocol NSObj
9
- (void)someMethod;
10
@end
11
 
12
@protocol NSCopying
13
- (void)someOtherMethod;
14
@end
15
 
16
@interface NSObject <NSObj>
17
- (void)someMethod;
18
@end
19
 
20
@implementation NSObject
21
- (void)someMethod {}
22
@end
23
 
24
@protocol Booing <NSObj>
25
- (void)boo;
26
@end
27
 
28
@interface Boo: NSObject <Booing>  // protocol has only one parent
29
@end
30
 
31
@implementation Boo
32
- (void)boo {}
33
@end
34
 
35
@protocol Fooing <NSCopying, NSObj>  // Fooing has two parent protocols
36
- (void)foo;
37
@end
38
 
39
@interface Foo: NSObject <Fooing>
40
@end
41
 
42
@implementation Foo
43
- (void)foo {}
44
- (void)someOtherMethod {}
45
@end
46
 
47
int foo(void) {
48
  id<Booing, Fooing> stupidVar;
49
  [stupidVar boo];
50
  [stupidVar foo];
51
  [stupidVar anotherMsg]; /* { dg-warning ".\\-anotherMsg. not found in protocol" } */
52
       /* { dg-warning "no .\\-anotherMsg. method found" "" { target *-*-* } 51 } */
53
  return 0;
54
}
55
 
56
/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */
57
/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */
58
/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 0 } */

powered by: WebSVN 2.1.0

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