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]

PATCH: Allow ObjC qualifiers in ObjC selector names


This slipped by unnoticed during the recent c-parse.in ObjC rewrite. The
"in", "out", "inout", "byway", "byref" and "oneway" context-sensitive
qualifiers (which now have the their very own OBJC_TYPE_QUAL %token) must
also be allowed to appear as selector names in methods (see test case
below), as they have been previously. Thankfully, the fix boils down
to adding a single Yacc unit rule.


I will commit this as obvious.

--Zem

[gcc/ChangeLog]
2004-10-18  Ziemowit Laski  <zlaski@apple.com>

* c-parse.in (reservedwords): Add OBJC_TYPE_QUAL as alternative.

[gcc/testsuite/ChangeLog]
2004-10-18  Ziemowit Laski  <zlaski@apple.com>

* objc.dg/method-14.m: New test.

Index: gcc/c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.249
diff -u -3 -p -r1.249 c-parse.in
--- gcc/c-parse.in      16 Oct 2004 23:19:07 -0000      1.249
+++ gcc/c-parse.in      18 Oct 2004 21:58:06 -0000
@@ -2889,7 +2889,7 @@ reservedwords:
          ENUM | STRUCT | UNION | IF | ELSE | WHILE | DO | FOR
        | SWITCH | CASE | DEFAULT | BREAK | CONTINUE | RETURN
        | GOTO | ASM_KEYWORD | SIZEOF | TYPEOF | ALIGNOF
-       | TYPESPEC | TYPE_QUAL
+       | TYPESPEC | TYPE_QUAL | OBJC_TYPE_QUAL
        ;

objc_qual:
Index: gcc/testsuite/objc.dg/method-14.m
===================================================================
RCS file: gcc/testsuite/objc.dg/method-14.m
diff -N gcc/testsuite/objc.dg/method-14.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/objc.dg/method-14.m 18 Oct 2004 21:58:18 -0000
@@ -0,0 +1,17 @@
+/* Test if context-sensitive "in", "out", "byref", etc., qualifiers can be
+ used as method selectors. */
+/* Author: Ziemowit Laski <zlaski@apple.com>. */
+/* { dg-do compile } */
+
+@interface Foo
+- (void)insertNewButtonImage:(Foo *)newButtonImage in:(Foo *)buttonCell;
++ (oneway void)oneway:(int)i2 byref:(int)i3 out:(float)f4 bycopy:(float)f5;
+@end
+
+@implementation Foo
+- (void)insertNewButtonImage:(Foo *)newButtonImage in:(Foo *)buttonCell { }
++ (oneway void)oneway:(int)i2 byref:(int)i3 out:(float)f4 bycopy:(float)f5 { }
+@end
+
+/* { dg-final { scan-assembler "insertNewButtonImage:in:" } } */
+/* { dg-final { scan-assembler "oneway:byref:out:bycopy:" } } */



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