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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [call-super-2.m] - Blame information for rev 324

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

Line No. Rev Author Line
1 309 jeremybenn
/* Check if casting 'self' or 'super' affects message lookup in the correct way.  */
2
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
3
/* { dg-do compile } */
4
 
5
#include "../objc-obj-c++-shared/Object1.h"
6
#include "../objc-obj-c++-shared/next-mapping.h"
7
#include <stddef.h>
8
 
9
@protocol Func
10
+ (int) class_func0;
11
- (int) instance_func0;
12
@end
13
 
14
@interface Derived: Object
15
+ (int) class_func1;
16
+ (int) class_func2;
17
+ (int) class_func3;
18
+ (int) class_func4;
19
+ (int) class_func5;
20
+ (int) class_func6;
21
+ (int) class_func7;
22
- (int) instance_func1;
23
- (int) instance_func2;
24
- (int) instance_func3;
25
- (int) instance_func4;
26
- (int) instance_func5;
27
- (int) instance_func6;
28
- (int) instance_func7;
29
@end
30
 
31
@interface Derived (Categ)
32
+ (int) categ_class_func1;
33
+ (int) categ_class_func2;
34
- (int) categ_instance_func1;
35
- (int) categ_instance_func2;
36
@end
37
 
38
@implementation Derived
39
+ (int) class_func1
40
{
41
   int i = (size_t)[self class_func0];       /* { dg-warning ".Derived. may not respond to .\\+class_func0." } */
42
   return i + (size_t)[super class_func0];   /* { dg-warning ".Object. may not respond to .\\+class_func0." } */
43
}
44
+ (int) class_func2
45
{
46
   int i = [(id <Func>)self class_func0];  /* { dg-warning ".\\-class_func0. not found in protocol" } */
47
   i += [(id <Func>)super class_func0];    /* { dg-warning ".\\-class_func0. not found in protocol" } */
48
   i += [(Class <Func>)self class_func0];
49
   return i + [(Class <Func>)super class_func0];
50
}
51
+ (int) class_func3
52
{
53
   return [(Object <Func> *)super class_func0];
54
}
55
+ (int) class_func4
56
{
57
   return [(Derived <Func> *)super class_func0];
58
}
59
+ (int) class_func5
60
{
61
   int i = (size_t)[Derived class_func0];    /* { dg-warning ".Derived. may not respond to .\\+class_func0." } */
62
   return i + (size_t)[Object class_func0];  /* { dg-warning ".Object. may not respond to .\\+class_func0." } */
63
}
64
+ (int) class_func6
65
{
66
   return (size_t)[objc_get_class("Object") class_func1];  /* { dg-warning ".Object. may not respond to .\\+class_func1." } */
67
}
68
+ (int) class_func7
69
{
70
   return [objc_get_class("Derived") class_func1];
71
}
72
- (int) instance_func1
73
{
74
   int i = (size_t)[self instance_func0];     /* { dg-warning ".Derived. may not respond to .\\-instance_func0." } */
75
   return i + (size_t)[super instance_func0]; /* { dg-warning ".Object. may not respond to .\\-instance_func0." } */
76
}
77
- (int) instance_func2
78
{
79
   return [(id <Func>)super instance_func0];
80
}
81
- (int) instance_func3
82
{
83
   return [(Object <Func> *)super instance_func0];
84
}
85
- (int) instance_func4
86
{
87
   return [(Derived <Func> *)super instance_func0];
88
}
89
- (int) instance_func5
90
{
91
   int i = (size_t)[Derived instance_func1]; /* { dg-warning ".Derived. may not respond to .\\+instance_func1." } */
92
   return i + (size_t)[Object instance_func1]; /* { dg-warning ".Object. may not respond to .\\+instance_func1." } */
93
}
94
- (int) instance_func6
95
{
96
   return (size_t)[objc_get_class("Object") class_func1]; /* { dg-warning ".Object. may not respond to .\\+class_func1." } */
97
}
98
- (int) instance_func7
99
{
100
   return [objc_get_class("Derived") class_func1];
101
}
102
@end
103
 
104
@implementation Derived (Categ)
105
+ (int) categ_class_func1
106
{
107
   int i = (size_t)[self class_func0];       /* { dg-warning ".Derived. may not respond to .\\+class_func0." } */
108
   i += [self class_func1];
109
   i += [self categ_class_func2];
110
   i += (size_t)[self categ_instance_func1]; /* { dg-warning ".Derived. may not respond to .\\+categ_instance_func1." } */
111
   return i + (size_t)[super class_func0];   /* { dg-warning ".Object. may not respond to .\\+class_func0." } */
112
}
113
+ (int) categ_class_func2
114
{
115
   int i = [(id <Func>)self class_func0];  /* { dg-warning ".\\-class_func0. not found in protocol" } */
116
   i += [(id <Func>)super class_func0];    /* { dg-warning ".\\-class_func0. not found in protocol" } */
117
   i += [(Class <Func>)self class_func0];
118
   return i + [(Class <Func>)super class_func0];
119
}
120
- (int) categ_instance_func1
121
{
122
   int i = (size_t)[self instance_func0];    /* { dg-warning ".Derived. may not respond to .\\-instance_func0." } */
123
   i += [(Derived <Func> *)self categ_instance_func2];
124
   i += (size_t)[(Object <Func> *)self categ_instance_func2]; /* { dg-warning ".Object. may not respond to .\\-categ_instance_func2." } */
125
   /* { dg-warning ".\\-categ_instance_func2. not found in protocol" "" { target *-*-* } 124 } */
126
   i += (size_t)[(id <Func>)self categ_instance_func2];  /* { dg-warning ".\\-categ_instance_func2. not found in protocol" } */
127
   i += [(id)self categ_instance_func2];
128
   return i + (size_t)[super instance_func0];   /* { dg-warning ".Object. may not respond to .\\-instance_func0." } */
129
}
130
- (int) categ_instance_func2
131
{
132
   return [(id <Func>)super instance_func0];
133
}
134
@end
135
 
136
/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 0 } */
137
/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 0 } */
138
/* { 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.