| 1 |
/* Test for -Wundeclared-selector. */ |
| 2 |
/* Author: Nicola Pero <[email protected]>. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-Wundeclared-selector" } */ |
| 5 |
/* { dg-additional-options "-Wno-objc-root-class" } */ |
| 6 |
|
| 7 |
#include <objc/objc.h> |
| 8 |
|
| 9 |
@interface MyClass |
| 10 |
|
| 11 |
+ (void) methodA; |
| 12 |
- (void) methodB; |
| 13 |
+ (void) methodD; |
| 14 |
- (void) methodF; |
| 15 |
|
| 16 |
@end |
| 17 |
|
| 18 |
@implementation MyClass |
| 19 |
|
| 20 |
+ (void) methodA {} |
| 21 |
- (void) methodB {} |
| 22 |
+ (void) methodD |
| 23 |
{ |
| 24 |
SEL d = @selector(methodD); /* Ok */ |
| 25 |
SEL e = @selector(methodE); /* { dg-warning "undeclared selector" } */ |
| 26 |
} |
| 27 |
|
| 28 |
- (void) methodE |
| 29 |
{ |
| 30 |
SEL e = @selector(methodE); /* Ok */ |
| 31 |
} |
| 32 |
|
| 33 |
- (void) methodF |
| 34 |
{ |
| 35 |
SEL e = @selector(methodE); /* Ok */ |
| 36 |
} |
| 37 |
|
| 38 |
@end |
| 39 |
|
| 40 |
int main (void) |
| 41 |
{ |
| 42 |
SEL a = @selector(methodA); /* Ok */ |
| 43 |
SEL b = @selector(methodB); /* Ok */ |
| 44 |
SEL c = @selector(methodC); /* { dg-warning "undeclared selector" } */ |
| 45 |
SEL d = @selector(methodD); /* Ok */ |
| 46 |
SEL e = @selector(methodE); /* Ok */ |
| 47 |
return 0; |
| 48 |
|
| 49 |
} |