public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Objective-C Protocol patch
@ 1998-01-04  4:46 David T. McWherter
  1998-01-17 22:30 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: David T. McWherter @ 1998-01-04  4:46 UTC (permalink / raw)
  To: egcs

I noted that gcc-2.7.2.1 fails to recognize protocol qualifiers
in class definitions in its objective-c compiler:
	@interface Foo
	-(oneway void)myMethod; /* oneway not accepted here */
	@end
	@implementation Foo
	-(oneway void) myMethod /* oneway accepted here */
	{
	}

And I traced the problem back to some code in objc-parse.y that 
is causing the parser to forget about the oneway (and friends) 
keywords, resulting in compiler errors in seemingly legitimate
code.  

Anwyays, I not that the egcs-971225 compiler operates identically to gcc
on this one, and so I've made a patch for objc-parse.y to fix this
problem, so that oneway and friends are accepted in both prototypes
and definitions of methods.  The patch is pretty trivial, so I'd
presume I don't need to fill out that copyright release form for
folks to use it, but let me know if I'm mistaken.  

Here's the patch:

------------------------------------------------------------
*** objc-parse.y.bak    Sun Jan  4 07:42:15 1998
--- objc-parse.y        Sun Jan  4 07:43:22 1998
***************
*** 2647,2666 ****
--- 2647,2674 ----
  methodproto:
          '+'
                {
+               /* DTM: We should remember protocol qualifiers in prototypes */
+                 remember_protocol_qualifiers ();
                  objc_inherit_code = CLASS_METHOD_DECL;
                }
          methoddecl
                {
+               /* DTM: We should forget protocol qualifiers here */
+                 forget_protocol_qualifiers ();
                  add_class_method (objc_interface_context, $3);
                }
          semi_or_error
  
        | '-'
                {
+               /* DTM: We should remember protocol qualifiers in prototypes */
+                 remember_protocol_qualifiers ();
                  objc_inherit_code = INSTANCE_METHOD_DECL;
                }
          methoddecl
                {
+               /* DTM: We should forget protocol qualifiers here */
+                 forget_protocol_qualifiers ();
                  add_instance_method (objc_interface_context, $3);
                }
          semi_or_error

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Objective-C Protocol patch
  1998-01-04  4:46 Objective-C Protocol patch David T. McWherter
@ 1998-01-17 22:30 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1998-01-17 22:30 UTC (permalink / raw)
  To: David T. McWherter; +Cc: egcs

  > I noted that gcc-2.7.2.1 fails to recognize protocol qualifiers
  > in class definitions in its objective-c compiler:
  > 	@interface Foo
  > 	-(oneway void)myMethod; /* oneway not accepted here */
  > 	@end
  > 	@implementation Foo
  > 	-(oneway void) myMethod /* oneway accepted here */
  > 	{
  > 	}
  > 
  > And I traced the problem back to some code in objc-parse.y that 
  > is causing the parser to forget about the oneway (and friends) 
  > keywords, resulting in compiler errors in seemingly legitimate
  > code.  
  > 
  > Anwyays, I not that the egcs-971225 compiler operates identically to gcc
  > on this one, and so I've made a patch for objc-parse.y to fix this
  > problem, so that oneway and friends are accepted in both prototypes
  > and definitions of methods.  The patch is pretty trivial, so I'd
  > presume I don't need to fill out that copyright release form for
  > folks to use it, but let me know if I'm mistaken.  
Thanks.  I've cleaned things up a tiny bit and installed the patch.

jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-01-17 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-04  4:46 Objective-C Protocol patch David T. McWherter
1998-01-17 22:30 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).