diff options
author | Ziemowit Laski <zlaski@apple.com> | 2002-09-06 23:32:13 +0000 |
---|---|---|
committer | Ziemowit Laski <zlaski@gcc.gnu.org> | 2002-09-06 23:32:13 +0000 |
commit | 370ce32a02500b1394456b4d1ca495e464624cc0 (patch) | |
tree | df6bd7f2e22ceca6b00aa662bdecd65bc47d4c80 /gcc/objc | |
parent | 5fc0e5dfb43ae87c4afc11879efedc9845cae6a9 (diff) | |
download | gcc-370ce32a02500b1394456b4d1ca495e464624cc0.tar.gz |
c-lang.c (objc_is_id): New stub.
[gcc/ChangeLog]
2002-09-06 Ziemowit Laski <zlaski@apple.com>
* c-lang.c (objc_is_id): New stub.
* c-tree.h (objc_is_id): New forward declaration.
* c-typeck.c (build_c_cast): Do not strip protocol
qualifiers from 'id' type.
* objc/objc-act.c (objc_comptypes): Correct handling
of protocol qualifiers.
(objc_is_id): New.
[gcc/testsuite/ChangeLog]
2002-09-05 Ziemowit Laski <zlaski@apple.com>
* objc.dg/proto-lossage-1.m: New test.
From-SVN: r56905
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/objc-act.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 6b4d76c2ec1..42861685b11 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -648,13 +648,16 @@ objc_comptypes (lhs, rhs, reflexive) tree cat; rproto_list = CLASS_PROTOCOL_LIST (rinter); - /* If the underlying ObjC class does not have - protocols attached to it, perhaps there are - "one-off" protocols attached to the rhs? - E.g., 'id<MyProt> foo;'. */ - if (!rproto_list) - rproto_list = TYPE_PROTOCOL_LIST (TREE_TYPE (rhs)); rproto = lookup_protocol_in_reflist (rproto_list, p); + /* If the underlying ObjC class does not have + the protocol we're looking for, check for "one-off" + protocols (e.g., `NSObject<MyProt> foo;') attached + to the rhs. */ + if (!rproto) + { + rproto_list = TYPE_PROTOCOL_LIST (TREE_TYPE (rhs)); + rproto = lookup_protocol_in_reflist (rproto_list, p); + } /* Check for protocols adopted by categories. */ cat = CLASS_CATEGORY_LIST (rinter); @@ -2262,6 +2265,17 @@ is_class_name (ident) } tree +objc_is_id (ident) + tree ident; +{ + /* NB: This function may be called before the ObjC front-end + has been initialized, in which case ID_TYPE will be NULL. */ + return (id_type && ident && TYPE_P (ident) && IS_ID (ident)) + ? id_type + : NULL_TREE; +} + +tree lookup_interface (ident) tree ident; { |