| 1 |
/* Check for warnings about missing [super dealloc] calls. */ |
| 2 |
/* Author: Ziemowit Laski <[email protected]> */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
// { dg-additional-options "-Wno-objc-root-class" } |
| 6 |
|
| 7 |
@interface Foo { |
| 8 |
void *isa; |
| 9 |
} |
| 10 |
- (void) dealloc; |
| 11 |
- (void) some_other; |
| 12 |
@end |
| 13 |
|
| 14 |
@interface Bar: Foo { |
| 15 |
void *casa; |
| 16 |
} |
| 17 |
- (void) dealloc; |
| 18 |
@end |
| 19 |
|
| 20 |
@interface Baz: Bar { |
| 21 |
void *usa; |
| 22 |
} |
| 23 |
- (void) dealloc; |
| 24 |
@end |
| 25 |
|
| 26 |
@implementation Foo |
| 27 |
- (void) dealloc { |
| 28 |
isa = 0; /* Should not warn here. */ |
| 29 |
} |
| 30 |
- (void) some_other { |
| 31 |
isa = (void *)-1; |
| 32 |
} |
| 33 |
@end |
| 34 |
|
| 35 |
@implementation Bar |
| 36 |
- (void) dealloc { |
| 37 |
casa = 0; |
| 38 |
[super some_other]; |
| 39 |
} /* { dg-warning "method possibly missing a .super dealloc. call" } */ |
| 40 |
@end |
| 41 |
|
| 42 |
@implementation Baz |
| 43 |
- (void) dealloc { |
| 44 |
usa = 0; |
| 45 |
[super dealloc]; /* Should not warn here. */ |
| 46 |
} |
| 47 |
@end |