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]

Fwd: Unreviewed patch [was : PATCH: Protocol Warning]


I would like to get this in before stage 3 begins.
Is it possible for someone to review this?

Thank you,
-Devang

Begin forwarded message:

From: Devang Patel <dpatel@apple.com>
Date: Tue Aug 6, 2002  1:54:34  PM US/Pacific
To: gcc-patches@gcc.gnu.org
Subject: Fwd: Unreviewed patch [was : PATCH: Protocol Warning]

This is still unreviewed. I would appreciate if somebody say something.
Thank you,

-Devang

Begin forwarded message:

From: Devang Patel <dpatel@apple.com>
Date: Wed Jul 31, 2002  6:04:42  PM US/Pacific
To: gcc-patches@gcc.gnu.org
Subject: Unreviewed patch [was : PATCH: Protocol Warning]

Well, It passes check-g++ and check-gcc test.

-Devang

On Thursday, July 25, 2002, at 08:39  PM, Stan Shebs wrote:

Devang Patel wrote:

For the given test case, in Objective C, protocol 'qualified id'
is incorrectly used for another 'id'. This happens when
get_qualified_type () is tring to reuse existing TYPE.

This simple patch adds one extra condition while deciding
if a existing TYPE is suitable or not.

Bootstrapped and passes testsuite check.
From the ObjC point of view this is fine, but I'm not certain about
how this impacts the several other clients of get_qualified_type.
Could someone more knowledgeable look at this please?

Stan


-Devang

07-24-2002 Devang Patel <dpatel@apple.com>
* tree.c (get_qualified_type): Add TYPE_CONTEXT check.

testsuite:
* objc.dg/proto-hier-2.m: New test.


Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.268
diff -c -3 -p -r1.268 tree.c
*** tree.c 23 Jul 2002 21:58:56 -0000 1.268
--- tree.c 25 Jul 2002 23:53:00 -0000
*************** get_qualified_type (type, type_quals)
*** 2866,2872 ****
like the one we need to have. If so, use that existing one. We must
preserve the TYPE_NAME, since there is code that depends on this. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
! if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type))
return t;

return NULL_TREE;
--- 2866,2873 ----
like the one we need to have. If so, use that existing one. We must
preserve the TYPE_NAME, since there is code that depends on this. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
! if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type)
! && TYPE_CONTEXT (t) == TYPE_CONTEXT (type))
return t;

return NULL_TREE;
Index: testsuite/objc.dg/proto-hier-2.m
===================================================================
RCS file: testsuite/objc.dg/proto-hier-2.m
diff -N testsuite/objc.dg/proto-hier-2.m
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/objc.dg/proto-hier-2.m 25 Jul 2002 23:53:00 -0000
***************
*** 0 ****
--- 1,49 ----
+ /* Test protocol warning. */
+ /* Contributed by Devang Patel <dpatel@apple.com>. */
+ /* { dg-do compile } */
+
+ typedef struct objc_object { struct objc_class *class_pointer; } *id;
+
+ @protocol Bar
+ @end
+
+ id <Bar> Foo_Bar () { }
+
+ typedef struct
+ {
+ int i;
+ } MyStruct;
+
+ @interface Foo
+ {
+ id _mainData;
+ MyStruct *_anotherData;
+ }
+
+ -(id) mainDataSource;
+ -(id) anotherDataSource;
+ -(id) my_method: (int) i;
+ @end
+
+ @implementation Foo
+ -(id) anotherDataSource
+ {
+ return (id)_anotherData;
+ }
+
+ -(id) mainDataSource
+ {
+ return _mainData;
+ }
+
+ -(id) my_method: (int) i
+ {
+ id one = [self anotherDataSource];
+
+ i = i - 1;
+ // Do not issue warning about my_method not implemented by protocol
+ return [(one ? [self mainDataSource] : one) my_method:i];
+ }
+
+ @end
+








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