diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-10-15 23:44:05 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-10-15 23:44:05 +0000 |
commit | 8dd6939deb9283c2e86cc6e3eb7bc082b8aff4f9 (patch) | |
tree | 79236a23aaa7a8b101d4bd2a8a8c6835efe6c16c /gcc | |
parent | 8437e063bcb75a691128a40a9d777995d7c32d96 (diff) | |
download | gcc-8dd6939deb9283c2e86cc6e3eb7bc082b8aff4f9.zip gcc-8dd6939deb9283c2e86cc6e3eb7bc082b8aff4f9.tar.gz gcc-8dd6939deb9283c2e86cc6e3eb7bc082b8aff4f9.tar.bz2 |
In gcc/testsuite/: 2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/testsuite/:
2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/gnu-api-2-property.m: New.
From-SVN: r165532
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/gnu-api-2-property.m | 65 |
2 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc57cde..2556f00 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-10-15 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc.dg/gnu-api-2-property.m: New. + 2010-10-15 Xinliang David Li <davidxl@google.com> * g++.dg/uninit-pred-3_a.C: New test. diff --git a/gcc/testsuite/objc.dg/gnu-api-2-property.m b/gcc/testsuite/objc.dg/gnu-api-2-property.m new file mode 100644 index 0000000..974ab6c --- /dev/null +++ b/gcc/testsuite/objc.dg/gnu-api-2-property.m @@ -0,0 +1,65 @@ +/* Test the Modern GNU Objective-C Runtime API. + + This is test 'property', covering all functions starting with 'property'. */ + +/* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ + +/* To get the modern GNU Objective-C Runtime API, you include + objc/runtime.h. */ +#include <objc/runtime.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +@interface MyRootClass +{ Class isa; } ++ alloc; +- init; +@end + +@implementation MyRootClass ++ alloc { return class_createInstance (self, 0); } +- init { return self; } +@end + +@protocol MyProtocol +- (id) variable; +@end + +@protocol MySecondProtocol +- (id) setVariable: (id)value; +@end + +@interface MySubClass : MyRootClass <MyProtocol> +{ id variable_ivar; } +- (void) setVariable: (id)value; +- (id) variable; +@end + +@implementation MySubClass +- (void) setVariable: (id)value { variable_ivar = value; } +- (id) variable { return variable_ivar; } +@end + + +int main(int argc, void **args) +{ + /* Functions are tested in alphabetical order. */ + + /* TODO: Test new ABI (when available). */ + printf ("Testing property_getAttributes () ...\n"); + { + if (property_getAttributes (NULL) != NULL) + abort (); + } + + /* TODO: Test new ABI (when available). */ + printf ("Testing property_getName () ...\n"); + { + if (property_getName (NULL) != NULL) + abort (); + } + + return 0; +} |