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++ - @property parsing (2)


(apologies, this patch got stuck in my computer last night, reposting now)

This patch (which can only be applied on top of the previous one) does another chunk of work on @property:

 * it implements parsing all of the missing @property attributes (assign, copy, retain, nonatomic, readwrite)

 * it tidies up the interface between the parser and objc-act.c.  It's now composed of a single function,
objc_add_property_declaration().  The parsing is all done in the parser, which parses the property and
accumulates the property attributes in local variables, then calls objc_add_property_declaration() passing all 
the details of the @property in explicit arguments.  The "global" (to objc-act.c) property variables 
(property_readonly, property_getter, etc) are gone, and so is objc_set_property_attr.

 * it implements checking all the new @property attributes and preparing the final property attributes that
will be used.

 * it adds testcases for parsing the new property attributes (and producing the correct errors/warnings 
on conflicting attributes) in both Objective-C and Objective-C++.

I haven't implemented the functionality of the new attributes yet.  That will be another patch.

In the interest of incremental changes of reasonable size, I have also left the old copies and ivar property 
attributes in place, and haven't removed the ability to use @property in @implementation yet.  I'll do that
once I have implemented @synthesize and I'll be able to update all the testcases to use @synthesize instead
of @property inside an @implementation context.

All testcases still pass, and the new ones too.

Ok to commit to trunk ?

Thanks

In gcc/:
2010-10-25  Nicola Pero  <nicola.pero@meta-innovation.com>

        * c-parser.c (c_parser_objc_at_property_declaration): Recognize
        RID_ASSIGN, RID_COPY, RID_RETAIN, RID_READWRITE and RID_NONATOMIC.
        Do not use objc_set_property_attr, but use local variables
        instead.  Detect repeated usage of setter, getter and ivar
        attributes.  Improved error processing when a setter name does not
        end in ':'.  Do not check for CPP_CLOSE_PAREN after we determined
        that the token is a keyword.  Updated call to
        objc_add_property_declaration.

In gcc/cp/:
2010-10-25  Nicola Pero  <nicola.pero@meta-innovation.com>

        * parser.c (cp_parser_objc_at_property_declaration): Recognize
        RID_ASSIGN, RID_COPY, RID_RETAIN, RID_READWRITE and RID_NONATOMIC.
        Do not use objc_set_property_attr, but use local variables
        instead.  Detect repeated usage of setter, getter and ivar
        attributes.  Improved error processing when a setter name does not
        end in ':'.  Do not check for CPP_CLOSE_PAREN after we determined
        that the token is a keyword.  Updated call to
        objc_add_property_declaration.

In gcc/c-family/:
2010-10-25  Nicola Pero  <nicola.pero@meta-innovation.com>

        * c-common.h (enum rid): Added RID_READWRITE, RID_ASSIGN,
        RID_RETAIN, RID_COPY and RID_NONATOMIC.  Updated RID_FIRST_PATTR
        and RID_LAST_PATTR.
        (objc_add_property_declaration): Added additional arguments.
        (objc_property_attribute_kind): Removed.
        (objc_set_property_attr): Removed.
        * c-common.c (c_common_reswords): Added readwrite, assign, retain,
        copy and nonatomic.
        * stub-objc.c (objc_add_property_declaration): Added additional
        arguments.
        (objc_set_property_attr): Removed.

In gcc/objc/:
2010-10-25  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc-act.c (objc_add_property_declaration): Added arguments to
        pass the various property attributes that were parsed with the
        property declaration.  Process arguments to determine the final
        property attributes and produce error messages as appropriate.
        Added temporary code to keep the compiler silent about variables
        set but not used - for new attributes that are only checked but
        have no effect yet.
        (property_readonly): Removed.
        (property_setter): Removed.
        (property_getter): Removed.
        (property_ivar): Removed.
        (property_copies): Removed.
        (objc_set_property_attr): Removed.
        * objc-act.h (enum property_assign_semantics): New.

In gcc/testsuite/:
2010-10-25  Nicola Pero  <nicola.pero@meta-innovation.com>

        * obj-c.dg/property/at-property-4.m: New.
        * obj-c++.dg/property/at-property-4.mm: New.
        * obj-c++.dg/property/property-neg-5.m: Updated testcase for
        updates in warning.
        * obj-c++.dg/property/property-neg-5.mm: Updated testcase for
        updates in warning.

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]