| 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 normal @protocol declarations. */ |
| 6 |
|
| 7 |
|
| 8 |
#include <stdlib.h> |
| 9 |
#include <objc/objc.h> |
| 10 |
|
| 11 |
__attribute__ ((deprecated)) |
| 12 |
@protocol DeprecatedProtocol1 |
| 13 |
- (void) aMethod; |
| 14 |
@end |
| 15 |
|
| 16 |
@protocol NonDeprecatedProtocol1 |
| 17 |
- (void) anotherMethod; |
| 18 |
@end |
| 19 |
|
| 20 |
@protocol Protocol2 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ |
| 21 |
- (void) someOtherMethod; |
| 22 |
@end |
| 23 |
|
| 24 |
@protocol Protocol3 <NonDeprecatedProtocol1> |
| 25 |
- (void) someOtherMethod2; |
| 26 |
@end |
| 27 |
|
| 28 |
@protocol Protocol4 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ |
| 29 |
- (void) someOtherMethod3; |
| 30 |
@end |
| 31 |
|
| 32 |
|
| 33 |
@interface Class1 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ |
| 34 |
@end |
| 35 |
|
| 36 |
@interface Class2 <NonDeprecatedProtocol1> |
| 37 |
@end |
| 38 |
|
| 39 |
@interface Class3 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ |
| 40 |
@end |
| 41 |
|
| 42 |
@interface Class2 (Category1) <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ |
| 43 |
@end |
| 44 |
|
| 45 |
void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */ |
| 46 |
void function2 (id <NonDeprecatedProtocol1> object); |
| 47 |
|
| 48 |
@class Class4; |
| 49 |
|
| 50 |
void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ |
| 51 |
void function4 (Class4 <NonDeprecatedProtocol1> *object); |
| 52 |
void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ |
| 53 |
|
| 54 |
int function6 (void) |
| 55 |
{ |
| 56 |
Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ |
| 57 |
Protocol *p2 = @protocol (NonDeprecatedProtocol1); |
| 58 |
|
| 59 |
return (p1 == p2); |
| 60 |
} |