ObjC/ObjC++: fixed pre/post increment/decrement operators with Objective-C 2.0 dotsyntax

Nicola Pero nicola.pero@meta-innovation.com
Sun Nov 14 22:36:00 GMT 2010


This patch fixes using pre/post increment/decrement operators with Objective-C 2.0
dot-syntax.  For example,

 object.property++;

would not work before this patch, but now it does :-)

The patch includes testcases, and I updated an old testcase where the object.property++ syntax
was commented out as it wasn't working yet.

Ok to commit to trunk ?

Thanks

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

        * c-typeck.c (build_unary_op): Use
        objc_build_incr_expr_for_property_ref to build the pre/post
        increment/decrement of an Objective-C property ref, and skip the
        lvalue_or_else check in that case.

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

        * c-common.h (objc_build_incr_expr_for_property_ref): New.
        * stub-objc.c (objc_build_incr_expr_for_property_ref): New.

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

        * typeck.c (cp_build_unary_op): Use
        objc_build_incr_expr_for_property_ref to build the pre/post
        increment/decrement of an Objective-C property ref.

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

        * objc-act.c (objc_build_incr_expr_for_property_ref): New.
        (objc_create_temporary_var): Moved it towards the beginning of the
        file so that objc_build_incr_expr_for_property_ref can use it.

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

        * objc.dg/property/dotsyntax-16.m: New.
        * objc.dg/property/dotsyntax-17.m: New.
        * obj-c++.dg/property/dotsyntax-16.mm: New.
        * obj-c++.dg/property/dotsyntax-17.mm: New.
        * objc.dg/property/at-property-10.m: Uncommented using 'x++'
        syntax with properties, which now works.
        * obj-c++.dg/property/at-property-10.mm: Same change.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20101114/2002c11a/attachment.txt>


More information about the Gcc-patches mailing list