diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-19 12:29:45 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-19 12:29:45 +0000 |
commit | c213e1966dca66592956a16b5d2dfc54d93a2b7f (patch) | |
tree | 2d50c8b8623cefaa8f652056ac3394587371943b /gcc/testsuite/obj-c++.dg/attributes | |
parent | 885e0ef918f429bc54ba8e953cb2320a9d3a86e5 (diff) | |
download | gcc-c213e1966dca66592956a16b5d2dfc54d93a2b7f.tar.gz |
In gcc/:
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_parser_objc_protocol_definition): Pass attributes
to objc_declare_protocols.
In gcc/c-family/:
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* c-common.h (objc_declare_protocols): Added additional argument.
* stub-objc.c (objc_declare_protocol): Same change.
In gcc/cp/:
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_parser_objc_protocol_declaration): Pass attributes
to objc_declare_protocols.
In gcc/objc/:
2010-11-19 Nicola Pero <nicola@nicola.brainstorm.co.uk>
* objc-act.c (lookup_protocol): Added 'warn_if_deprecated'
argument. If it is 'true' and the protocol is deprecated, emit a
deprecation warning.
(objc_start_protocol): Do not warn that protocol attributes are
unimplemented. Pass the attributes to start_protocol.
(start_protocol): Added attributes argument. Recognize the
'deprecated' attribute and mark the protocols with TREE_DEPRECATED
if present. Store attributes in the protocol.
(objc_declare_protocols): Added 'attributes' argument. Recognize
the 'deprecated' attribute and mark the protocols with
TREE_DEPRECATED if present. Store attributes in the protocol.
Updated call to lookup_protocol.
(objc_build_protocol_expr): Updated call to lookup_protocol.
(check_protocol_recursively): Same change.
(lookup_and_install_protocols): Same change.
* objc-act.h: Updated comments.
In gcc/testsuite/:
2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/attributes/proto-attribute-1.m: Updated.
* objc.dg/attributes/proto-attribute-2.m: New.
* objc.dg/attributes/proto-attribute-3.m: New.
* obj-c++.dg/attributes/proto-attribute-1.mm: Updated.
* obj-c++.dg/attributes/proto-attribute-2.mm: New.
* obj-c++.dg/attributes/proto-attribute-3.mm: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/attributes')
3 files changed, 108 insertions, 11 deletions
diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm index c21caad3be6..a852a7a6c2f 100644 --- a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm +++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-1.mm @@ -1,14 +1,13 @@ /* { dg-do compile } */ #include <objc/objc.h> -#include "../../objc-obj-c++-shared/Object1.h" __attribute ((deprecated)) -@protocol dep_proto /* { dg-warning "protocol attributes are not available in this version" } */ -- (int) depprotomth; +@protocol dep_proto +- (int) depprotomth; @end -@interface obj : Object <dep_proto> +@interface obj <dep_proto> /* { dg-warning "is deprecated" } */ { @public int var; @@ -20,10 +19,3 @@ __attribute ((deprecated)) - (int) mth { return var; } - (int) depprotomth { return var + 1; } @end - -int foo (void) -{ - obj *p = [obj new]; - int q = [p depprotomth]; - return [p mth]; -} diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-2.mm new file mode 100644 index 00000000000..5b2eecb2f13 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-2.mm @@ -0,0 +1,45 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do compile } */ + +/* Test deprecate attribute with a forward declarations of + @protocol. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +__attribute__ ((deprecated)) +@protocol DeprecatedProtocol1; + +@protocol NonDeprecatedProtocol1; + + +@interface Class1 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 <NonDeprecatedProtocol1> +@end + +@interface Class3 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 (Category1) <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */ +void function2 (id <NonDeprecatedProtocol1> object); + +@class Class4; + +void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ +void function4 (Class4 <NonDeprecatedProtocol1> *object); +void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ + +int function6 (void) +{ + Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ + Protocol *p2 = @protocol (NonDeprecatedProtocol1); + + return (p1 == p2); +} + diff --git a/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm new file mode 100644 index 00000000000..f509bb79198 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm @@ -0,0 +1,60 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, November 2010. */ +/* { dg-do compile } */ + +/* Test deprecate attribute with normal @protocol declarations. */ + + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +__attribute__ ((deprecated)) +@protocol DeprecatedProtocol1 +- (void) aMethod; +@end + +@protocol NonDeprecatedProtocol1 +- (void) anotherMethod; +@end + +@protocol Protocol2 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +- (void) someOtherMethod; +@end + +@protocol Protocol3 <NonDeprecatedProtocol1> +- (void) someOtherMethod2; +@end + +@protocol Protocol4 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +- (void) someOtherMethod3; +@end + + +@interface Class1 <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 <NonDeprecatedProtocol1> +@end + +@interface Class3 <NonDeprecatedProtocol1, DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 (Category1) <DeprecatedProtocol1> /* { dg-warning "is deprecated" } */ +@end + +void function1 (id <DeprecatedProtocol1> object); /* { dg-warning "is deprecated" } */ +void function2 (id <NonDeprecatedProtocol1> object); + +@class Class4; + +void function3 (Class4 <DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ +void function4 (Class4 <NonDeprecatedProtocol1> *object); +void function5 (Class4 <NonDeprecatedProtocol1, DeprecatedProtocol1> *object); /* { dg-warning "is deprecated" } */ + +int function6 (void) +{ + Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ + Protocol *p2 = @protocol (NonDeprecatedProtocol1); + + return (p1 == p2); +} |