From cabf6150800634d6edcb16a7a20925ec082ccf1f Mon Sep 17 00:00:00 2001 From: iains Date: Thu, 7 Oct 2010 13:51:38 +0000 Subject: [PATCH] fix cut & paste error in cp/parser and add testscases in case of fture error. 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165109 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ .../obj-c++.dg/attributes/method-attribute-3.mm | 24 ++++++++++++++++++++++ .../objc.dg/attributes/method-attribute-3.m | 24 ++++++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm create mode 100644 gcc/testsuite/objc.dg/attributes/method-attribute-3.m diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6219f04..ac07e63 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Iain Sandoe + + parser.c (cp_parser_objc_method_tail_params_opt): Peek new token after + finding ellipsis, before checking for attributes. + 2010-10-06 Nicola Pero Merge from apple/trunk branch on FSF servers. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7e25157..6c842df 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21568,6 +21568,7 @@ cp_parser_objc_method_tail_params_opt (cp_parser* parser, bool *ellipsisp, { cp_lexer_consume_token (parser->lexer); /* Eat '...'. */ *ellipsisp = true; + token = cp_lexer_peek_token (parser->lexer); break; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bedc124..a07e2e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-07 Iain Sandoe + + * objc.dg/attributes/method-attribute-3.m: New. + * obj-c++.dg/attributes/method-attribute-3.mm: New. + 2010-10-07 Mikael Morin PR fortran/45916 diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm new file mode 100644 index 0000000..05b9884 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-3.mm @@ -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]; +} diff --git a/gcc/testsuite/objc.dg/attributes/method-attribute-3.m b/gcc/testsuite/objc.dg/attributes/method-attribute-3.m new file mode 100644 index 0000000..05b9884 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-attribute-3.m @@ -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]; +} -- 2.7.4