From c213e1966dca66592956a16b5d2dfc54d93a2b7f Mon Sep 17 00:00:00 2001 From: nicola Date: Fri, 19 Nov 2010 12:29:45 +0000 Subject: In gcc/: 2010-11-19 Nicola Pero * c-parser.c (c_parser_objc_protocol_definition): Pass attributes to objc_declare_protocols. In gcc/c-family/: 2010-11-19 Nicola Pero * 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 * parser.c (cp_parser_objc_protocol_declaration): Pass attributes to objc_declare_protocols. In gcc/objc/: 2010-11-19 Nicola Pero * 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 * 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 --- .../obj-c++.dg/attributes/proto-attribute-1.mm | 14 ++--- .../obj-c++.dg/attributes/proto-attribute-2.mm | 45 ++++++++++++++++ .../obj-c++.dg/attributes/proto-attribute-3.mm | 60 ++++++++++++++++++++++ 3 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/obj-c++.dg/attributes/proto-attribute-2.mm create mode 100644 gcc/testsuite/obj-c++.dg/attributes/proto-attribute-3.mm (limited to 'gcc/testsuite/obj-c++.dg/attributes') 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 -#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 +@interface obj /* { 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 , November 2010. */ +/* { dg-do compile } */ + +/* Test deprecate attribute with a forward declarations of + @protocol. */ + +#include +#include +#include + +__attribute__ ((deprecated)) +@protocol DeprecatedProtocol1; + +@protocol NonDeprecatedProtocol1; + + +@interface Class1 /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 +@end + +@interface Class3 /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 (Category1) /* { dg-warning "is deprecated" } */ +@end + +void function1 (id object); /* { dg-warning "is deprecated" } */ +void function2 (id object); + +@class Class4; + +void function3 (Class4 *object); /* { dg-warning "is deprecated" } */ +void function4 (Class4 *object); +void function5 (Class4 *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 , November 2010. */ +/* { dg-do compile } */ + +/* Test deprecate attribute with normal @protocol declarations. */ + + +#include +#include +#include + +__attribute__ ((deprecated)) +@protocol DeprecatedProtocol1 +- (void) aMethod; +@end + +@protocol NonDeprecatedProtocol1 +- (void) anotherMethod; +@end + +@protocol Protocol2 /* { dg-warning "is deprecated" } */ +- (void) someOtherMethod; +@end + +@protocol Protocol3 +- (void) someOtherMethod2; +@end + +@protocol Protocol4 /* { dg-warning "is deprecated" } */ +- (void) someOtherMethod3; +@end + + +@interface Class1 /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 +@end + +@interface Class3 /* { dg-warning "is deprecated" } */ +@end + +@interface Class2 (Category1) /* { dg-warning "is deprecated" } */ +@end + +void function1 (id object); /* { dg-warning "is deprecated" } */ +void function2 (id object); + +@class Class4; + +void function3 (Class4 *object); /* { dg-warning "is deprecated" } */ +void function4 (Class4 *object); +void function5 (Class4 *object); /* { dg-warning "is deprecated" } */ + +int function6 (void) +{ + Protocol *p1 = @protocol (DeprecatedProtocol1); /* { dg-warning "is deprecated" } */ + Protocol *p2 = @protocol (NonDeprecatedProtocol1); + + return (p1 == p2); +} -- cgit v1.2.1