don't try to run Objective-C API=2 tests for Darwin < 9
[official-gcc.git] / gcc / testsuite / obj-c++.dg / attributes / proto-attribute-2.mm
blobaba58ff33125e71f552e77baafde2e16eb8403e3
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010.  */
2 /* { dg-do compile } */
3 /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
5 /* Test deprecate attribute with a forward declarations of
6    @protocol.  */
8 #include <stdlib.h>
9 #include <objc/objc.h>
10 #include <objc/runtime.h>
12 __attribute__ ((deprecated))
13 @protocol DeprecatedProtocol1;
15 @protocol NonDeprecatedProtocol1;
17 void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */
18 void function2 (id <NonDeprecatedProtocol1> object);
20 @class Class4;
22 void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */
23 void function4 (Class4 <NonDeprecatedProtocol1> *object);
24 void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */
26 int function6 (void)
28   Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */
29   Protocol *p2 = @protocol (NonDeprecatedProtocol1);
31   return (p1 == p2);