Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/proto-attribute-4.mm

raw
1 /* Contributed by Nicola Pero <[email protected]>, December 2010. */
2 /* { dg-do compile } */
3 /* { dg-additional-options "-Wno-objc-root-class" } */
4
5 /* Test that you get a warning when an unknown protocol attribute is ignored. */
6
7 #include <objc/objc.h>
8
9 __attribute__ ((unknown_attribute))
10 @protocol MyProtocol /* { dg-warning "ignored" } */
11 - (id) new;
12 @end
13
14 __attribute__ ((unknown_attribute))
15 @protocol MyProtocol2; /* { dg-warning "ignored" } */
16
17 /* Use the protocols to double-check that no more warnings are
18 generated. */
19
20 @interface MyClass <MyProtocol>
21 @end
22
23 int test (id <MyProtocol2> x)
24 {
25 if (@protocol (MyProtocol) == @protocol (MyProtocol2))
26 return 1;
27
28 if (x)
29 return 2;
30
31 return 3;
32 }