aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/class-attribute-1.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/attributes/class-attribute-1.m')
-rw-r--r--gcc/testsuite/objc.dg/attributes/class-attribute-1.m66
1 files changed, 45 insertions, 21 deletions
diff --git a/gcc/testsuite/objc.dg/attributes/class-attribute-1.m b/gcc/testsuite/objc.dg/attributes/class-attribute-1.m
index 802c211..2529323 100644
--- a/gcc/testsuite/objc.dg/attributes/class-attribute-1.m
+++ b/gcc/testsuite/objc.dg/attributes/class-attribute-1.m
@@ -1,36 +1,60 @@
/* { dg-do compile } */
-#include <objc/objc.h>
-#include "../../objc-obj-c++-shared/Object1.h"
+/* Test deprecate attribute with an @interface declaration. */
-/* Normal deprecated func. */
-__attribute ((deprecated)) void f1();
-__attribute__ ((deprecated("use some new func"))) void f2();
+#include <objc/objc.h>
+#include <objc/runtime.h>
__attribute__ ((deprecated))
-@interface DEPRECATED : Object
- { @public int ivar; } /* { dg-warning "class attributes are not available in this version" } */
- - (int) instancemethod;
+@interface DeprecatedClass
+{
+ Class isa;
+}
++ (id) classObject;
++ (id) new;
@end
-@implementation DEPRECATED
--(int) instancemethod { return ivar; }
+@implementation DeprecatedClass
++ (id) classObject { return self; }
++ (id) new { return nil; }
@end
-@interface DEPRECATED (Category)
-@end /* dg - warning "deprecated" */
+@interface DeprecatedClass (Category)
+@end /* { dg-warning "is deprecated" } */
-@interface NS : DEPRECATED
-@end /* dg - warning "deprecated" */
+@interface Subclass : DeprecatedClass
+@end /* { dg-warning "is deprecated" } */
+
+DeprecatedClass *object; /* { dg-warning "is deprecated" } */
+
+int function (DeprecatedClass *object) /* { dg-warning "is deprecated" } */
+{
+ /* Note how the following deprecation warning is generated by
+ "DeprecatedClass *", not by "[DeprecatedClass ...]. */
+ DeprecatedClass *x = [DeprecatedClass new]; /* { dg-warning "is deprecated" } */
+
+ if (x == object)
+ return 0;
+ else
+ return 1;
+}
-DEPRECATED * deprecated_obj; /* dg - warning "deprecated" */
+id function2 (void)
+{
+ return DeprecatedClass.classObject; /* { dg-warning "is deprecated" } */
+}
-int foo (DEPRECATED *unavailable_obj) /* dg - warning "deprecated" */
+@interface NormalClass
{
- DEPRECATED *p = [DEPRECATED new]; /* dg - warning "deprecated" */
+ Class isa;
+ DeprecatedClass *object; /* { dg-warning "is deprecated" } */
+}
+- (DeprecatedClass *)method; /* { dg-warning "is deprecated" } */
+@end
- f1(); /* { dg-warning "'f1' is deprecated" } */
- f2(); /* { dg-warning "'f2' is deprecated .declared at \[^\\)\]*.: use some new func" } */
- int q = p->ivar;
- return [p instancemethod];
+@implementation NormalClass
+- (DeprecatedClass *)method /* { dg-warning "is deprecated" } */
+{
+ return nil;
}
+@end