aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/super-dealloc-1.m
blob: b87af92186066847004dfbba628ad995d3080bf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* APPLE LOCAL file ObjC super dealloc */
/* Check for warnings about missing [super dealloc] calls.  */
/* Author: Ziemowit Laski <zlaski@apple.com>  */

/* { dg-do compile } */

@interface Foo {
  void *isa;
}
- (void) dealloc;
- (void) some_other;
@end

@interface Bar: Foo {
  void *casa;
}
- (void) dealloc;
@end

@interface Baz: Bar {
  void *usa;
}
- (void) dealloc;
@end

@implementation Foo
- (void) dealloc {
  isa = 0;   /* Should not warn here.  */
}
- (void) some_other {
  isa = (void *)-1;
}
@end

@implementation Bar
- (void) dealloc {
  casa = 0;
  [super some_other];
}  /* { dg-warning "method possibly missing a .super dealloc. call" } */
@end

@implementation Baz
- (void) dealloc {
  usa = 0;
  [super dealloc];  /* Should not warn here.  */
}
@end