This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Objective-C Fixes -- TAKE ONE
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH: Objective-C Fixes -- TAKE ONE
- From: Ziemowit Laski <zlaski at apple dot com>
- Date: Fri, 27 Jul 2001 18:49:35 -0700
- Cc: Stan Shebs <shebs at apple dot com>
Hello all,
I've withdrawn the Pascal strings patch for the time being
but have another one for you to consider.
The following patch contains fixes to the Objective-C (and
*only* Objective-C) compiler in gcc3. The most notable of
these is the added support for forward @protocol declarations,
along with checking for any circular references that result.
Several test cases have also been added.
These fixes are also part of the 2.95.2 ObjC compiler
included with Darwin.
Enjoy!
--Zem
==============================================================
[ChangeLog]
* c-parse.in (OBJC_NEED_RAW_IDENTIFIER): Define macro and flag
for
contextualizing ObjC class name lookup by the lexer.
(typespec_reserved_nonattr): Disable ObjC class name lookup after
seeing a TYPESPEC.
(protocoldef): Add support for forward @protocol declarations.
(yylexname): Suppress ObjC class name lookup in certain contexts;
re-enable after lookup is complete.
(_yylex): Re-enable ObjC class name lookup when certain
punctuation marks are seen.
* objc/objc-act.c (check_protocol_recursively): New function used
for finding circular dependencies in protocols.
(objc_declare_protocols): New function for handling forward
@protocol declarations.
(receiver_is_class_object): Detect the case when 'self' is used
inside of a class method.
(build_message_expr): Issue a warning if class method is desired
but instance method is found instead.
(conforms_to_protocol): Streamline.
(objc_comptypes): Detect the fact that 'Bar<Foo> foo' conforms to
protocol Foo, even if 'Bar foo' does not.
(check_protocols): Streamline.
(start_protocol): Add checks for circular and duplicate protocol
definitions.
(encode_aggregate_within): For typedefs of structs, encode the
underlying struct.
* objc/objc-act.h (PROTOCOL_DEFINED): New tree accessor.
(objc_declare_protocols): New prototype.
[testsuite/ChangeLog]
* objc.dg/fwd-proto-1.m: New.
* objc.dg/local-decl-1.m: New.
* objc.dg/naming-1.m: New.
* objc.dg/naming-2.m: New.
* objc.dg/proto-hier-1.m: New.
gcc3_objc_fixes.diff
--------------------------------------------------------------
Ziemowit Laski Apple Computer, Inc.
zlaski@apple.com 2 Infinite Loop, MS 302-4SN
+1.408.974.6229 Fax .1344 Cupertino, CA 95014-2085