diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-27 22:03:30 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-27 22:03:30 +0000 |
commit | 1f2f2194f8713b9ff7108e7f2cdc295bff6aef96 (patch) | |
tree | 411847e1d86c6ab3afd2bc1f16b9fa218d2116c6 /gcc/testsuite/objc.dg/undeclared-selector.m | |
parent | a70e45e3e17e13a5562ad7289b44fce205489a99 (diff) | |
download | gcc-1f2f2194f8713b9ff7108e7f2cdc295bff6aef96.tar.gz |
New objc.dg test for new -Wundeclared-selector ObjC option
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg/undeclared-selector.m')
-rw-r--r-- | gcc/testsuite/objc.dg/undeclared-selector.m | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/undeclared-selector.m b/gcc/testsuite/objc.dg/undeclared-selector.m new file mode 100644 index 00000000000..1cfc6c83481 --- /dev/null +++ b/gcc/testsuite/objc.dg/undeclared-selector.m @@ -0,0 +1,48 @@ +/* Test for -Wundeclared-selector. */ +/* Author: Nicola Pero <nicola@brainstorm.co.uk>. */ +/* { dg-do compile } */ +/* { dg-options "-Wundeclared-selector" } */ + +#include <objc/objc.h> + +@interface MyClass + ++ (void) methodA; +- (void) methodB; ++ (void) methodD; +- (void) methodF; + +@end + +@implementation MyClass + ++ (void) methodA {} +- (void) methodB {} ++ (void) methodD +{ + SEL d = @selector(methodD); /* Ok */ + SEL e = @selector(methodE); /* { dg-warning "undeclared selector" } */ +} + +- (void) methodE +{ + SEL e = @selector(methodE); /* Ok */ +} + +- (void) methodF +{ + SEL e = @selector(methodE); /* Ok */ +} + +@end + +int main (void) +{ + SEL a = @selector(methodA); /* Ok */ + SEL b = @selector(methodB); /* Ok */ + SEL c = @selector(methodC); /* { dg-warning "undeclared selector" } */ + SEL d = @selector(methodD); /* Ok */ + SEL e = @selector(methodE); /* Ok */ + return 0; + +} |