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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [property/] [dynamic-3.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>, November 2010.  */
2
/* { dg-do compile } */
3
 
4
#include <objc/objc.h>
5
 
6
@interface MyRootClass
7
{
8
  Class isa;
9
}
10
@end
11
 
12
@implementation MyRootClass
13
@end
14
 
15
/* Test @property/@dynamic in a category.  First, a case where
16
   @dynamic should turn off all warnings.  */
17
 
18
@interface MyRootClass (Category)
19
@property int a;
20
- (int) test;
21
@end
22
@implementation MyRootClass (Category)
23
@dynamic a;
24
- (int) test
25
{
26
  return self.a; /* This should compile into [self a] with no warnings.  */
27
}
28
@end
29
 
30
 
31
 
32
/* Test @property/@dynamic in a category.  Second, a case with a
33
   missing setter and no @dynamic.  A warning should be generated.  */
34
 
35
@interface MyRootClass (Category2)
36
@property int b;
37
- (int) test;
38
@end
39
@implementation MyRootClass (Category2)
40
- (int) b
41
{
42
  return 0;
43
}
44
- (int) test
45
{
46
  return self.b;
47
}
48
@end /* { dg-warning "incomplete implementation" } */
49
/* { dg-warning "method definition for .-setB:. not found" "" { target *-*-* } 48 } */

powered by: WebSVN 2.1.0

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