aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm')
-rw-r--r--gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm b/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
new file mode 100644
index 000000000..d2e5f28a1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm
@@ -0,0 +1,31 @@
+/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
+/* { dg-do compile } */
+
+/* Test that you get a warning when an unknown protocol attribute is ignored. */
+
+#include <objc/objc.h>
+
+__attribute__ ((unknown_attribute))
+@protocol MyProtocol /* { dg-warning "ignored" } */
+- (id) new;
+@end
+
+__attribute__ ((unknown_attribute))
+@protocol MyProtocol2; /* { dg-warning "ignored" } */
+
+/* Use the protocols to double-check that no more warnings are
+ generated. */
+
+@interface MyClass <MyProtocol>
+@end
+
+int test (id <MyProtocol2> x)
+{
+ if (@protocol (MyProtocol) == @protocol (MyProtocol2))
+ return 1;
+
+ if (x)
+ return 2;
+
+ return 3;
+}