This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [Patch ObjC* committed 1/2] @property
- From: "Nicola Pero" <nicola dot pero at meta-innovation dot com>
- To: "IainS" <developer at sandoe-acoustics dot co dot uk>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>, "Mike Stump" <mrs at gcc dot gnu dot org>
- Date: Fri, 15 Oct 2010 12:41:26 +0200 (CEST)
- Subject: RE: [Patch ObjC* committed 1/2] @property
- References: <A5C4B796-E246-49C8-9496-903AEC014072@sandoe-acoustics.co.uk>
This is brilliant. I can't wait to try it out tonight :-)
Thanks
-----Original Message-----
From: "IainS" <developer@sandoe-acoustics.co.uk>
Sent: Thursday, 14 October, 2010 22:17
To: "GCC Patches" <gcc-patches@gcc.gnu.org>
Cc: "Mike Stump" <mrs@gcc.gnu.org>, "Nicola Pero" <nicola.pero@meta-innovation.com>
Subject: [Patch ObjC* committed 1/2] @property
Hi,
Another chunk from the ObjC part of FSF apple 'trunk' branch.
This implements:
@property - with attributes from the set " readonly, copies, getter=,
setter= and ivar=" i.e. property "V1".
As discussed with Mike off list, rather than merge a buggy first
implementation followed by fixes - this applies all the related
property radars : 4436866, 4505126, 4506903, 4517826
I took the liberty of replacing some magic numbers with an enum ...
... oh, and I made it work on fgnu-runtime too ;)
r165479 (test-suite changes are in part2)
cheers,
Iain
add @property to ObjC*
merge from FSF apple 'trunk' branch.
2006 Fariborz Jahanian <fjahanian@apple.com>
gcc/c-family:
* c-common.c (c_common_resword): Define @property and its attributes.
* c-common.h: Define property attribute enum entries.
(OBJC_IS_PATTR_KEYWORD): New.
(objc_property_attribute_kind): New enum.
Declare objc_set_property_attr (), objc_add_property_variable (),
objc_build_getter_call () and objc_build_setter_call ().
* stub-objc.c (objc_set_property_attr): New stub.
(objc_add_property_variable): Likewise.
(objc_build_getter_call): Likewise.
(objc_build_setter_call) Likewise.
gcc:
* c-parser.c (c_parser, objc_property_attr_context) New flag.
(c_lex_one_token): Handle property attributes.
(c_parser_external_declaration): Handle @property.
(c_parser_declaration_or_fndef): Warn on invalid attributes before
@alias, @class, @end and @property objc keywords.
(c_parser_objc_methodprotolist): Handle @property.
(c_parser_objc_property_attrlist): New.
(c_parser_objc_at_property): New.
* c-typeck.c (build_component_ref): Handle CLASS.property syntax.
(build_modify_expr): Likewise.
gcc/cp:
* typeck.c (finish_class_member_access_expr): Handle CLASS.property
syntax.
(cp_build_modify_expr): Likewise.
* parser.c (cp_parser_objc_method_prototype_list): Handle @property.
(cp_parser_objc_method_definition_list): Likewise.
(cp_parser_objc_property_decl): New.
(cp_parser_objc_property_attrlist): New.
(cp_parser_objc_at_property): New.
gcc/objc:
* objc-act.c (CALL_EXPR_OBJC_PROPERTY_GETTER): New.
property_readonly, property_getter, property_setter, property_ivar,
property_copies, in_objc_property_setter_name_context: New vars.
(objc_set_property_attr): New.
(objc_add_property_variable): New.
(lookup_property_in_list): New.
(lookup_property): New.
(objc_build_getter_call): New.
(objc_setter_func_call): New.
(get_selector_from_reference): New.
(objc_build_setter_call): New.
(is_property): New.
(build_property_reference): New.
(objc_finish_message_expr): Detect readonly property and warn.
(objc_build_property_ivar_name): New.
(objc_build_property_setter_name): New.
(objc_gen_one_property_datum): New.
(objc_process_getter_setter): New.
(objc_synthesize_getter): New.
(objc_synthesize_setter): New.
(objc_gen_property_data): New.
(finish_class): Generate property data.
(comp_proto_with_proto): Separated from ...
(match_proto_with_proto): ... New.
(objc_lookup_ivar): Handle properties.
* objc-tree.def (PROPERTY_DECL): New tree code.
* objc-act.h: CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS update
size.
(METHOD_PROPERTY_CONTEXT): New.
(PROPERTY_NAME): New.
(PROPERTY_GETTER_NAME): New.
(PROPERTY_SETTER_NAME): New.
(PROPERTY_IVAR_NAME): New.
(PROPERTY_READONLY): New.
(PROPERTY_COPIES): New.
(TOTAL_CLASS_RAW_IVARS): New.
(CLASS_PROPERTY_DECL): New.
(IMPL_PROPERTY_DECL): New.
* objc-lang.c (objc_init_ts): Update fields for property_decl.
gcc/objcp:
* objcp-lang.c (objcxx_init_ts): Update for property_decl.