| 1 |
/* Contributed by Nicola Pero <[email protected]>, November 2010. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-additional-options "-Wno-objc-root-class" } */ |
| 4 |
|
| 5 |
/* Test deprecate attribute with a forward declarations of |
| 6 |
@protocol. */ |
| 7 |
|
| 8 |
#include <stdlib.h> |
| 9 |
#include <objc/objc.h> |
| 10 |
|
| 11 |
__attribute__ ((deprecated)) |
| 12 |
@protocol DeprecatedProtocol1; |
| 13 |
|
| 14 |
@protocol NonDeprecatedProtocol1; |
| 15 |
|
| 16 |
void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */ |
| 17 |
void function2 (id <NonDeprecatedProtocol1> object); |
| 18 |
|
| 19 |
@class Class4; |
| 20 |
|
| 21 |
void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ |
| 22 |
void function4 (Class4 <NonDeprecatedProtocol1> *object); |
| 23 |
void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ |
| 24 |
|
| 25 |
int function6 (void) |
| 26 |
{ |
| 27 |
Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ |
| 28 |
Protocol *p2 = @protocol (NonDeprecatedProtocol1); |
| 29 |
|
| 30 |
return (p1 == p2); |
| 31 |
} |
| 32 |
|