]> gcc.gnu.org Git - gcc.git/commitdiff
tree.c (get_qualified_type): Add TYPE_CONTEXT check.
authorDevang Patel <dpatel@apple.com>
Wed, 21 Aug 2002 01:01:14 +0000 (18:01 -0700)
committerDevang Patel <dpatel@gcc.gnu.org>
Wed, 21 Aug 2002 01:01:14 +0000 (18:01 -0700)
2002-08-20  Devang Patel  <dpatel@apple.com>
        * tree.c (get_qualified_type): Add TYPE_CONTEXT check.

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

From-SVN: r56475

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/proto-hier-2.m [new file with mode: 0644]
gcc/tree.c

index 62df30ae85a8b0a94eb36a963adb704148fbdedf..00e4f4293e3ef19b163af6a93453c6b64927c62c 100644 (file)
@@ -1,3 +1,6 @@
+2002-08-20  Devang Patel  <dpatel@apple.com>
+       * tree.c (get_qualified_type): Add TYPE_CONTEXT check.
+       
 2002-08-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * arc.c (output_shift): Use stdio instead of asm_fprintf.
index 775dcb0e01644639345617deeedcc69aa32373f7..b682ab193298918b4afc78ffa6fb42d34322ad48 100644 (file)
@@ -1,3 +1,6 @@
+2002-08-20  Devang Patel  <dpatel@apple.com>
+       * objc.dg/proto-hier-2.m: New test.
+       
 2002-08-19  Ziemowit Laski  <zlaski@apple.com>
 
        * objc.dg/bitfield-1.m: New test.
diff --git a/gcc/testsuite/objc.dg/proto-hier-2.m b/gcc/testsuite/objc.dg/proto-hier-2.m
new file mode 100644 (file)
index 0000000..453de89
--- /dev/null
@@ -0,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 9e725db7958d28519261ed7a1c339d23560c3a47..2c56b95f94e2dd63a9a10f9d1ee1a1756e87ad03 100644 (file)
@@ -2832,7 +2832,8 @@ get_qualified_type (type, type_quals)
      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))
+    if (TYPE_QUALS (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type)
+        && TYPE_CONTEXT (t) == TYPE_CONTEXT (type))
       return t;
 
   return NULL_TREE;
This page took 0.214334 seconds and 5 git commands to generate.