From 3cfa8f8272176e74a0a8ac2075a3d55046a44652 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Thu, 7 Oct 2010 17:17:22 +0000 Subject: [PATCH] In gcc/cp/: 2010-10-07 Nicola Pero In gcc/cp/: 2010-10-07 Nicola Pero Merge from apple/trunk branch on FSF servers. 2006-04-26 Fariborz Jahanian Radar 4508851 * parser.c (cp_parser_objc_interstitial_code): Recognize and parse RID_NAMESPACE keyword. In gcc/testsuite/: 2010-10-07 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. 2006-04-26 Fariborz Jahanian Radar 4508851 * obj-c++.dg/method-namespace-1.mm: New. From-SVN: r165125 --- gcc/cp/ChangeLog | 12 +++++++- gcc/cp/parser.c | 2 ++ gcc/testsuite/ChangeLog | 9 ++++++ .../obj-c++.dg/method-namespace-1.mm | 29 +++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/obj-c++.dg/method-namespace-1.mm diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ac07e63fefe..7e6bdda9f42 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,16 @@ +2010-10-07 Nicola Pero + + Merge from apple/trunk branch on FSF servers. + + 2006-04-26 Fariborz Jahanian + + Radar 4508851 + * parser.c (cp_parser_objc_interstitial_code): Recognize + and parse RID_NAMESPACE keyword. + 2010-10-07 Iain Sandoe - parser.c (cp_parser_objc_method_tail_params_opt): Peek new token after + * parser.c (cp_parser_objc_method_tail_params_opt): Peek new token after finding ellipsis, before checking for attributes. 2010-10-06 Nicola Pero diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6c842df2437..f5fa793da4a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21635,6 +21635,8 @@ cp_parser_objc_interstitial_code (cp_parser* parser) cp_lexer_consume_token (parser->lexer); objc_set_method_opt (false); } + else if (token->keyword == RID_NAMESPACE) + cp_parser_namespace_definition (parser); /* Other stray characters must generate errors. */ else if (token->type == CPP_OPEN_BRACE || token->type == CPP_CLOSE_BRACE) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12be3690ac2..c8f841ea490 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2010-10-07 Nicola Pero + + Merge from 'apple/trunk' branch on FSF servers. + + 2006-04-26 Fariborz Jahanian + + Radar 4508851 + * obj-c++.dg/method-namespace-1.mm: New. + 2010-10-07 Martin Jambor * gcc.dg/tree-ssa/sra-11.c: New test. diff --git a/gcc/testsuite/obj-c++.dg/method-namespace-1.mm b/gcc/testsuite/obj-c++.dg/method-namespace-1.mm new file mode 100644 index 00000000000..6095f572cca --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/method-namespace-1.mm @@ -0,0 +1,29 @@ +/* Test for usage of namespace inside @implementation. */ +/* { dg-do compile } */ +@interface MyDocument +@end + +@implementation MyDocument + +// This deprecated usage works +static void foo1() { } + +// This preferred usage does _not_ work +namespace + { + void foo2() { } + } + +namespace STD + { + void foo3 () {} + } + +using namespace STD; + +- (void) GARF { + foo2(); + foo3(); +} + +@end -- 2.30.2