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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [protocol-inheritance-2.m] - Blame information for rev 714

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

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2
/* { dg-do compile } */
3
 
4
#include <objc/objc.h>
5
 
6
/* Test standard warnings when a class conforms to a protocol but some
7
   methods are implemented in the superclass.  Use -Wno-protocol to
8
   turn these off.  */
9
 
10
@protocol MyProtocol
11
- (int)method;
12
@end
13
 
14
@protocol MyProtocol2
15
- (int)method2;
16
@end
17
 
18
/* The superclass implements the method required by the protocol.  */
19
@interface MyRootClass
20
{
21
  Class isa;
22
}
23
- (int)method;
24
@end
25
 
26
@implementation MyRootClass
27
- (int)method
28
{
29
  return 23;
30
}
31
@end
32
 
33
/* The subclass inherits the method (does not implement it directly)
34
   and unless -Wno-protocol is used, we emit a warning.  */
35
@interface MySubClass : MyRootClass <MyProtocol>
36
@end
37
 
38
@implementation MySubClass
39
@end
40
 
41
/* { dg-warning "incomplete implementation of class .MySubClass." "" { target *-*-* } 39 } */
42
/* { dg-warning "method definition for .\\-method. not found" "" { target *-*-* } 39 } */
43
/* { dg-warning "class .MySubClass. does not fully implement the .MyProtocol. protocol" "" { target *-*-* } 39 } */
44
 
45
 
46
/* The subclass instead does not inherit the method method2 (and does
47
   not implement it directly) so it does not conform to the
48
   protocol MyProtocol2.  */
49
@interface MySubClass2 : MyRootClass <MyProtocol2>
50
@end
51
 
52
@implementation MySubClass2
53
@end /* Warnings here, below.  */
54
 
55
/* { dg-warning "incomplete implementation of class .MySubClass2." "" { target *-*-* } 53 } */
56
/* { dg-warning "method definition for .\\-method2. not found" "" { target *-*-* } 53 } */
57
/* { dg-warning "class .MySubClass2. does not fully implement the .MyProtocol2. protocol" "" { target *-*-* } 53 } */

powered by: WebSVN 2.1.0

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