aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/super-dealloc-2.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/super-dealloc-2.m')
-rw-r--r--gcc/testsuite/objc.dg/super-dealloc-2.m47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/super-dealloc-2.m b/gcc/testsuite/objc.dg/super-dealloc-2.m
new file mode 100644
index 00000000000..52361277fe2
--- /dev/null
+++ b/gcc/testsuite/objc.dg/super-dealloc-2.m
@@ -0,0 +1,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) dealloc0;
+@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) dealloc0 {
+ casa = 0;
+ [super some_other]; /* Should not warn here. */
+}
+@end
+
+@implementation Baz
+- (void) dealloc {
+ usa = 0;
+ [super dealloc0];
+} /* { dg-warning "method possibly missing a .super dealloc. call" } */
+@end