| 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 |
| 11 |
- (id) new; /* { dg-warning "ignored" } */ |
| 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 |
} |