This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ObjC/ObjC++ - finish implementation of Objective-C 2.0 @protocol attributes


This patch completes the implementation of @protocol attributes so that 
the compiler not only parses them, but actually implements them (the only one 
that is actually implemented is the 'deprecated' attribute, which is the only 
one actually available with @protocol).

In particular this patch:

 * makes sure we do not throw away the attributes parsed with a @protocol forward 
declaration (as in  "__attribute__ ((deprecated)) @protocol MyProtocol;") but we 
pass them to the ObjC compiler (this bit was missing);

 * attaches the attributes to the protocol and marks it with TREE_DEPRECATED if 
appropriate (both for normal and forward declarations of protocols)

 * modifies lookup_protocol() to emit a deprecation warning if requested;

 * changes all callers of lookup_protocol() to request (or not, as appropriate to 
the case) a deprecation warning if the protocol being looked up turns out to be 
deprecated;

 * and, finally, removes the warnings that protocol attributes are not 
implemented in this version of the compiler, since they now are implemented. :-)

I updated the existing 2 testcases, and added another 4 testcases for Objective-C 
and Objective-C++, covering all the cases I could think of.  It all seems to work. :-)

Ok to commit to trunk ?

Thanks

n gcc/:
2010-11-18  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-18  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-18  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-18  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-18  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.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]