[PATCH] Objective-C : Do not accept an object as parameter to a method(take 2)

Stan Shebs shebs@apple.com
Tue Jul 9 13:35:00 GMT 2002


Devang Patel wrote:
> 
> On Wednesday, July 3, 2002, at 09:36  AM, Stan Shebs wrote:
> 
> > Technically, the patch hasn't been approved - I think I may have
> > given the impression in private mail that it was OK, but the
> > question of passing structures by value hadn't been resolved.
> > The error should just apply to ObjC objects, and the test needs
> > to be sharpened to objects only.
> 
> Following patch restricts the error for ObjC objects being used as
> parameter
> type for ObjC method only. This patch passes objc testsuite.

This is OK to commit, thanks.

Stan

> Devang
> 
> 2002-07-03 Devang Patel <dpatel@apple.com>
> 
>      * objc/objc-act.c (adjust_type_for_id_default): Do not allow ObjC
> objects
>        as a parameter type for Objective-C methods.
> 
> Index: objc-act.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/objc/objc-act.c,v
> retrieving revision 1.141
> diff -c -3 -p -r1.141 objc-act.c
> *** objc-act.c  2 Jul 2002 23:06:02 -0000       1.141
> --- objc-act.c  4 Jul 2002 01:32:45 -0000
> *************** adjust_type_for_id_default (type)
> *** 4465,4471 ****
>           chain;
>           chain = TREE_CHAIN (chain))
>        {
> !       if (TREE_CODE (TREE_VALUE (chain)) == RECORD_TYPE
>              && !(TREE_VALUE (type)
>                   && TREE_CODE (TREE_VALUE (type)) == INDIRECT_REF))
>            error ("can not use an object as parameter to a method\n");
> --- 4465,4471 ----
>           chain;
>           chain = TREE_CHAIN (chain))
>        {
> !       if (TYPED_OBJECT (TREE_VALUE (chain))
>              && !(TREE_VALUE (type)
>                   && TREE_CODE (TREE_VALUE (type)) == INDIRECT_REF))
>            error ("can not use an object as parameter to a method\n");
> 
>



More information about the Gcc-patches mailing list