From da57d1b98f8ca9d1304fe66ff14315f12ce2a14f Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Mon, 18 Oct 2010 23:28:20 +0000 Subject: In gcc/: 2010-10-18 Nicola Pero In gcc/: 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for Objective-C. * c-parser.c (c_parser_external_declaration): Recognize RID_AT_SYNTHESIZE and RID_AT_DYNAMIC. (c_parser_objc_at_synthesize_declaration): New. (c_parser_objc_at_dynamic_declaration): New. 2010-10-18 Nicola Pero * c-parser.c (c_parser_objc_class_declaration): After finding an error, parse the whole declaration then reset parser->error. In gcc/cp/: 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for Objective-C++. * parser.c (cp_parser_objc_method_definition_list): Recognize RID_AT_SYNTHESIZE and RID_AT_DYNAMIC. (cp_parser_objc_at_dynamic_declaration): New. (cp_parser_objc_at_synthesize_declaration): New. 2010-10-18 Nicola Pero * parser.c (cp_parser_objc_identifier_list): Check the return value of cp_parser_identifier and react if it is error_mark_node. In gcc/objc/: 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for Objective-C/Objective-C++. * objc-act.c (objc_add_synthesize_declaration): New. (objc_add_dynamic_declaration): New. 2010-10-18 Nicola Pero * objc-act.c (lookup_and_install_protocols): Return NULL if passed error_mark_node. In gcc/testsuite/: 2010-10-18 Nicola Pero Implemented parsing @synthesize and @dynamic for Objective-C/Objective-C++. * objc.dg/property/dynamic-1.m: New. * objc.dg/property/synthesize-1.m: New. * obj-c++.dg/property/dynamic-1.mm: New. * obj-c++.dg/property/synthesize-1.mm: New. 2010-10-18 Nicola Pero * objc.dg/at-class-1.m: New. * objc.dg/at-class-1.mm: New. From-SVN: r165667 --- gcc/testsuite/objc.dg/at-class-1.m | 11 ++++++++++ gcc/testsuite/objc.dg/property/dynamic-1.m | 30 ++++++++++++++++++++++++++ gcc/testsuite/objc.dg/property/synthesize-1.m | 31 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 gcc/testsuite/objc.dg/at-class-1.m create mode 100644 gcc/testsuite/objc.dg/property/dynamic-1.m create mode 100644 gcc/testsuite/objc.dg/property/synthesize-1.m (limited to 'gcc/testsuite/objc.dg') diff --git a/gcc/testsuite/objc.dg/at-class-1.m b/gcc/testsuite/objc.dg/at-class-1.m new file mode 100644 index 0000000..63721aa --- /dev/null +++ b/gcc/testsuite/objc.dg/at-class-1.m @@ -0,0 +1,11 @@ +/* Test @class. */ +/* { dg-do compile } */ + +@class Object; /* Ok */ + +@class Object, ; /* { dg-error "expected identifier" } */ +@class Object, ; /* { dg-error "expected identifier" } */ +@class Object, AnotherObject, ; /* { dg-error "expected identifier" } */ +@class Object, AnotherObject, TestObject ; /* Ok */ + +@class Object /* { dg-error "expected .;." } */ diff --git a/gcc/testsuite/objc.dg/property/dynamic-1.m b/gcc/testsuite/objc.dg/property/dynamic-1.m new file mode 100644 index 0000000..b91a030 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/dynamic-1.m @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +#include + +@interface MyRootClass +{ + Class isa; +} +@end + +@implementation MyRootClass +@end + +@dynamic isa; /* { dg-error ".@dynamic. not in @implementation context" } */ + +@interface Test : MyRootClass +{ + int v1; + int v2; + int v3; + int v4; +} +@end + +@implementation Test +@dynamic; /* { dg-error "expected identifier" } */ +@dynamic v1, ; /* { dg-error "expected identifier" } */ +@dynamic v1, v2, v3; /* { dg-error ".@dynamic. is not supported in this version of the compiler" } */ +@dynamic v4; /* { dg-error ".@dynamic. is not supported in this version of the compiler" } */ +@end diff --git a/gcc/testsuite/objc.dg/property/synthesize-1.m b/gcc/testsuite/objc.dg/property/synthesize-1.m new file mode 100644 index 0000000..09085d8 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/synthesize-1.m @@ -0,0 +1,31 @@ +/* { dg-do compile } */ + +#include + +@interface MyRootClass +{ + Class isa; +} +@end + +@implementation MyRootClass +@end + +@synthesize isa; /* { dg-error ".@synthesize. not in @implementation context" } */ + +@interface Test : MyRootClass +{ + int v1; + int v2; + int v3; + int v4; +} +@end + +@implementation Test +@synthesize; /* { dg-error "expected identifier" } */ +@synthesize v1, ; /* { dg-error "expected identifier" } */ +@synthesize v1, v2 = ; /* { dg-error "expected identifier" } */ +@synthesize v1, v2=v2, v3 = v3,v4; /* { dg-error ".@synthesize. is not supported in this version of the compiler" } */ +@synthesize v4; /* { dg-error ".@synthesize. is not supported in this version of the compiler" } */ +@end -- cgit v1.1