diff mbox

[ObjC++] fix pasto which makes ObjC++ not respond to attributes after ellipsis.

Message ID AB1EA53E-0857-43F1-82FE-9E8964C16AC5@sandoe-acoustics.co.uk
State New
Headers show

Commit Message

Iain Sandoe Oct. 6, 2010, 6:15 p.m. UTC
Hi,
I made a pasto when reconciling c & c++ implementations of the method  
attribute parsing - this is causing attributes to error after ellipsis  
in ObjC++ method decls.

OK for trunk?
Iain

gcc/cp:

	parser.c (cp_parser_objc_method_tail_params_opt): Peek new token  
after finding
	ellipsis, before checking for attributes.

testsuite:

	* objc.dg/attributes/method-attribute-3.m: New.
	* obj-c++.dg/attributes/method-attribute-3.mm: New.

Comments

Mike Stump Oct. 6, 2010, 7:37 p.m. UTC | #1
On Oct 6, 2010, at 11:15 AM, IainS wrote:
> I made a pasto when reconciling c & c++ implementations of the method attribute parsing - this is causing attributes to error after ellipsis in ObjC++ method decls.
> 
> OK for trunk?

Ok.
diff mbox

Patch

Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c	(revision 165023)
+++ gcc/cp/parser.c	(working copy)
@@ -21561,6 +21561,7 @@  cp_parser_objc_method_tail_params_opt (cp_parser*
 	{
 	  cp_lexer_consume_token (parser->lexer);  /* Eat '...'.  */
 	  *ellipsisp = true;
+	  token = cp_lexer_peek_token (parser->lexer);
 	  break;
 	}
 
Index: gcc/testsuite/objc.dg/attributes/method-attribute-3.m
===================================================================
--- gcc/testsuite/objc.dg/attributes/method-attribute-3.m	(revision 0)
+++ gcc/testsuite/objc.dg/attributes/method-attribute-3.m	(revision 0)
@@ -0,0 +1,24 @@ 
+/* { dg-do compile } */
+
+#include "../../objc-obj-c++-shared/Object1.h"
+
+@interface obj : Object {
+@public 
+  int var;
+}
+- (int) vargsn: (int) count, ... __attribute__((deprecated)); /* { dg-warning " method attributes are not available in this version of the compiler" } */
+@end
+
+@implementation obj
+- (int) vargsn: (int) count, ... 
+{
+  return 0;
+}
+@end 
+
+int foo (void)
+{
+  obj *p = [obj new];
+  
+  return [p vargsn:0];
+}
Index: gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm	(revision 0)
+++ gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm	(revision 0)
@@ -0,0 +1,24 @@ 
+/* { dg-do compile } */
+
+#include "../../objc-obj-c++-shared/Object1.h"
+
+@interface obj : Object {
+@public 
+  int var;
+}
+- (int) vargsn: (int) count, ... __attribute__((deprecated)); /* { dg-warning " method attributes are not available in this version of the compiler" } */
+@end
+
+@implementation obj
+- (int) vargsn: (int) count, ... 
+{
+  return 0;
+}
+@end 
+
+int foo (void)
+{
+  obj *p = [obj new];
+  
+  return [p vargsn:0];
+}