| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ |
| 4 |
|
| 5 |
/* Test deprecate attribute with a forward declarations of |
| 6 |
@protocol. */ |
| 7 |
|
| 8 |
#include <stdlib.h> |
| 9 |
#include <objc/objc.h> |
| 10 |
#include <objc/runtime.h> |
| 11 |
|
| 12 |
__attribute__ ((deprecated)) |
| 13 |
@protocol DeprecatedProtocol1; |
| 14 |
|
| 15 |
@protocol NonDeprecatedProtocol1; |
| 16 |
|
| 17 |
void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */ |
| 18 |
void function2 (id <NonDeprecatedProtocol1> object); |
| 19 |
|
| 20 |
@class Class4; |
| 21 |
|
| 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" } */ |
| 25 |
|
| 26 |
int function6 (void) |
| 27 |
{ |
| 28 |
Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ |
| 29 |
Protocol *p2 = @protocol (NonDeprecatedProtocol1); |
| 30 |
|
| 31 |
return (p1 == p2); |
| 32 |
} |
| 33 |
|