PR target/84336
[official-gcc.git] / gcc / testsuite / objc.dg / attributes / proto-attribute-4.m
blob226fd68b3f2a64e26323b66db15a73f19547d31d
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2 /* { dg-do compile } */
4 /* Test that you get a warning when an unknown protocol attribute is ignored.  */
6 #include <objc/objc.h>
8 __attribute__ ((unknown_attribute))
9 @protocol MyProtocol
10 - (id) new; /* { dg-warning "ignored" } */
11 @end
13 __attribute__ ((unknown_attribute))
14 @protocol MyProtocol2; /* { dg-warning "ignored" } */
16 /* Use the protocols to double-check that no more warnings are
17    generated.  */
19 @interface MyClass <MyProtocol>
20 @end
22 int test (id <MyProtocol2> x)
24   if (@protocol (MyProtocol) == @protocol (MyProtocol2))
25     return 1;
27   if (x)
28     return 2;
30   return 3;