aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
new file mode 100644
index 000000000..90369cc66
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+
+#include <objc/objc.h>
+#include "../../objc-obj-c++-shared/TestsuiteObject.h"
+
+@interface obj : TestsuiteObject {
+@public
+ int var;
+}
+- (int) depmth __attribute__((deprecated));
+- (int) depmtharg:(int) iarg __attribute__((deprecated));
+- (int) unusedarg:(int) __attribute__((unused)) uarg ;
+- (int) depunusedarg:(int) __attribute__((unused)) uarg __attribute__((deprecated)) ;
+@end
+
+@implementation obj
+- (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes can not be specified in @implementation context" } */
+- (int) depmtharg:(int) iarg { return var + iarg ; }
+- (int) unusedarg:(int) __attribute__((unused)) uarg { return var; }
+- (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; }
+@end
+
+int foo (void)
+{
+ obj *p = [obj new];
+
+ [p depmth]; /* { dg-warning "is deprecated" } */
+ [p depmtharg:1]; /* { dg-warning "is deprecated" } */
+ [p unusedarg:2]; /* { dg-bogus "is deprecated" } */
+ [p depunusedarg:3 ]; /* { dg-warning "is deprecated" } */
+
+ return [p depmtharg:0]; /* { dg-warning "is deprecated" } */
+}